Skip to content

Commit

Permalink
netfilter: ipset: bitmap:ip,mac type requires "src" for MAC
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Patrick McHardy <[email protected]>
  • Loading branch information
Jozsef Kadlecsik authored and kaber committed Apr 13, 2011
1 parent b32e3dc commit 0e8a835
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions net/netfilter/ipset/ip_set_bitmap_ipmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,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;
Expand Down

0 comments on commit 0e8a835

Please sign in to comment.