Skip to contentSkip to conversation

: Netfilter Update

PATCH In review Patrick McHardy 2 participants 8 messages Jun 26, 2006 – Jun 27, 2006

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

cover : Netfilter Update

Hi Dave,

following is a small netfilter update. Nothing exciting, just minor fixes and a missing helptext. Please apply, thanks.

 net/ipv4/netfilter/arp_tables.c         |    3 ++-
 net/ipv4/netfilter/ip_queue.c           |   12 ++++++++++--
 net/ipv4/netfilter/ip_tables.c          |    3 ++-
 net/ipv6/netfilter/ip6_tables.c         |    3 ++-
 net/netfilter/Kconfig                   |    5 ++++-
 net/netfilter/nf_conntrack_netlink.c    |    1 +
 net/netfilter/nf_conntrack_proto_sctp.c |    2 ++
 net/netfilter/nfnetlink_queue.c         |   12 ++++++++++--
 net/netfilter/xt_sctp.c                 |    2 +-
 net/netfilter/xt_tcpudp.c               |    2 +-
 10 files changed, 35 insertions(+), 10 deletions(-)

Jorge Matias:

      [NETFILTER]: xt_sctp: fix --chunk-types matching

Patrick McHardy:
[NETFILTER]: x_tables: fix xt_register_table error propagation [NETFILTER]: ip_queue/nfnetlink_queue: drop bridge port references when dev disappears [NETFILTER]: statistic match: add missing Kconfig help text

Yasuyuki Kozakai:
[NETFILTER]: nf_conntrack: Fix undefined references to local_bh_*

Yuri Gushin:
[NETFILTER]: xt_tcpudp: fix double unregistration in error path

#1 lore raw

PATCH 1/6 : x_tables: fix xt_register_table error propagation

[NETFILTER]: x_tables: fix xt_register_table error propagation

When xt_register_table fails the error is not properly propagated back. Based on patch by Lepton Wu <[email protected]>.

---
commit c223657397019f91ab8f7a7b8b417eae4a378c72
tree 016c6c6cd56cd11ef4d4250ab083da1894df03eb
parent 80cd9e86e65901f97f3c77b914985cff387d331d
author Patrick McHardy <[email protected]> Mon, 19 Jun 2006 16:48:07 +0200 committer Patrick McHardy <[email protected]> Mon, 19 Jun 2006 16:48:07 +0200

 net/ipv4/netfilter/arp_tables.c |    3 ++-
 net/ipv4/netfilter/ip_tables.c  |    3 ++-
 net/ipv6/netfilter/ip6_tables.c |    3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)
net/ipv4/netfilter/arp_tables.c +2 -1
index d0d1919..ad39bf6 100644
@@ -1120,7 +1120,8 @@ int arpt_register_table(struct arpt_tabl
 		return ret;
 	}
 
