* [PATCH 1/1] netfilter: ipset: Fix the order of listing of sets
@ 2011-04-19 8:39 Jozsef Kadlecsik
2011-04-19 14:01 ` Patrick McHardy
0 siblings, 1 reply; 2+ messages in thread
From: Jozsef Kadlecsik @ 2011-04-19 8:39 UTC (permalink / raw)
To: netfilter-devel; +Cc: Patrick McHardy, Jozsef Kadlecsik
Hi Patrick,
Please apply the following bugfix against nf-2.6. Thanks!
Best regards,
Jozsef
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A restoreable saving of sets requires that list:set type of sets
come last and the code part which should have taken into account
the ordering was broken. The patch fixes the listing order.
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
---
net/netfilter/ipset/ip_set_core.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
index e88ac3c..d87e03b 100644
--- a/net/netfilter/ipset/ip_set_core.c
+++ b/net/netfilter/ipset/ip_set_core.c
@@ -1022,8 +1022,9 @@ ip_set_dump_start(struct sk_buff *skb, struct netlink_callback *cb)
if (cb->args[1] >= ip_set_max)
goto out;
- pr_debug("args[0]: %ld args[1]: %ld\n", cb->args[0], cb->args[1]);
max = cb->args[0] == DUMP_ONE ? cb->args[1] + 1 : ip_set_max;
+dump_last:
+ pr_debug("args[0]: %ld args[1]: %ld\n", cb->args[0], cb->args[1]);
for (; cb->args[1] < max; cb->args[1]++) {
index = (ip_set_id_t) cb->args[1];
set = ip_set_list[index];
@@ -1038,8 +1039,8 @@ ip_set_dump_start(struct sk_buff *skb, struct netlink_callback *cb)
* so that lists (unions of sets) are dumped last.
*/
if (cb->args[0] != DUMP_ONE &&
- !((cb->args[0] == DUMP_ALL) ^
- (set->type->features & IPSET_DUMP_LAST)))
+ ((cb->args[0] == DUMP_ALL) ==
+ !!(set->type->features & IPSET_DUMP_LAST)))
continue;
pr_debug("List set: %s\n", set->name);
if (!cb->args[2]) {
@@ -1083,6 +1084,12 @@ ip_set_dump_start(struct sk_buff *skb, struct netlink_callback *cb)
goto release_refcount;
}
}
+ /* If we dump all sets, continue with dumping last ones */
+ if (cb->args[0] == DUMP_ALL) {
+ cb->args[0] = DUMP_LAST;
+ cb->args[1] = 0;
+ goto dump_last;
+ }
goto out;
nla_put_failure:
@@ -1093,11 +1100,6 @@ release_refcount:
pr_debug("release set %s\n", ip_set_list[index]->name);
ip_set_put_byindex(index);
}
-
- /* If we dump all sets, continue with dumping last ones */
- if (cb->args[0] == DUMP_ALL && cb->args[1] >= max && !cb->args[2])
- cb->args[0] = DUMP_LAST;
-
out:
if (nlh) {
nlmsg_end(skb, nlh);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] netfilter: ipset: Fix the order of listing of sets
2011-04-19 8:39 [PATCH 1/1] netfilter: ipset: Fix the order of listing of sets Jozsef Kadlecsik
@ 2011-04-19 14:01 ` Patrick McHardy
0 siblings, 0 replies; 2+ messages in thread
From: Patrick McHardy @ 2011-04-19 14:01 UTC (permalink / raw)
To: Jozsef Kadlecsik; +Cc: netfilter-devel
Am 19.04.2011 10:39, schrieb Jozsef Kadlecsik:
> A restoreable saving of sets requires that list:set type of sets
> come last and the code part which should have taken into account
> the ordering was broken. The patch fixes the listing order.
Applied, thanks Jozsef.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-04-19 14:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-19 8:39 [PATCH 1/1] netfilter: ipset: Fix the order of listing of sets Jozsef Kadlecsik
2011-04-19 14:01 ` Patrick McHardy
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.