]> granicus.if.org Git - ipset/commitdiff
bitmap:ip,mac type requires "src" for MAC
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Fri, 8 Apr 2011 14:04:22 +0000 (16:04 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Fri, 8 Apr 2011 14:04:22 +0000 (16:04 +0200)
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.

Manpage is updated to reflect the change.

kernel/net/netfilter/ipset/ip_set_bitmap_ipmac.c
src/ipset.8

index 35b487987c4efc4c155098c91001095a08b0186e..913a461382e410973d3a25de771edb00fa933b2c 100644 (file)
@@ -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;
index 9603ddc0d27e9f8d54040fd7624c0adabfcdbc51..d9e5ff8e902f8e4e2b722456101a2f71e2456e17 100644 (file)
@@ -302,9 +302,10 @@ matched by the kernel, it will automatically fill out the missing MAC address wi
 source MAC address from the packet. If the entry was specified with a timeout value,
 the timer starts off when the IP and MAC address pair is complete.
 .PP 
-Please note, the \fBset\fR match and \fBSET\fR target netfilter kernel modules
-\fBalways\fR use the source MAC address from the packet to match, add or delete
-entries from a \fBbitmap:ip,mac\fR type of set.
+The \fBbitmap:ip,mac\fR type of sets require two \fBsrc/dst\fR parameters of
+the \fBset\fR match and \fBSET\fR target netfilter kernel modules and the second
+one must be \fBsrc\fR to match, add or delete entries because the \fBset\fR match
+and \fBSET\fR target have access to the source MAC address only.
 .PP 
 Examples:
 .IP