Skip to contentSkip to conversation

fix invalid packet logging for icmpv6 conntrack

PATCH Applied Eric Leblond 3 participants 8 messages Jan 29, 2009 – Feb 9, 2009

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

cover fix invalid packet logging for icmpv6 conntrack

Hi,

This small patchset fixes a small issue with a nf_log_packet() message which was badly formatted and adds a message for invalid new icmpv6 packet.

Patchset statistic:

 net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

BR,
--
Eric Leblond <[email protected]>
INL: http://www.inl.fr/
NuFW: http://www.nufw.org/
EdenWall: http://www.edenwall.com/

#1 lore raw

PATCH 1/2 netfilter: fix nf_log_packet message in icmpv6 conntrack.

This patch fixes a trivial typo that was adding a new line at end of the nf_log_packet() prefix. It also make the logging conditionnal by adding a LOG_INVALID test.

---
 net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +3 -2
index c323643..72dbb6d 100644
@@ -201,8 +201,9 @@ icmpv6_error(struct net *net, struct sk_buff *skb, unsigned int dataoff,
 
 	if (net->ct.sysctl_checksum && hooknum == NF_INET_PRE_ROUTING &&
 	    nf_ip6_checksum(skb, hooknum, dataoff, IPPROTO_ICMPV6)) {
-		nf_log_packet(PF_INET6, 0, skb, NULL, NULL, NULL,
-			      "nf_ct_icmpv6: ICMPv6 checksum failed\n");
+		if (LOG_INVALID(net, IPPROTO_ICMPV6))
+			nf_log_packet(PF_INET6, 0, skb, NULL, NULL, NULL,
+				      "nf_ct_icmpv6: ICMPv6 checksum failed ");
 		return -NF_ACCEPT;
 	}
 
Signature · 1 line
1.5.6.3
#2 lore raw

Re: [PATCH 1/2] netfilter: fix nf_log_packet message in icmpv6 conntrack.

Quoted 3 lines · Eric Leblond

This patch fixes a trivial typo that was adding a new line at end of the nf_log_packet() prefix. It also make the logging conditionnal by adding a LOG_INVALID test.

Applied, thanks Eric.

#3 lore raw

PATCH 2/2 netfilter: log invalid new icmpv6 packet with nf_log_packet().

In reply to Eric Leblond

This patch adds a logging message for invalid new icmpv6 packet.

---
 net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +4 -0
index 72dbb6d..8b7059b 100644
@@ -126,6 +126,10 @@ static bool icmpv6_new(struct nf_conn *ct, const struct sk_buff *skb,
 		pr_debug("icmpv6: can't create new conn with type %u\n",
 			 type + 128);
 		nf_ct_dump_tuple_ipv6(&ct->tuplehash[0].tuple);
+		if (LOG_INVALID(&init_net, IPPROTO_ICMPV6))
+			nf_log_packet(PF_INET6, 0, skb, NULL, NULL, NULL,
+				      "nf_ct_icmpv6: invalid new with type %d ",
+				      type + 128);
 		return false;
 	}
 	atomic_set(&ct->proto.icmp.count, 0);
Signature · 1 line
1.5.6.3
#4 lore raw

Re: [PATCH 2/2] netfilter: log invalid new icmpv6 packet with nf_log_packet().

net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c static bool icmpv6_new(struct nf_conn *ct, const struct sk_buff *skb, · line 129

Quoted 7 lines · Eric Leblond
net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +1 -0
@@ -126,6 +126,10 @@ static bool icmpv6_new(struct nf_conn *ct, const struct sk_buff *skb,
 		pr_debug("icmpv6: can't create new conn with type %u\n",
 			 type + 128);
 		nf_ct_dump_tuple_ipv6(&ct->tuplehash[0].tuple);
+		if (LOG_INVALID(&init_net, IPPROTO_ICMPV6))

netns is nf_ct_net(ct) at this point, not &init_net.

Quoted 3 lines
net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +3 -0
+			nf_log_packet(PF_INET6, 0, skb, NULL, NULL, NULL,
+				      "nf_ct_icmpv6: invalid new with type %d ",
+				      type + 128);
#5 lore raw

Re: [PATCH 2/2] netfilter: log invalid new icmpv6 packet with nf_log_packet().

Hi,

Quoted 10 lines · Alexey Dobriyan

net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c static bool icmpv6_new(struct nf_conn *ct, const struct sk_buff *skb, · line 129

Quoted 7 lines · Eric Leblond
net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +1 -0
@@ -126,6 +126,10 @@ static bool icmpv6_new(struct nf_conn *ct, const struct sk_buff *skb,
 		pr_debug("icmpv6: can't create new conn with type %u\n",
 			 type + 128);
 		nf_ct_dump_tuple_ipv6(&ct->tuplehash[0].tuple);
+		if (LOG_INVALID(&init_net, IPPROTO_ICMPV6))

netns is nf_ct_net(ct) at this point, not &init_net.

Thanks a lot, updated patch to follow.

BR,
--
Eric Leblond <[email protected]>

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw

PATCH 1/1 netfilter: log invalid new icmpv6 packet with nf_log_packet().

This patch adds a logging message for invalid new icmpv6 packet.

---
 net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +4 -0
index 72dbb6d..41b8a95 100644
@@ -126,6 +126,10 @@ static bool icmpv6_new(struct nf_conn *ct, const struct sk_buff *skb,
 		pr_debug("icmpv6: can't create new conn with type %u\n",
 			 type + 128);
 		nf_ct_dump_tuple_ipv6(&ct->tuplehash[0].tuple);
+		if (LOG_INVALID(nf_ct_net(ct), IPPROTO_ICMPV6))
+			nf_log_packet(PF_INET6, 0, skb, NULL, NULL, NULL,
+				      "nf_ct_icmpv6: invalid new with type %d ",
+				      type + 128);
 		return false;
 	}
 	atomic_set(&ct->proto.icmp.count, 0);
Signature · 1 line
1.5.6.3
#7 lore raw

Re: [PATCH] netfilter: log invalid new icmpv6 packet with nf_log_packet().

Quoted 1 line · Eric Leblond

This patch adds a logging message for invalid new icmpv6 packet.

I've queued this one for 2.6.30 since its not really a fix. Thanks.