* [PATCH 0/3] netfilter: ipset: fixes
@ 2011-04-09 20:02 Jozsef Kadlecsik
2011-04-09 20:03 ` [PATCH 1/3] netfilter: ipset: bitmap:ip,mac type requires "src" for MAC Jozsef Kadlecsik
0 siblings, 1 reply; 7+ messages in thread
From: Jozsef Kadlecsik @ 2011-04-09 20:02 UTC (permalink / raw)
To: netfilter-devel; +Cc: Patrick McHardy, Lennert Buytenhek, Jozsef Kadlecsik
Hi Patrick,
This batch contains and important bugfix and two small patches for ipset. Please
apply them.
Best regards,
Jozsef
Jozsef Kadlecsik (3):
netfilter: ipset: bitmap:ip,mac type requires "src" for MAC
netfilter: ipset: Whitespace fixes: some space before tab slipped in.
netfilter: ipset: set match and SET target fixes
net/netfilter/ipset/ip_set_bitmap_ipmac.c | 4 ++++
net/netfilter/ipset/ip_set_list_set.c | 4 ++--
net/netfilter/xt_set.c | 18 ++++++++++++++++--
3 files changed, 22 insertions(+), 4 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] netfilter: ipset: bitmap:ip,mac type requires "src" for MAC
2011-04-09 20:02 [PATCH 0/3] netfilter: ipset: fixes Jozsef Kadlecsik
@ 2011-04-09 20:03 ` Jozsef Kadlecsik
2011-04-09 20:03 ` [PATCH 2/3] netfilter: ipset: Whitespace fixes: some space before tab slipped in Jozsef Kadlecsik
2011-04-13 11:44 ` [PATCH 1/3] netfilter: ipset: bitmap:ip,mac type requires "src" for MAC Patrick McHardy
0 siblings, 2 replies; 7+ messages in thread
From: Jozsef Kadlecsik @ 2011-04-09 20:03 UTC (permalink / raw)
To: netfilter-devel; +Cc: Patrick McHardy, Lennert Buytenhek, Jozsef Kadlecsik
Enforce that the second "src/dst" parameter of the set match and SET target
must be "src", because we have access to the source MAC only in the packet.
The previous behaviour, that the type required the second parameter
but actually ignored the value was counter-intuitive and confusing.
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
---
net/netfilter/ipset/ip_set_bitmap_ipmac.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/net/netfilter/ipset/ip_set_bitmap_ipmac.c b/net/netfilter/ipset/ip_set_bitmap_ipmac.c
index 35b4879..913a461 100644
--- a/net/netfilter/ipset/ip_set_bitmap_ipmac.c
+++ b/net/netfilter/ipset/ip_set_bitmap_ipmac.c
@@ -344,6 +344,10 @@ bitmap_ipmac_kadt(struct ip_set *set, const struct sk_buff *skb,
ipset_adtfn adtfn = set->variant->adt[adt];
struct ipmac data;
+ /* MAC can be src only */
+ if (!(flags & IPSET_DIM_TWO_SRC))
+ return 0;
+
data.id = ntohl(ip4addr(skb, flags & IPSET_DIM_ONE_SRC));
if (data.id < map->first_ip || data.id > map->last_ip)
return -IPSET_ERR_BITMAP_RANGE;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] netfilter: ipset: Whitespace fixes: some space before tab slipped in.
2011-04-09 20:03 ` [PATCH 1/3] netfilter: ipset: bitmap:ip,mac type requires "src" for MAC Jozsef Kadlecsik
@ 2011-04-09 20:03 ` Jozsef Kadlecsik
2011-04-09 20:03 ` [PATCH 3/3] netfilter: ipset: set match and SET target fixes Jozsef Kadlecsik
2011-04-13 11:46 ` [PATCH 2/3] netfilter: ipset: Whitespace fixes: some space before tab slipped in Patrick McHardy
2011-04-13 11:44 ` [PATCH 1/3] netfilter: ipset: bitmap:ip,mac type requires "src" for MAC Patrick McHardy
1 sibling, 2 replies; 7+ messages in thread
From: Jozsef Kadlecsik @ 2011-04-09 20:03 UTC (permalink / raw)
To: netfilter-devel; +Cc: Patrick McHardy, Lennert Buytenhek, Jozsef Kadlecsik
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
---
net/netfilter/ipset/ip_set_list_set.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/ipset/ip_set_list_set.c b/net/netfilter/ipset/ip_set_list_set.c
index a0290ff..c2c29da 100644
--- a/net/netfilter/ipset/ip_set_list_set.c
+++ b/net/netfilter/ipset/ip_set_list_set.c
@@ -310,8 +310,8 @@ list_set_uadt(struct ip_set *set, struct nlattr *tb[],
!id_eq(map, i + 1, refid)) ||
(before < 0 &&
(i == 0 || !id_eq(map, i - 1, refid)))) {
- ret = -IPSET_ERR_EXIST;
- goto finish;
+ ret = -IPSET_ERR_EXIST;
+ goto finish;
}
e->timeout = ip_set_timeout_set(timeout);
ip_set_put_byindex(id);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] netfilter: ipset: set match and SET target fixes
2011-04-09 20:03 ` [PATCH 2/3] netfilter: ipset: Whitespace fixes: some space before tab slipped in Jozsef Kadlecsik
@ 2011-04-09 20:03 ` Jozsef Kadlecsik
2011-04-13 11:47 ` Patrick McHardy
2011-04-13 11:46 ` [PATCH 2/3] netfilter: ipset: Whitespace fixes: some space before tab slipped in Patrick McHardy
1 sibling, 1 reply; 7+ messages in thread
From: Jozsef Kadlecsik @ 2011-04-09 20:03 UTC (permalink / raw)
To: netfilter-devel; +Cc: Patrick McHardy, Lennert Buytenhek, Jozsef Kadlecsik
The SET target with --del-set did not work due to using wrongly
the internal dimension of --add-set instead of --del-set.
Also, the checkentries did not release the set references when
returned an error. Bugs reported by Lennert Buytenhek.
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
---
net/netfilter/xt_set.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/xt_set.c b/net/netfilter/xt_set.c
index 061d48c..b3babae 100644
--- a/net/netfilter/xt_set.c
+++ b/net/netfilter/xt_set.c
@@ -81,6 +81,7 @@ set_match_v0_checkentry(const struct xt_mtchk_param *par)
if (info->match_set.u.flags[IPSET_DIM_MAX-1] != 0) {
pr_warning("Protocol error: set match dimension "
"is over the limit!\n");
+ ip_set_nfnl_put(info->match_set.index);
return -ERANGE;
}
@@ -135,6 +136,8 @@ set_target_v0_checkentry(const struct xt_tgchk_param *par)
if (index == IPSET_INVALID_ID) {
pr_warning("Cannot find del_set index %u as target\n",
info->del_set.index);
+ if (info->add_set.index != IPSET_INVALID_ID)
+ ip_set_nfnl_put(info->add_set.index);
return -ENOENT;
}
}
@@ -142,6 +145,10 @@ set_target_v0_checkentry(const struct xt_tgchk_param *par)
info->del_set.u.flags[IPSET_DIM_MAX-1] != 0) {
pr_warning("Protocol error: SET target dimension "
"is over the limit!\n");
+ if (info->add_set.index != IPSET_INVALID_ID)
+ ip_set_nfnl_put(info->add_set.index);
+ if (info->del_set.index != IPSET_INVALID_ID)
+ ip_set_nfnl_put(info->del_set.index);
return -ERANGE;
}
@@ -192,6 +199,7 @@ set_match_checkentry(const struct xt_mtchk_param *par)
if (info->match_set.dim > IPSET_DIM_MAX) {
pr_warning("Protocol error: set match dimension "
"is over the limit!\n");
+ ip_set_nfnl_put(info->match_set.index);
return -ERANGE;
}
@@ -219,7 +227,7 @@ set_target(struct sk_buff *skb, const struct xt_action_param *par)
if (info->del_set.index != IPSET_INVALID_ID)
ip_set_del(info->del_set.index,
skb, par->family,
- info->add_set.dim,
+ info->del_set.dim,
info->del_set.flags);
return XT_CONTINUE;
@@ -245,13 +253,19 @@ set_target_checkentry(const struct xt_tgchk_param *par)
if (index == IPSET_INVALID_ID) {
pr_warning("Cannot find del_set index %u as target\n",
info->del_set.index);
+ if (info->add_set.index != IPSET_INVALID_ID)
+ ip_set_nfnl_put(info->add_set.index);
return -ENOENT;
}
}
if (info->add_set.dim > IPSET_DIM_MAX ||
- info->del_set.flags > IPSET_DIM_MAX) {
+ info->del_set.dim > IPSET_DIM_MAX) {
pr_warning("Protocol error: SET target dimension "
"is over the limit!\n");
+ if (info->add_set.index != IPSET_INVALID_ID)
+ ip_set_nfnl_put(info->add_set.index);
+ if (info->del_set.index != IPSET_INVALID_ID)
+ ip_set_nfnl_put(info->del_set.index);
return -ERANGE;
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] netfilter: ipset: bitmap:ip,mac type requires "src" for MAC
2011-04-09 20:03 ` [PATCH 1/3] netfilter: ipset: bitmap:ip,mac type requires "src" for MAC Jozsef Kadlecsik
2011-04-09 20:03 ` [PATCH 2/3] netfilter: ipset: Whitespace fixes: some space before tab slipped in Jozsef Kadlecsik
@ 2011-04-13 11:44 ` Patrick McHardy
1 sibling, 0 replies; 7+ messages in thread
From: Patrick McHardy @ 2011-04-13 11:44 UTC (permalink / raw)
To: Jozsef Kadlecsik; +Cc: netfilter-devel, Lennert Buytenhek
Am 09.04.2011 22:03, schrieb Jozsef Kadlecsik:
> Enforce that the second "src/dst" parameter of the set match and SET target
> must be "src", because we have access to the source MAC only in the packet.
> The previous behaviour, that the type required the second parameter
> but actually ignored the value was counter-intuitive and confusing.
>
Applied, thanks Jozsef.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] netfilter: ipset: Whitespace fixes: some space before tab slipped in.
2011-04-09 20:03 ` [PATCH 2/3] netfilter: ipset: Whitespace fixes: some space before tab slipped in Jozsef Kadlecsik
2011-04-09 20:03 ` [PATCH 3/3] netfilter: ipset: set match and SET target fixes Jozsef Kadlecsik
@ 2011-04-13 11:46 ` Patrick McHardy
1 sibling, 0 replies; 7+ messages in thread
From: Patrick McHardy @ 2011-04-13 11:46 UTC (permalink / raw)
To: Jozsef Kadlecsik; +Cc: netfilter-devel, Lennert Buytenhek
Am 09.04.2011 22:03, schrieb Jozsef Kadlecsik:
> Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
> ---
> net/netfilter/ipset/ip_set_list_set.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
This one doesn't apply to my tree, I'm skipping it for now,
if you want me to apply it, please rebase to nf-2.6.git.
Thanks!
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] netfilter: ipset: set match and SET target fixes
2011-04-09 20:03 ` [PATCH 3/3] netfilter: ipset: set match and SET target fixes Jozsef Kadlecsik
@ 2011-04-13 11:47 ` Patrick McHardy
0 siblings, 0 replies; 7+ messages in thread
From: Patrick McHardy @ 2011-04-13 11:47 UTC (permalink / raw)
To: Jozsef Kadlecsik; +Cc: netfilter-devel, Lennert Buytenhek
Am 09.04.2011 22:03, schrieb Jozsef Kadlecsik:
> The SET target with --del-set did not work due to using wrongly
> the internal dimension of --add-set instead of --del-set.
> Also, the checkentries did not release the set references when
> returned an error. Bugs reported by Lennert Buytenhek.
>
Applied, thanks Jozsef.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-04-13 11:47 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-09 20:02 [PATCH 0/3] netfilter: ipset: fixes Jozsef Kadlecsik
2011-04-09 20:03 ` [PATCH 1/3] netfilter: ipset: bitmap:ip,mac type requires "src" for MAC Jozsef Kadlecsik
2011-04-09 20:03 ` [PATCH 2/3] netfilter: ipset: Whitespace fixes: some space before tab slipped in Jozsef Kadlecsik
2011-04-09 20:03 ` [PATCH 3/3] netfilter: ipset: set match and SET target fixes Jozsef Kadlecsik
2011-04-13 11:47 ` Patrick McHardy
2011-04-13 11:46 ` [PATCH 2/3] netfilter: ipset: Whitespace fixes: some space before tab slipped in Patrick McHardy
2011-04-13 11:44 ` [PATCH 1/3] netfilter: ipset: bitmap:ip,mac type requires "src" for MAC Patrick McHardy
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).