netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] netfilter updates for net
@ 2013-04-04 12:56 Pablo Neira Ayuso
  2013-04-04 12:56 ` [PATCH 1/5] netfilter: reset nf_trace in nf_reset Pablo Neira Ayuso
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Pablo Neira Ayuso @ 2013-04-04 12:56 UTC (permalink / raw)
  To: netfilter-devel; +Cc: davem, netdev

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(-)

-- 
1.7.10.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/5] netfilter: reset nf_trace in nf_reset
  2013-04-04 12:56 [PATCH 0/5] netfilter updates for net Pablo Neira Ayuso
@ 2013-04-04 12:56 ` Pablo Neira Ayuso
  2013-04-04 12:56 ` [PATCH 2/5] netfilter: nfnetlink_queue: fix error return code in nfnetlink_queue_init() Pablo Neira Ayuso
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Pablo Neira Ayuso @ 2013-04-04 12:56 UTC (permalink / raw)
  To: netfilter-devel; +Cc: davem, netdev

From: Gao feng <gaofeng@cn.fujitsu.com>

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.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 include/linux/skbuff.h |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 441f5bf..72b3967 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -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. */
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/5] netfilter: nfnetlink_queue: fix error return code in nfnetlink_queue_init()
  2013-04-04 12:56 [PATCH 0/5] netfilter updates for net Pablo Neira Ayuso
  2013-04-04 12:56 ` [PATCH 1/5] netfilter: reset nf_trace in nf_reset Pablo Neira Ayuso
@ 2013-04-04 12:56 ` Pablo Neira Ayuso
  2013-04-04 12:56 ` [PATCH 3/5] netfilter: nfnetlink_acct: return -EINVAL if object name is empty Pablo Neira Ayuso
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Pablo Neira Ayuso @ 2013-04-04 12:56 UTC (permalink / raw)
  To: netfilter-devel; +Cc: davem, netdev

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

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

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nfnetlink_queue_core.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c
index 1cb4854..42680b2 100644
--- a/net/netfilter/nfnetlink_queue_core.c
+++ b/net/netfilter/nfnetlink_queue_core.c
@@ -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);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/5] netfilter: nfnetlink_acct: return -EINVAL if object name is empty
  2013-04-04 12:56 [PATCH 0/5] netfilter updates for net Pablo Neira Ayuso
  2013-04-04 12:56 ` [PATCH 1/5] netfilter: reset nf_trace in nf_reset Pablo Neira Ayuso
  2013-04-04 12:56 ` [PATCH 2/5] netfilter: nfnetlink_queue: fix error return code in nfnetlink_queue_init() Pablo Neira Ayuso
@ 2013-04-04 12:56 ` Pablo Neira Ayuso
  2013-04-04 12:56 ` [PATCH 4/5] netfilter: nf_conntrack: fix error return code Pablo Neira Ayuso
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Pablo Neira Ayuso @ 2013-04-04 12:56 UTC (permalink / raw)
  To: netfilter-devel; +Cc: davem, netdev

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

Reported-by: Michael Zintakis <michael.zintakis@googlemail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nfnetlink_acct.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/netfilter/nfnetlink_acct.c b/net/netfilter/nfnetlink_acct.c
index 589d686..dc3fd5d 100644
--- a/net/netfilter/nfnetlink_acct.c
+++ b/net/netfilter/nfnetlink_acct.c
@@ -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)
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/5] netfilter: nf_conntrack: fix error return code
  2013-04-04 12:56 [PATCH 0/5] netfilter updates for net Pablo Neira Ayuso
                   ` (2 preceding siblings ...)
  2013-04-04 12:56 ` [PATCH 3/5] netfilter: nfnetlink_acct: return -EINVAL if object name is empty Pablo Neira Ayuso
@ 2013-04-04 12:56 ` Pablo Neira Ayuso
  2013-04-04 12:56 ` [PATCH 5/5] netfilter: ip6t_NPT: Fix translation for non-multiple of 32 prefix lengths Pablo Neira Ayuso
  2013-04-04 21:42 ` [PATCH 0/5] netfilter updates for net David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: Pablo Neira Ayuso @ 2013-04-04 12:56 UTC (permalink / raw)
  To: netfilter-devel; +Cc: davem, netdev

From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

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

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nf_conntrack_standalone.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
index 6bcce40..fedee39 100644
--- a/net/netfilter/nf_conntrack_standalone.c
+++ b/net/netfilter/nf_conntrack_standalone.c
@@ -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
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/5] netfilter: ip6t_NPT: Fix translation for non-multiple of 32 prefix lengths
  2013-04-04 12:56 [PATCH 0/5] netfilter updates for net Pablo Neira Ayuso
                   ` (3 preceding siblings ...)
  2013-04-04 12:56 ` [PATCH 4/5] netfilter: nf_conntrack: fix error return code Pablo Neira Ayuso
@ 2013-04-04 12:56 ` Pablo Neira Ayuso
  2013-04-04 21:42 ` [PATCH 0/5] netfilter updates for net David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: Pablo Neira Ayuso @ 2013-04-04 12:56 UTC (permalink / raw)
  To: netfilter-devel; +Cc: davem, netdev

From: Matthias Schiffer <mschiffer@universe-factory.net>

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.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/ipv6/netfilter/ip6t_NPT.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/netfilter/ip6t_NPT.c b/net/ipv6/netfilter/ip6t_NPT.c
index 33608c6..cb63114 100644
--- a/net/ipv6/netfilter/ip6t_NPT.c
+++ b/net/ipv6/netfilter/ip6t_NPT.c
@@ -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;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/5] netfilter updates for net
  2013-04-04 12:56 [PATCH 0/5] netfilter updates for net Pablo Neira Ayuso
                   ` (4 preceding siblings ...)
  2013-04-04 12:56 ` [PATCH 5/5] netfilter: ip6t_NPT: Fix translation for non-multiple of 32 prefix lengths Pablo Neira Ayuso
@ 2013-04-04 21:42 ` David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2013-04-04 21:42 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel, netdev

From: Pablo Neira Ayuso <pablo@netfilter.org>
Date: Thu,  4 Apr 2013 14:56:04 +0200

> 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

Pulled, thanks Pablo.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-04-04 21:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-04 12:56 [PATCH 0/5] netfilter updates for net Pablo Neira Ayuso
2013-04-04 12:56 ` [PATCH 1/5] netfilter: reset nf_trace in nf_reset Pablo Neira Ayuso
2013-04-04 12:56 ` [PATCH 2/5] netfilter: nfnetlink_queue: fix error return code in nfnetlink_queue_init() Pablo Neira Ayuso
2013-04-04 12:56 ` [PATCH 3/5] netfilter: nfnetlink_acct: return -EINVAL if object name is empty Pablo Neira Ayuso
2013-04-04 12:56 ` [PATCH 4/5] netfilter: nf_conntrack: fix error return code Pablo Neira Ayuso
2013-04-04 12:56 ` [PATCH 5/5] netfilter: ip6t_NPT: Fix translation for non-multiple of 32 prefix lengths Pablo Neira Ayuso
2013-04-04 21:42 ` [PATCH 0/5] netfilter updates for net David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).