* [PATCH -next] syncookies: only increment SYNCOOKIESFAILED on validation error
@ 2014-10-30 1:55 Florian Westphal
2014-10-30 20:54 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2014-10-30 1:55 UTC (permalink / raw)
To: netdev; +Cc: Florian Westphal
Only count packets that failed cookie-authentication.
We can get SYNCOOKIESFAILED > 0 while we never even sent a single cookie.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
net/ipv4/syncookies.c | 7 +++++--
net/ipv6/syncookies.c | 7 +++++--
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index 32b98d0..4ac7bca 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -275,8 +275,11 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb)
if (!sysctl_tcp_syncookies || !th->ack || th->rst)
goto out;
- if (tcp_synq_no_recent_overflow(sk) ||
- (mss = __cookie_v4_check(ip_hdr(skb), th, cookie)) == 0) {
+ if (tcp_synq_no_recent_overflow(sk))
+ goto out;
+
+ mss = __cookie_v4_check(ip_hdr(skb), th, cookie);
+ if (mss == 0) {
NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_SYNCOOKIESFAILED);
goto out;
}
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c
index 0e26e79..be291ba 100644
--- a/net/ipv6/syncookies.c
+++ b/net/ipv6/syncookies.c
@@ -171,8 +171,11 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
if (!sysctl_tcp_syncookies || !th->ack || th->rst)
goto out;
- if (tcp_synq_no_recent_overflow(sk) ||
- (mss = __cookie_v6_check(ipv6_hdr(skb), th, cookie)) == 0) {
+ if (tcp_synq_no_recent_overflow(sk))
+ goto out;
+
+ mss = __cookie_v6_check(ipv6_hdr(skb), th, cookie);
+ if (mss == 0) {
NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_SYNCOOKIESFAILED);
goto out;
}
--
2.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] syncookies: only increment SYNCOOKIESFAILED on validation error
2014-10-30 1:55 [PATCH -next] syncookies: only increment SYNCOOKIESFAILED on validation error Florian Westphal
@ 2014-10-30 20:54 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-10-30 20:54 UTC (permalink / raw)
To: fw; +Cc: netdev
From: Florian Westphal <fw@strlen.de>
Date: Thu, 30 Oct 2014 02:55:38 +0100
> Only count packets that failed cookie-authentication.
> We can get SYNCOOKIESFAILED > 0 while we never even sent a single cookie.
>
> Signed-off-by: Florian Westphal <fw@strlen.de>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-10-30 20:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-30 1:55 [PATCH -next] syncookies: only increment SYNCOOKIESFAILED on validation error Florian Westphal
2014-10-30 20:54 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).