Skip to contentSkip to conversation

netfilter fixes for net

PATCH In review [email protected] 2 participants 4 messages Feb 26, 2013

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

cover netfilter fixes for net

From: Pablo Neira Ayuso <[email protected]>

Hi David,

The following patchset contains two bugfixes for netfilter/ipset via Jozsef Kadlecsik, they are:

* Fix timeout corruption if sets are resized, by Josh Hunt.

* Fix bogus error report if the flag nomatch is set, from Jozsef.

You can pull these changes from:

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

Thanks!

Josh Hunt (1):
netfilter: ipset: timeout values corrupted on set resize

Jozsef Kadlecsik (1):
netfilter: ipset: "Directory not empty" error message

 include/linux/netfilter/ipset/ip_set_ahash.h |    4 +++-
 net/netfilter/ipset/ip_set_core.c            |    3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.10.4
author maintainer
#1 lore raw

PATCH 1/2 netfilter: ipset: timeout values corrupted on set resize

From: Josh Hunt <[email protected]>

If a resize is triggered on a set with timeouts enabled, the timeout values will get corrupted when copying them to the new set. This occured b/c the wrong timeout value is supplied to type_pf_elem_tadd().

This also adds simple debug statement similar to the one in type_pf_resize().

---
 include/linux/netfilter/ipset/ip_set_ahash.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
include/linux/netfilter/ipset/ip_set_ahash.h +3 -1
index ef9acd3..01d25e6 100644
@@ -854,6 +854,8 @@ type_pf_tresize(struct ip_set *set, bool retried)
 retry:
 	ret = 0;
 	htable_bits++;
+	pr_debug("attempt to resize set %s from %u to %u, t %p\n",
+		 set->name, orig->htable_bits, htable_bits, orig);
 	if (!htable_bits) {
 		/* In case we have plenty of memory :-) */
 		pr_warning("Cannot increase the hashsize of set %s further\n",
@@ -873,7 +875,7 @@ retry:
 			data = ahash_tdata(n, j);
 			m = hbucket(t, HKEY(data, h->initval, htable_bits));
 			ret = type_pf_elem_tadd(m, data, AHASH_MAX(h), 0,
-						type_pf_data_timeout(data));
+						ip_set_timeout_get(type_pf_data_timeout(data)));
 			if (ret < 0) {
 				read_unlock_bh(&set->lock);
 				ahash_destroy(t);
Signature · 1 line
1.7.10.4
author maintainer
#2 lore raw

PATCH 2/2 netfilter: ipset: "Directory not empty" error message

In reply to [email protected]

From: Jozsef Kadlecsik <[email protected]>

When an entry flagged with "nomatch" was tested by ipset, it returned the error message "Kernel error received:
Directory not empty" instead of "<element> is NOT in set <setname>" (reported by John Brendler).

The internal error code was not properly transformed before returning to userspace, fixed.

---
 net/netfilter/ipset/ip_set_core.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/netfilter/ipset/ip_set_core.c +2 -1
index 6d6d8f2..38ca630 100644
@@ -1470,7 +1470,8 @@ ip_set_utest(struct sock *ctnl, struct sk_buff *skb,
 	if (ret == -EAGAIN)
 		ret = 1;
 
-	return ret < 0 ? ret : ret > 0 ? 0 : -IPSET_ERR_EXIST;
+	return (ret < 0 && ret != -ENOTEMPTY) ? ret :
+		ret > 0 ? 0 : -IPSET_ERR_EXIST;
 }
 
 /* Get headed data of a set */
Signature · 1 line
1.7.10.4
maintainer
#3 lore raw
In reply to [email protected]

From: [email protected]
Date: Tue, 26 Feb 2013 14:45:18 +0100

Quoted 7 lines

From: Pablo Neira Ayuso <[email protected]>

Hi David,

The following patchset contains two bugfixes for netfilter/ipset via Jozsef Kadlecsik, they are:

Quoted 7 lines

* Fix timeout corruption if sets are resized, by Josh Hunt.

* Fix bogus error report if the flag nomatch is set, from Jozsef.

You can pull these changes from:

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

Pulled, thanks Pablo.