: Netfilter fixes
Subsystems (2)
cover : Netfilter fixes
Hi Dave,
following are a few netfilter fixes for 2.6.19. Please apply, thanks.
MAINTAINERS | 8 ++- net/ipv4/netfilter/arp_tables.c | 2 net/ipv4/netfilter/ip_conntrack_netlink.c | 72 +----------------------------- net/ipv4/netfilter/ipt_ECN.c | 6 +- net/ipv4/netfilter/ipt_TOS.c | 6 +- net/netfilter/Kconfig | 4 + net/netfilter/nf_conntrack_netlink.c | 72 +----------------------------- net/netfilter/xt_NFQUEUE.c | 2 net/netfilter/xt_connmark.c | 2 9 files changed, 24 insertions(+), 150 deletions(-)
Pablo Neira Ayuso:
[NETFILTER]: ctnetlink: Remove debugging messages
Patrick McHardy:
[NETFILTER]: fix cut-and-paste error in exit functions [NETFILTER]: arp_tables: missing unregistration on module unload [NETFILTER]: ipt_ECN/ipt_TOS: fix incorrect checksum update [NETFILTER]: xt_CONNSECMARK: fix Kconfig dependencies [NETFILTER]: Update MAINTAINERS entry
PATCH 1/6 : fix cut-and-paste error in exit functions
[NETFILTER]: fix cut-and-paste error in exit functions
---
commit c7b1507f3c040c02efa1b955f7180a33a232c4d9
tree fd21258deca0e5d8859271bb2c745302ce5a1e2a
parent 26da6cf44bc574d528d715a17e48f54da061c151
author Patrick McHardy <[email protected]> Wed, 11 Oct 2006 08:35:50 +0200 committer Patrick McHardy <[email protected]> Wed, 11 Oct 2006 08:35:50 +0200
net/netfilter/xt_NFQUEUE.c | 2 +- net/netfilter/xt_connmark.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/netfilter/xt_NFQUEUE.c +1 -1
@@ -68,7 +68,7 @@ static int __init xt_nfqueue_init(void) static void __exit xt_nfqueue_fini(void) { -xt_register_targets (xt_nfqueue_target,ARRAY_SIZE (xt_nfqueue_target)); +xt_unregister_targets (xt_nfqueue_target,ARRAY_SIZE (xt_nfqueue_target)); }module_init (xt_nfqueue_init);
net/netfilter/xt_connmark.c +1 -1
@@ -147,7 +147,7 @@ static int __init xt_connmark_init(void) static void __exit xt_connmark_fini(void) { -xt_register_matches (xt_connmark_match,ARRAY_SIZE (xt_connmark_match)); +xt_unregister_matches (xt_connmark_match,ARRAY_SIZE (xt_connmark_match)); }module_init (xt_connmark_init);
PATCH 2/6 : arp_tables: missing unregistration on module unload
In reply to Patrick McHardy[NETFILTER]: arp_tables: missing unregistration on module unload
---
commit 7f7a882296c917251a7936b41ee001e545a09e6c
tree 9cf7af01ce1b1d8e97caa59d6efceeefab9a3b5b
parent c7b1507f3c040c02efa1b955f7180a33a232c4d9
author Patrick McHardy <[email protected]> Wed, 11 Oct 2006 09:24:54 +0200 committer Patrick McHardy <[email protected]> Wed, 11 Oct 2006 09:24:54 +0200
net/ipv4/netfilter/arp_tables.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
net/ipv4/netfilter/arp_tables.c +2 -0
@@ -1196,6 +1196,8 @@ err1: static void __exit arp_tables_fini(void) {nf_unregister_sockopt (&arpt_sockopts); +xt_unregister_target (&arpt_error_target); +xt_unregister_target (&arpt_standard_target);xt_proto_fini (NF_ARP ); }
PATCH 3/6 : ipt_ECN/ipt_TOS: fix incorrect checksum update
In reply to Patrick McHardy[NETFILTER]: ipt_ECN/ipt_TOS: fix incorrect checksum update
Even though the tos field is only a single byte large, the values need to be converted to net-endian for the checkum update so they are in the corrent byte position. Also fix incorrect endian annotations.
Reported by Stephane Chazelas <[email protected]>
---
commit 889d786a9211434b29e402a501d01a590b072d31
tree 2290ec865a25bb99171ab4c44ea6c463df13a3b1
parent 7f7a882296c917251a7936b41ee001e545a09e6c
author Patrick McHardy <[email protected]> Wed, 11 Oct 2006 10:07:57 +0200 committer Patrick McHardy <[email protected]> Wed, 11 Oct 2006 10:07:57 +0200
net/ipv4/netfilter/ipt_ECN.c | 6 +++--- net/ipv4/netfilter/ipt_TOS.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
net/ipv4/netfilter/ipt_ECN.c +3 -3
@@ -28,7 +28,7 @@ static inline int set_ect_ip(struct sk_buff **pskb, const struct ipt_ECN_info *einfo) { struct iphdr *iph = (*pskb)->nh.iph; -__be16 oldtos; +u_int16_t oldtos;if ((iph->tos &IPT_ECN_IP_MASK ) != (einfo->ip_ect &IPT_ECN_IP_MASK )) {if (!skb_make_writable (pskb,sizeof (struct iphdr )))
@@ -37,8 +37,8 @@ set_ect_ip(struct sk_buff **pskb, const oldtos = iph->tos; iph->tos &= ~IPT_ECN_IP_MASK ; iph->tos |= (einfo->ip_ect &IPT_ECN_IP_MASK ); - iph->check =nf_csum_update (oldtos ^htons (0xFFFF ), iph->tos, - iph->check); + iph->check =nf_csum_update (htons (oldtos) ^htons (0xFFFF ), +htons (iph->tos), iph->check); }return 1 ; }
net/ipv4/netfilter/ipt_TOS.c +3 -3
@@ -30,7 +30,7 @@ target(struct sk_buff **pskb, {const struct ipt_tos_target_info *tosinfo = targinfo;struct iphdr *iph = (*pskb)->nh.iph; -__be16 oldtos; +u_int16_t oldtos;if ((iph->tos &IPTOS_TOS_MASK ) != tosinfo->tos) {if (!skb_make_writable (pskb,sizeof (struct iphdr )))
@@ -38,8 +38,8 @@ target(struct sk_buff **pskb, iph = (*pskb)->nh.iph; oldtos = iph->tos; iph->tos = (iph->tos &IPTOS_PREC_MASK ) | tosinfo->tos; - iph->check =nf_csum_update (oldtos ^htons (0xFFFF ), iph->tos, - iph->check); + iph->check =nf_csum_update (htons (oldtos) ^htons (0xFFFF ), +htons (iph->tos), iph->check); }return IPT_CONTINUE ; }
PATCH 4/6 : xt_CONNSECMARK: fix Kconfig dependencies
In reply to Patrick McHardy[NETFILTER]: xt_CONNSECMARK: fix Kconfig dependencies
CONNSECMARK needs conntrack, add missing dependency to fix linking error with CONNSECMARK=y and CONNTRACK=m.
Reported by Toralf F�rster <[email protected]>.
---
commit 0ab5046ab83e4f0e88c40922701b2bc365f6aa09
tree 4add4ff88904c63e7ff20872f2faff015bbcbc28
parent 889d786a9211434b29e402a501d01a590b072d31
author Patrick McHardy <[email protected]> Wed, 11 Oct 2006 10:39:47 +0200 committer Patrick McHardy <[email protected]> Wed, 11 Oct 2006 10:39:47 +0200
net/netfilter/Kconfig | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
net/netfilter/Kconfig +3 -1
@@ -209,7 +209,9 @@ config NETFILTER_XT_TARGET_SECMARK config NETFILTER_XT_TARGET_CONNSECMARK tristate '"CONNSECMARK" target support' - depends on NETFILTER_XTABLES && (NF_CONNTRACK_SECMARK || IP_NF_CONNTRACK_SECMARK) + depends on NETFILTER_XTABLES && \ + ((NF_CONNTRACK && NF_CONNTRACK_SECMARK) || \ + (IP_NF_CONNTRACK && IP_NF_CONNTRACK_SECMARK)) help The CONNSECMARK target copies security markings from packets to connections, and restores security markings from connections
PATCH 5/6 : Update MAINTAINERS entry
In reply to Patrick McHardy[NETFILTER]: Update MAINTAINERS entry
Patches should go to myself CC netfilter-devel.
---
commit 8a09f6627c34d4d38ce70377346de18f098937b2
tree c51ffb59734f7ff552c31c69fb3dc25d58606fd7
parent 0ab5046ab83e4f0e88c40922701b2bc365f6aa09
author Patrick McHardy <[email protected]> Wed, 11 Oct 2006 10:46:10 +0200 committer Patrick McHardy <[email protected]> Wed, 11 Oct 2006 10:46:10 +0200
MAINTAINERS | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
MAINTAINERS +5 -3
@@ -2040,11 +2040,13 @@ P: Marc Boucher P: James Morris P: Harald Welte P: Jozsef Kadlecsik -M: [email protected] +P: Patrick McHardy +M: [email protected] +L: [email protected] +L: [email protected] +L: [email protected] W: http://www.netfilter.org/ W: http://www.iptables.org/ -L: [email protected] -L: [email protected] S: Supported NETLABEL
PATCH 6/6 : ctnetlink: Remove debugging messages
In reply to Patrick McHardy[NETFILTER]: ctnetlink: Remove debugging messages
Remove (compilation-breaking) debugging messages introduced at early development stage.
---
commit 98a2b2e08556f6269f822594569db42c24160189
tree 060af727f228e84b390ab2b25e847f9318945f34
parent 8a09f6627c34d4d38ce70377346de18f098937b2
author Pablo Neira Ayuso <[email protected]> Wed, 11 Oct 2006 10:50:09 +0200 committer Patrick McHardy <[email protected]> Wed, 11 Oct 2006 10:50:09 +0200
net/ipv4/netfilter/ip_conntrack_netlink.c | 72 +---------------------------- net/netfilter/nf_conntrack_netlink.c | 72 +---------------------------- 2 files changed, 6 insertions(+), 138 deletions(-)
net/ipv4/netfilter/ip_conntrack_netlink.c +3 -69
@@ -44,13 +44,6 @@ MODULE_LICENSE("GPL");static char __initdata version[] ="0.90" ; -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(format, args...) -#endif - - static inline int ctnetlink_dump_tuples_proto(struct sk_buff *skb, const struct ip_conntrack_tuple *tuple,
@@ -398,7 +391,6 @@ #endif /* CONFIG_IP_NF_CONNTRACK_EVENTSstatic int ctnetlink_done (struct netlink_callback *cb) { -DEBUGP ("entered %s\n" , __FUNCTION__);if (cb->args[1 ])ip_conntrack_put ((struct ip_conntrack *)cb->args[1 ]);return 0 ;
@@ -411,9 +403,6 @@ ctnetlink_dump_table(struct sk_buff *skbstruct ip_conntrack_tuple_hash *h;struct list_head *i; -DEBUGP ("entered %s, last bucket=%lu id=%u\n" , __FUNCTION__, - cb->args[0 ], *id); -read_lock_bh (&ip_conntrack_lock); last = (struct ip_conntrack *)cb->args[1 ];for (; cb->args[0 ] < ip_conntrack_htable_size; cb->args[0 ]++) {
@@ -452,7 +441,6 @@ out:if (last)ip_conntrack_put (last); -DEBUGP ("leaving, last bucket=%lu id=%u\n" , cb->args[0 ], *id);return skb->len; }
@@ -466,8 +454,6 @@ ctnetlink_parse_tuple_ip(struct nfattr * {struct nfattr *tb[CTA_IP_MAX ]; -DEBUGP ("entered %s\n" , __FUNCTION__); -nfattr_parse_nested (tb,CTA_IP_MAX , attr);if (nfattr_bad_size (tb,CTA_IP_MAX , cta_min_ip))
@@ -481,8 +467,6 @@ ctnetlink_parse_tuple_ip(struct nfattr *return -EINVAL ; tuple->dst.ip = *(__be32 *)NFA_DATA (tb[CTA_IP_V4_DST -1 ]); -DEBUGP ("leaving\n" ); -return 0 ; }
@@ -503,8 +487,6 @@ ctnetlink_parse_tuple_proto(struct nfattstruct ip_conntrack_protocol *proto;int ret =0 ; -DEBUGP ("entered %s\n" , __FUNCTION__); -nfattr_parse_nested (tb,CTA_PROTO_MAX , attr);if (nfattr_bad_size (tb,CTA_PROTO_MAX , cta_min_proto))
@@ -531,8 +513,6 @@ ctnetlink_parse_tuple(struct nfattr *cdastruct nfattr *tb[CTA_TUPLE_MAX ];int err; -DEBUGP ("entered %s\n" , __FUNCTION__); -memset (tuple,0 ,sizeof (*tuple));nfattr_parse_nested (tb,CTA_TUPLE_MAX , cda[type-1 ]);
@@ -557,10 +537,6 @@ ctnetlink_parse_tuple(struct nfattr *cdaelse tuple->dst.dir =IP_CT_DIR_ORIGINAL ; -DUMP_TUPLE (tuple); - -DEBUGP ("leaving\n" ); -return 0 ; }
@@ -577,8 +553,6 @@ static int ctnetlink_parse_nat_proto(strstruct nfattr *tb[CTA_PROTONAT_MAX ];struct ip_nat_protocol *npt; -DEBUGP ("entered %s\n" , __FUNCTION__); -nfattr_parse_nested (tb,CTA_PROTONAT_MAX , attr);if (nfattr_bad_size (tb,CTA_PROTONAT_MAX , cta_min_protonat))
@@ -597,7 +571,6 @@ static int ctnetlink_parse_nat_proto(strip_nat_proto_put (npt); -DEBUGP ("leaving\n" );return 0 ; }
@@ -613,8 +586,6 @@ ctnetlink_parse_nat(struct nfattr *nat,struct nfattr *tb[CTA_NAT_MAX ];int err; -DEBUGP ("entered %s\n" , __FUNCTION__); -memset (range,0 ,sizeof (*range));nfattr_parse_nested (tb,CTA_NAT_MAX , nat);
@@ -640,7 +611,6 @@ ctnetlink_parse_nat(struct nfattr *nat,if (err <0 )return err; -DEBUGP ("leaving\n" ); return 0; }#endif
@@ -650,8 +620,6 @@ ctnetlink_parse_help(struct nfattr *attr {struct nfattr *tb[CTA_HELP_MAX ]; -DEBUGP ("entered %s\n" , __FUNCTION__); -nfattr_parse_nested (tb,CTA_HELP_MAX , attr);if (!tb[CTA_HELP_NAME -1 ])
@@ -679,8 +647,6 @@ ctnetlink_del_conntrack(struct sock *ctnstruct ip_conntrack *ct;int err =0 ; -DEBUGP ("entered %s\n" , __FUNCTION__); -if (nfattr_bad_size (cda,CTA_MAX , cta_min))return -EINVAL ;
@@ -698,10 +664,8 @@ ctnetlink_del_conntrack(struct sock *ctnreturn err; h =ip_conntrack_find_get (&tuple,NULL ); -if (!h) { -DEBUGP ("tuple not found in conntrack hash\n" ); +if (!h)return -ENOENT ; - } ct =tuplehash_to_ctrack (h);
@@ -716,7 +680,6 @@ ctnetlink_del_conntrack(struct sock *ctn ct->timeout.function ((unsigned long )ct);ip_conntrack_put (ct); -DEBUGP ("leaving\n" );return 0 ; }
@@ -731,8 +694,6 @@ ctnetlink_get_conntrack(struct sock *ctnstruct sk_buff *skb2 =NULL ;int err =0 ; -DEBUGP ("entered %s\n" , __FUNCTION__); -if (nlh->nlmsg_flags &NLM_F_DUMP ) {struct nfgenmsg *msg =NLMSG_DATA (nlh);u32 rlen;
@@ -770,11 +731,9 @@ #endifreturn err; h =ip_conntrack_find_get (&tuple,NULL ); -if (!h) { -DEBUGP ("tuple not found in conntrack hash" ); +if (!h)return -ENOENT ; - } -DEBUGP ("tuple found\n" ); + ct =tuplehash_to_ctrack (h); err = -ENOMEM ;
@@ -795,7 +754,6 @@ #endifif (err <0 ) goto out; -DEBUGP ("leaving\n" );return 0 ; free:
@@ -866,8 +824,6 @@ ctnetlink_change_helper(struct ip_conntrchar *helpname;int err; -DEBUGP ("entered %s\n" , __FUNCTION__); -/* don't change helper of sibling connections */ if (ct->master)return -EINVAL ;
@@ -938,8 +894,6 @@ ctnetlink_change_conntrack(struct ip_con {int err; -DEBUGP ("entered %s\n" , __FUNCTION__); -if (cda[CTA_HELP -1 ]) { err =ctnetlink_change_helper (ct, cda);if (err <0 )
@@ -969,7 +923,6 @@ #if defined(CONFIG_IP_NF_CONNTRACK_MARK) ct->mark =ntohl (*(__be32 *)NFA_DATA (cda[CTA_MARK -1 ]));#endif -DEBUGP ("all done\n" );return 0 ; }
@@ -981,8 +934,6 @@ ctnetlink_create_conntrack(struct nfattrstruct ip_conntrack *ct;int err = -EINVAL ; -DEBUGP ("entered %s\n" , __FUNCTION__); - ct =ip_conntrack_alloc (otuple, rtuple);if (ct ==NULL ||IS_ERR (ct))return -ENOMEM ;
@@ -1017,7 +968,6 @@ #endifif (ct->helper)ip_conntrack_helper_put (ct->helper); -DEBUGP ("conntrack with id %u inserted\n" , ct->id);return 0 ; err:
@@ -1033,8 +983,6 @@ ctnetlink_new_conntrack(struct sock *ctnstruct ip_conntrack_tuple_hash *h =NULL ;int err =0 ; -DEBUGP ("entered %s\n" , __FUNCTION__); -if (nfattr_bad_size (cda,CTA_MAX , cta_min))return -EINVAL ;
@@ -1058,7 +1006,6 @@ ctnetlink_new_conntrack(struct sock *ctnif (h ==NULL ) {write_unlock_bh (&ip_conntrack_lock); -DEBUGP ("no such conntrack, create new\n" ); err = -ENOENT ;if (nlh->nlmsg_flags &NLM_F_CREATE ) err =ctnetlink_create_conntrack (cda, &otuple, &rtuple);
@@ -1074,7 +1021,6 @@ ctnetlink_new_conntrack(struct sock *ctn/* We manipulate the conntrack inside the global conntrack table lock, * so there's no need to increase the refcount */ -DEBUGP ("conntrack found\n" ); err = -EEXIST ;if (!(nlh->nlmsg_flags &NLM_F_EXCL )) err =ctnetlink_change_conntrack (tuplehash_to_ctrack (h), cda);
@@ -1249,8 +1195,6 @@ ctnetlink_exp_dump_table(struct sk_buffstruct list_head *i;u_int32_t *id = (u_int32_t *) &cb->args[0 ]; -DEBUGP ("entered %s, last id=%llu\n" , __FUNCTION__, *id); -read_lock_bh (&ip_conntrack_lock);list_for_each_prev (i, &ip_conntrack_expect_list) { exp = (struct ip_conntrack_expect *) i;
@@ -1266,8 +1210,6 @@ ctnetlink_exp_dump_table(struct sk_buff out:read_unlock_bh (&ip_conntrack_lock); -DEBUGP ("leaving, last id=%llu\n" , *id); -return skb->len; }
@@ -1285,8 +1227,6 @@ ctnetlink_get_expect(struct sock *ctnl,struct sk_buff *skb2;int err =0 ; -DEBUGP ("entered %s\n" , __FUNCTION__); -if (nfattr_bad_size (cda,CTA_EXPECT_MAX , cta_min_exp))return -EINVAL ;
@@ -1437,8 +1377,6 @@ ctnetlink_create_expect(struct nfattr *cstruct ip_conntrack *ct;int err =0 ; -DEBUGP ("entered %s\n" , __FUNCTION__); -/* caller guarantees that those three CTA_EXPECT_* exist */ err =ctnetlink_parse_tuple (cda, &tuple,CTA_EXPECT_TUPLE );if (err <0 )
@@ -1490,8 +1428,6 @@ ctnetlink_new_expect(struct sock *ctnl,struct ip_conntrack_expect *exp;int err =0 ; -DEBUGP ("entered %s\n" , __FUNCTION__); -if (nfattr_bad_size (cda,CTA_EXPECT_MAX , cta_min_exp))return -EINVAL ;
@@ -1520,8 +1456,6 @@ ctnetlink_new_expect(struct sock *ctnl, err =ctnetlink_change_expect (exp, cda);write_unlock_bh (&ip_conntrack_lock); -DEBUGP ("leaving\n" ); -return err; }
net/netfilter/nf_conntrack_netlink.c +3 -69
278 lines not on this page · raw message
David Miller
maintainerFrom: Patrick McHardy <[email protected]>
Date: Thu, 12 Oct 2006 11:54:18 +0200 (MEST)
Quoted 1 line
following are a few netfilter fixes for 2.6.19. Please apply, thanks.
All applied, thanks Patrick.