]> granicus.if.org Git - ipset/commitdiff
lib: fix ifname 'physdev:' prefix parsing
authorFlorian Westphal <fw@strlen.de>
Wed, 12 Feb 2014 09:27:19 +0000 (10:27 +0100)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Thu, 13 Feb 2014 11:21:50 +0000 (12:21 +0100)
hash:net,iface supports matching on the bridge port as well,
but userspace currently doesn't handle it correctly as it passes
in 'physdev:eth0' instead of 'eth0'+IPSET_OPT_PHYSDEV.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
lib/parse.c

index f1c1f0e0d9693a3f22c402f23434c3487c9abf6e..4db872e9f839701acffbba06226375fc8281b176 100644 (file)
@@ -1753,14 +1753,15 @@ ipset_parse_iface(struct ipset_session *session,
 {
        struct ipset_data *data;
        int offset = 0, err = 0;
+       static const char pdev_prefix[]="physdev:";
 
        assert(session);
        assert(opt == IPSET_OPT_IFACE);
        assert(str);
 
        data = ipset_session_data(session);
-       if (STREQ(str, "physdev:")) {
-               offset = 8;
+       if (STRNEQ(str, pdev_prefix, strlen(pdev_prefix))) {
+               offset = strlen(pdev_prefix);
                err = ipset_data_set(data, IPSET_OPT_PHYSDEV, str);
                if (err < 0)
                        return err;