aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2010-06-02 20:43:44 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-05 05:23:14 -0400
commitaf9b4738574b46025de7ccbe75c7b24fd8914379 (patch)
tree6d05b82261ce76e6ecf00131c667292b62d16adf /net/ipv4
parent2a1d4bd46047efff513600d7ff422bc344f540a6 (diff)
syncookies: avoid unneeded tcp header flag double check
caller: if (!th->rst && !th->syn && th->ack) callee: if (!th->ack) make the caller only check for !syn (common for 3whs), and move the !rst / ack test to the callee. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/syncookies.c2
-rw-r--r--net/ipv4/tcp_ipv4.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index 5c24db4a3c91..c9dac8615958 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -266,7 +266,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
266 struct rtable *rt; 266 struct rtable *rt;
267 __u8 rcv_wscale; 267 __u8 rcv_wscale;
268 268
269 if (!sysctl_tcp_syncookies || !th->ack) 269 if (!sysctl_tcp_syncookies || !th->ack || th->rst)
270 goto out; 270 goto out;
271 271
272 if (tcp_synq_no_recent_overflow(sk) || 272 if (tcp_synq_no_recent_overflow(sk) ||
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index a13f881e5037..6558dfd899da 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1506,7 +1506,7 @@ static struct sock *tcp_v4_hnd_req(struct sock *sk, struct sk_buff *skb)
1506 } 1506 }
1507 1507
1508#ifdef CONFIG_SYN_COOKIES 1508#ifdef CONFIG_SYN_COOKIES
1509 if (!th->rst && !th->syn && th->ack) 1509 if (!th->syn)
1510 sk = cookie_v4_check(sk, skb, &(IPCB(skb)->opt)); 1510 sk = cookie_v4_check(sk, skb, &(IPCB(skb)->opt));
1511#endif 1511#endif
1512 return sk; 1512 return sk;