Skip to contentSkip to conversation

netfilter: fix nf_l4proto_log_invalid to log invalid packets

PATCH Applied Andrei Vagin 4 participants 4 messages Apr 17, 2019 – Apr 30, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netfilter: fix nf_l4proto_log_invalid to log invalid packets

It doesn't log a packet if sysctl_log_invalid isn't equal to protonum OR sysctl_log_invalid isn't equal to IPPROTO_RAW. This sentence is always true. I believe we need to replace OR to AND.

Cc Florian Westphal <[email protected]>
Fixes c4f3db1595827 ("netfilter: conntrack: add and use nf_l4proto_log_invalid")
---
 net/netfilter/nf_conntrack_proto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_conntrack_proto.c +1 -1
index b9403a266a2e..37bb530d848f 100644
@@ -55,7 +55,7 @@ void nf_l4proto_log_invalid(const struct sk_buff *skb,
 	struct va_format vaf;
 	va_list args;
 
-	if (net->ct.sysctl_log_invalid != protonum ||
+	if (net->ct.sysctl_log_invalid != protonum &&
 	    net->ct.sysctl_log_invalid != IPPROTO_RAW)
 		return;
 
Signature · 1 line
2.20.1
maintainer Acked-by on v1 1/1
#1 lore raw

net/netfilter/nf_conntrack_proto.c void nf_l4proto_log_invalid(const struct sk_buff *skb, · line 59

Quoted 11 lines · Andrei Vagin
net/netfilter/nf_conntrack_proto.c +1 -1
index b9403a266a2e..37bb530d848f 100644
@@ -55,7 +55,7 @@ void nf_l4proto_log_invalid(const struct sk_buff *skb,
 	struct va_format vaf;
 	va_list args;
 
-	if (net->ct.sysctl_log_invalid != protonum ||
+	if (net->ct.sysctl_log_invalid != protonum &&
 	    net->ct.sysctl_log_invalid != IPPROTO_RAW)

Urgh, thanks for fixing this.

maintainer Applied
#2 lore raw
In reply to Andrei Vagin
Quoted 3 lines · Andrei Vagin

It doesn't log a packet if sysctl_log_invalid isn't equal to protonum OR sysctl_log_invalid isn't equal to IPPROTO_RAW. This sentence is always true. I believe we need to replace OR to AND.

Applied, thanks.

#3 lore raw
Quoted 7 lines · Pablo Neira Ayuso
Quoted 3 lines · Andrei Vagin

It doesn't log a packet if sysctl_log_invalid isn't equal to protonum OR sysctl_log_invalid isn't equal to IPPROTO_RAW. This sentence is always true. I believe we need to replace OR to AND.

Applied, thanks.

I also happened to find this bug today.
I almost can not believe I'm the second guy to notice the issue -- the bug has been there for 1 year and a half...

Anyway, I'm glad to see that Andrei fixed it!

-- Dexuan