inet: refactor inet[6]_lookup functions to take skb
[cascardo/linux.git] / net / ipv4 / tcp_ipv4.c
index 2a67244..3f872a6 100644 (file)
@@ -73,7 +73,6 @@
 #include <net/timewait_sock.h>
 #include <net/xfrm.h>
 #include <net/secure_seq.h>
-#include <net/tcp_memcontrol.h>
 #include <net/busy_poll.h>
 
 #include <linux/inet.h>
@@ -638,8 +637,8 @@ static void tcp_v4_send_reset(const struct sock *sk, struct sk_buff *skb)
                 * Incoming packet is checked with md5 hash with finding key,
                 * no RST generated if md5 hash doesn't match.
                 */
-               sk1 = __inet_lookup_listener(net,
-                                            &tcp_hashinfo, ip_hdr(skb)->saddr,
+               sk1 = __inet_lookup_listener(net, &tcp_hashinfo, NULL, 0,
+                                            ip_hdr(skb)->saddr,
                                             th->source, ip_hdr(skb)->daddr,
                                             ntohs(th->source), inet_iif(skb));
                /* don't send rst if it can't find key */
@@ -861,7 +860,6 @@ static void tcp_v4_reqsk_destructor(struct request_sock *req)
        kfree(inet_rsk(req)->opt);
 }
 
-
 #ifdef CONFIG_TCP_MD5SIG
 /*
  * RFC2385 MD5 checksumming requires a mapping of
@@ -1583,7 +1581,8 @@ int tcp_v4_rcv(struct sk_buff *skb)
        TCP_SKB_CB(skb)->sacked  = 0;
 
 lookup:
-       sk = __inet_lookup_skb(&tcp_hashinfo, skb, th->source, th->dest);
+       sk = __inet_lookup_skb(&tcp_hashinfo, skb, __tcp_hdrlen(th), th->source,
+                              th->dest);
        if (!sk)
                goto no_tcp_socket;
 
@@ -1697,7 +1696,8 @@ do_time_wait:
        switch (tcp_timewait_state_process(inet_twsk(sk), skb, th)) {
        case TCP_TW_SYN: {
                struct sock *sk2 = inet_lookup_listener(dev_net(skb->dev),
-                                                       &tcp_hashinfo,
+                                                       &tcp_hashinfo, skb,
+                                                       __tcp_hdrlen(th),
                                                        iph->saddr, th->source,
                                                        iph->daddr, th->dest,
                                                        inet_iif(skb));
@@ -2389,6 +2389,16 @@ static int __net_init tcp_sk_init(struct net *net)
        net->ipv4.sysctl_tcp_keepalive_probes = TCP_KEEPALIVE_PROBES;
        net->ipv4.sysctl_tcp_keepalive_intvl = TCP_KEEPALIVE_INTVL;
 
+       net->ipv4.sysctl_tcp_syn_retries = TCP_SYN_RETRIES;
+       net->ipv4.sysctl_tcp_synack_retries = TCP_SYNACK_RETRIES;
+       net->ipv4.sysctl_tcp_syncookies = 1;
+       net->ipv4.sysctl_tcp_reordering = TCP_FASTRETRANS_THRESH;
+       net->ipv4.sysctl_tcp_retries1 = TCP_RETR1;
+       net->ipv4.sysctl_tcp_retries2 = TCP_RETR2;
+       net->ipv4.sysctl_tcp_orphan_retries = 0;
+       net->ipv4.sysctl_tcp_fin_timeout = TCP_FIN_TIMEOUT;
+       net->ipv4.sysctl_tcp_notsent_lowat = UINT_MAX;
+
        return 0;
 fail:
        tcp_sk_exit(net);