-	if (xt_register_table(table, &bootstrap, newinfo) != 0) {
+	ret = xt_register_table(table, &bootstrap, newinfo);
+	if (ret != 0) {
 		xt_free_table_info(newinfo);
 		return ret;
 	}
net/ipv4/netfilter/ip_tables.c +2 -1
index cee3397..101ad98 100644
@@ -2113,7 +2113,8 @@ int ipt_register_table(struct xt_table *
 		return ret;
 	}
 
-	if (xt_register_table(table, &bootstrap, newinfo) != 0) {
+	ret = xt_register_table(table, &bootstrap, newinfo);
+	if (ret != 0) {
 		xt_free_table_info(newinfo);
 		return ret;
 	}
net/ipv6/netfilter/ip6_tables.c +2 -1
index 2e72f89..0b5bd55 100644
@@ -1281,7 +1281,8 @@ int ip6t_register_table(struct xt_table 
 		return ret;
 	}
 
-	if (xt_register_table(table, &bootstrap, newinfo) != 0) {
+	ret = xt_register_table(table, &bootstrap, newinfo);
+	if (ret != 0) {
 		xt_free_table_info(newinfo);
 		return ret;
 	}
#2 lore raw

PATCH 2/6 : nf_conntrack: Fix undefined references to local_bh_*

In reply to Patrick McHardy

[NETFILTER]: nf_conntrack: Fix undefined references to local_bh_*

CC net/netfilter/nf_conntrack_proto_sctp.o
net/netfilter/nf_conntrack_proto_sctp.c: In function `sctp_print_conntrack':
net/netfilter/nf_conntrack_proto_sctp.c:206: warning: implicit declaration of function local_bh_disable' net/netfilter/nf_conntrack_proto_sctp.c:208: warning: implicit declaration of function local_bh_enable'
CC net/netfilter/nf_conntrack_netlink.o
net/netfilter/nf_conntrack_netlink.c: In function `ctnetlink_dump_table':
net/netfilter/nf_conntrack_netlink.c:429: warning: implicit declaration of function local_bh_disable' net/netfilter/nf_conntrack_netlink.c:452: warning: implicit declaration of function local_bh_enable'

Spotted by Toralf F�rster

---
commit 7cb7437f3a26e2054d315a9baea52f9d825a7286
tree 72c74e7b320d2763b3ba2e7387cf3f003c250b67
parent c223657397019f91ab8f7a7b8b417eae4a378c72
author Yasuyuki Kozakai <[email protected]> Mon, 19 Jun 2006 16:48:59 +0200 committer Patrick McHardy <[email protected]> Mon, 19 Jun 2006 16:48:59 +0200

 net/netfilter/nf_conntrack_netlink.c    |    1 +
 net/netfilter/nf_conntrack_proto_sctp.c |    2 ++
 2 files changed, 3 insertions(+), 0 deletions(-)
net/netfilter/nf_conntrack_netlink.c +1 -0
index b8c7c56..af48459 100644
@@ -29,6 +29,7 @@ #include <linux/skbuff.h>
 #include <linux/errno.h>
 #include <linux/netlink.h>
 #include <linux/spinlock.h>
+#include <linux/interrupt.h>
 #include <linux/notifier.h>
 
 #include <linux/netfilter.h>
net/netfilter/nf_conntrack_proto_sctp.c +2 -0
index 0c6da49..0839b70 100644
@@ -28,6 +28,8 @@ #include <linux/ip.h>
 #include <linux/sctp.h>
 #include <linux/string.h>
 #include <linux/seq_file.h>
+#include <linux/spinlock.h>
+#include <linux/interrupt.h>
 
 #include <net/netfilter/nf_conntrack.h>
 #include <net/netfilter/nf_conntrack_protocol.h>
#3 lore raw

PATCH 3/6 : xt_tcpudp: fix double unregistration in error path

In reply to Patrick McHardy

[NETFILTER]: xt_tcpudp: fix double unregistration in error path

"xt_unregister_match(AF_INET, &tcp_matchstruct)" is called twice, leaving "udp_matchstruct" registered, in case of a failure in the registration of the udp6 structure.

---
commit a81302ac4c22da108602d0c053c168a700c81e32
tree b420da32ec06dd3d9e9a42b581bcfcc05b6eee53
parent 7cb7437f3a26e2054d315a9baea52f9d825a7286
author Yuri Gushin <[email protected]> Mon, 19 Jun 2006 16:59:55 +0200 committer Patrick McHardy <[email protected]> Mon, 19 Jun 2006 16:59:55 +0200

 net/netfilter/xt_tcpudp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/netfilter/xt_tcpudp.c +1 -1
index 1b61dac..a9a63aa 100644
@@ -260,7 +260,7 @@ static int __init xt_tcpudp_init(void)
 	return ret;
 
 out_unreg_udp:
-	xt_unregister_match(&tcp_matchstruct);
+	xt_unregister_match(&udp_matchstruct);
 out_unreg_tcp6:
 	xt_unregister_match(&tcp6_matchstruct);
 out_unreg_tcp:
#4 lore raw

PATCH 4/6 : xt_sctp: fix --chunk-types matching

In reply to Patrick McHardy

[NETFILTER]: xt_sctp: fix --chunk-types matching

xt_sctp uses an incorrect header offset when --chunk-types is used.

---
commit 9565b859bc682e4c208f73e83adb21a7f86d0143
tree 7823e21bbe10b265fe011cb895f30160789210ad
parent a81302ac4c22da108602d0c053c168a700c81e32
author Jorge Matias <[email protected]> Mon, 19 Jun 2006 18:04:28 +0200 committer Patrick McHardy <[email protected]> Mon, 19 Jun 2006 18:04:28 +0200

 net/netfilter/xt_sctp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/netfilter/xt_sctp.c +1 -1
index b5110e5..919c037 100644
@@ -151,7 +151,7 @@ match(const struct sk_buff *skb,
 		&& SCCHECK(((ntohs(sh->dest) >= info->dpts[0]) 
 			&& (ntohs(sh->dest) <= info->dpts[1])), 
 			XT_SCTP_DEST_PORTS, info->flags, info->invflags)
-		&& SCCHECK(match_packet(skb, protoff,
+		&& SCCHECK(match_packet(skb, protoff + sizeof (sctp_sctphdr_t),
 					info->chunkmap, info->chunk_match_type,
  					info->flag_info, info->flag_count, 
 					hotdrop),
#5 lore raw

PATCH 5/6 : ip_queue/nfnetlink_queue: drop bridge port references when dev disappears

In reply to Patrick McHardy

[NETFILTER]: ip_queue/nfnetlink_queue: drop bridge port references when dev disappears

When a device that is acting as a bridge port is unregistered, the ip_queue/nfnetlink_queue notifier doesn't check if its one of physindev/physoutdev and doesn't release the references if it is.

---
commit 5e9d63f46ae2805245fcc9ec58f844d1347bd469
tree 96f0d37e0f70100ba2b31b7eaa5453125a4d6ac4
parent 9565b859bc682e4c208f73e83adb21a7f86d0143
author Patrick McHardy <[email protected]> Mon, 26 Jun 2006 17:15:02 +0200 committer Patrick McHardy <[email protected]> Mon, 26 Jun 2006 17:15:02 +0200

 net/ipv4/netfilter/ip_queue.c   |   12 ++++++++++--
 net/netfilter/nfnetlink_queue.c |   12 ++++++++++--
 2 files changed, 20 insertions(+), 4 deletions(-)
net/ipv4/netfilter/ip_queue.c +10 -2
index b93f049..213d116 100644
@@ -457,11 +457,19 @@ dev_cmp(struct ipq_queue_entry *entry, u
 	if (entry->info->indev)
 		if (entry->info->indev->ifindex == ifindex)
 			return 1;
-			
 	if (entry->info->outdev)
 		if (entry->info->outdev->ifindex == ifindex)
 			return 1;
-
+#ifdef CONFIG_BRIDGE_NETFILTER
+	if (entry->skb->nf_bridge) {
+		if (entry->skb->nf_bridge->physindev &&
+		    entry->skb->nf_bridge->physindev->ifindex == ifindex)
+			return 1;
+		if (entry->skb->nf_bridge->physoutdev &&
+		    entry->skb->nf_bridge->physoutdev->ifindex == ifindex)
+		    	return 1;
+	}
+#endif
 	return 0;
 }
 
net/netfilter/nfnetlink_queue.c +10 -2
index 86a4ac3..49ef41e 100644
@@ -680,11 +680,19 @@ dev_cmp(struct nfqnl_queue_entry *entry,
 	if (entinf->indev)
 		if (entinf->indev->ifindex == ifindex)
 			return 1;
-			
 	if (entinf->outdev)
 		if (entinf->outdev->ifindex == ifindex)
 			return 1;
-
+#ifdef CONFIG_BRIDGE_NETFILTER
+	if (entry->skb->nf_bridge) {
+		if (entry->skb->nf_bridge->physindev &&
+		    entry->skb->nf_bridge->physindev->ifindex == ifindex)
+			return 1;
+		if (entry->skb->nf_bridge->physoutdev &&
+		    entry->skb->nf_bridge->physoutdev->ifindex == ifindex)
+			return 1;
+	}
+#endif
 	return 0;
 }
 
#6 lore raw

PATCH 6/6 : statistic match: add missing Kconfig help text

In reply to Patrick McHardy

[NETFILTER]: statistic match: add missing Kconfig help text

---
commit 761a7b483e46977e51f703ec5ff5d5861f328eb8
tree 18b8e54efc62a8c6d03ae8fba782b1b0c5d1f18f
parent 5e9d63f46ae2805245fcc9ec58f844d1347bd469
author Patrick McHardy <[email protected]> Mon, 26 Jun 2006 17:17:25 +0200 committer Patrick McHardy <[email protected]> Mon, 26 Jun 2006 17:17:25 +0200

 net/netfilter/Kconfig |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
net/netfilter/Kconfig +4 -1
index b1622b7..42a178a 100644
@@ -411,7 +411,10 @@ config NETFILTER_XT_MATCH_STATISTIC
 	tristate '"statistic" match support'
 	depends on NETFILTER_XTABLES
 	help
-	  statistic module
+	  This option adds a `statistic' match, which allows you to match
+	  on packets periodically or randomly with a given percentage.
+
+	  To compile it as a module, choose M here.  If unsure, say N.
 
 config NETFILTER_XT_MATCH_STRING
 	tristate  '"string" match support'
maintainer
#7 lore raw
In reply to Patrick McHardy

From: Patrick McHardy <[email protected]>
Date: Mon, 26 Jun 2006 17:43:07 +0200 (MEST)

Quoted 2 lines

following is a small netfilter update. Nothing exciting, just minor fixes and a missing helptext. Please apply, thanks.

All applied, thanks Patrick.