Skip to contentSkip to conversation

netfilter updates for net

PATCH In review Pablo Neira Ayuso 2 participants 7 messages Apr 4, 2013

Subsystems (3)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

cover netfilter updates for net

Hi David,

The following patchset contains netfilter updates for your net tree, they are:

* Fix missing the skb->trace reset in nf_reset, noticed by Gao Feng while using the TRACE target with several net namespaces.

* Fix prefix translation in IPv6 NPT if non-multiple of 32 prefixes are used, from Matthias Schiffer.

* Fix invalid nfacct objects with empty name, they are now rejected with -EINVAL, spotted by Michael Zintakis, patch from myself.

* A couple of fixes for wrong return values in the error path of nfnetlink_queue and nf_conntrack, from Wei Yongjun.

You can pull these changes from:

git://1984.lsi.us.es/nf master

Thanks!

P.S: Next pull request for fixes will be done from my new trees at git.kernel.org. I still have to make a pull request for nf-next from 1984 anytime soon though. After that, I'll close the trees in that machine.

Gao feng (1):
netfilter: reset nf_trace in nf_reset

Matthias Schiffer (1):
netfilter: ip6t_NPT: Fix translation for non-multiple of 32 prefix lengths

Pablo Neira Ayuso (1):
netfilter: nfnetlink_acct: return -EINVAL if object name is empty

Wei Yongjun (2):
netfilter: nfnetlink_queue: fix error return code in nfnetlink_queue_init()
netfilter: nf_conntrack: fix error return code

 include/linux/skbuff.h                  |    3 +++
 net/ipv6/netfilter/ip6t_NPT.c           |    2 +-
 net/netfilter/nf_conntrack_standalone.c |    1 +
 net/netfilter/nfnetlink_acct.c          |    2 ++
 net/netfilter/nfnetlink_queue_core.c    |    4 +++-
 5 files changed, 10 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.10.4
author maintainer
#1 lore raw

PATCH 1/5 netfilter: reset nf_trace in nf_reset

From: Gao feng <[email protected]>

We forgot to clear the nf_trace of sk_buff in nf_reset, When we use veth device, this nf_trace information will be leaked from one net namespace to another net namespace.

---
 include/linux/skbuff.h |    3 +++
 1 file changed, 3 insertions(+)
include/linux/skbuff.h +3 -0
index 441f5bf..72b3967 100644
@@ -2641,6 +2641,9 @@ static inline void nf_reset(struct sk_buff *skb)
 	nf_bridge_put(skb->nf_bridge);
 	skb->nf_bridge = NULL;
 #endif
+#if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE)
+	skb->nf_trace = 0;
+#endif
 }
 
 /* Note: This doesn't put any conntrack and bridge info in dst. */
Signature · 1 line
1.7.10.4
author maintainer
#2 lore raw

PATCH 2/5 netfilter: nfnetlink_queue: fix error return code in nfnetlink_queue_init()

In reply to Pablo Neira Ayuso

From: Wei Yongjun <[email protected]>

Fix to return a negative error code from the error handling case instead of 0, as returned elsewhere in this function.

---
 net/netfilter/nfnetlink_queue_core.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/netfilter/nfnetlink_queue_core.c +3 -1
index 1cb4854..42680b2 100644
@@ -1062,8 +1062,10 @@ static int __init nfnetlink_queue_init(void)
 
 #ifdef CONFIG_PROC_FS
 	if (!proc_create("nfnetlink_queue", 0440,
-			 proc_net_netfilter, &nfqnl_file_ops))
+			 proc_net_netfilter, &nfqnl_file_ops)) {
+		status = -ENOMEM;
 		goto cleanup_subsys;
+	}
 #endif
 
 	register_netdevice_notifier(&nfqnl_dev_notifier);
Signature · 1 line
1.7.10.4
author maintainer
#3 lore raw

PATCH 3/5 netfilter: nfnetlink_acct: return -EINVAL if object name is empty

In reply to Pablo Neira Ayuso

If user-space tries to create accounting object with an empty name, then return -EINVAL.

---
 net/netfilter/nfnetlink_acct.c |    2 ++
 1 file changed, 2 insertions(+)
net/netfilter/nfnetlink_acct.c +2 -0
index 589d686..dc3fd5d 100644
@@ -49,6 +49,8 @@ nfnl_acct_new(struct sock *nfnl, struct sk_buff *skb,
 		return -EINVAL;
 
 	acct_name = nla_data(tb[NFACCT_NAME]);
+	if (strlen(acct_name) == 0)
+		return -EINVAL;
 
 	list_for_each_entry(nfacct, &nfnl_acct_list, head) {
 		if (strncmp(nfacct->name, acct_name, NFACCT_NAME_MAX) != 0)
Signature · 1 line
1.7.10.4
author maintainer
#4 lore raw

PATCH 4/5 netfilter: nf_conntrack: fix error return code

In reply to Pablo Neira Ayuso

From: Wei Yongjun <[email protected]>

Fix to return a negative error code from the error handling case instead of 0, as returned elsewhere in function nf_conntrack_standalone_init().

---
 net/netfilter/nf_conntrack_standalone.c |    1 +
 1 file changed, 1 insertion(+)
net/netfilter/nf_conntrack_standalone.c +1 -0
index 6bcce40..fedee39 100644
@@ -568,6 +568,7 @@ static int __init nf_conntrack_standalone_init(void)
 		register_net_sysctl(&init_net, "net", nf_ct_netfilter_table);
 	if (!nf_ct_netfilter_header) {
 		pr_err("nf_conntrack: can't register to sysctl.\n");
+		ret = -ENOMEM;
 		goto out_sysctl;
 	}
 #endif
Signature · 1 line
1.7.10.4
author maintainer
#5 lore raw

PATCH 5/5 netfilter: ip6t_NPT: Fix translation for non-multiple of 32 prefix lengths

In reply to Pablo Neira Ayuso

From: Matthias Schiffer <[email protected]>

The bitmask used for the prefix mangling was being calculated incorrectly, leading to the wrong part of the address being replaced when the prefix length wasn't a multiple of 32.

---
 net/ipv6/netfilter/ip6t_NPT.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/netfilter/ip6t_NPT.c +1 -1
index 33608c6..cb63114 100644
@@ -57,7 +57,7 @@ static bool ip6t_npt_map_pfx(const struct ip6t_npt_tginfo *npt,
 		if (pfx_len - i >= 32)
 			mask = 0;
 		else
-			mask = htonl(~((1 << (pfx_len - i)) - 1));
+			mask = htonl((1 << (i - pfx_len + 32)) - 1);
 
 		idx = i / 32;
 		addr->s6_addr32[idx] &= mask;
Signature · 1 line
1.7.10.4
maintainer
#6 lore raw
In reply to Pablo Neira Ayuso

From: Pablo Neira Ayuso <[email protected]>
Date: Thu, 4 Apr 2013 14:56:04 +0200

Quoted 12 lines

The following patchset contains netfilter updates for your net tree, they are:

* Fix missing the skb->trace reset in nf_reset, noticed by Gao Feng while using the TRACE target with several net namespaces.

* Fix prefix translation in IPv6 NPT if non-multiple of 32 prefixes are used, from Matthias Schiffer.

* Fix invalid nfacct objects with empty name, they are now rejected with -EINVAL, spotted by Michael Zintakis, patch from myself.

Quoted 6 lines

* A couple of fixes for wrong return values in the error path of nfnetlink_queue and nf_conntrack, from Wei Yongjun.

You can pull these changes from:

git://1984.lsi.us.es/nf master

Pulled, thanks Pablo.