netfilter: ipset: take into account cidr value for the from address when creating...
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Thu, 16 Jun 2011 16:54:43 +0000 (18:54 +0200)
committerPatrick McHardy <kaber@trash.net>
Thu, 16 Jun 2011 16:54:43 +0000 (18:54 +0200)
When creating a set from a range expressed as a network like
10.1.1.172/29, the from address was taken as the IP address part and
not masked with the netmask from the cidr.

Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Patrick McHardy <kaber@trash.net>
net/netfilter/ipset/ip_set_bitmap_ip.c

index 3b5920b..4932311 100644 (file)
@@ -478,6 +478,7 @@ bitmap_ip_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
 
                if (cidr >= 32)
                        return -IPSET_ERR_INVALID_CIDR;
+               first_ip &= ip_set_hostmask(cidr);
                last_ip = first_ip | ~ip_set_hostmask(cidr);
        } else
                return -IPSET_ERR_PROTOCOL;