]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
fix ipv6 acast / mcast restriction
authorDaniel Lezcano <dlezcano@fr.ibm.com>
Mon, 7 Jun 2010 11:25:30 +0000 (13:25 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Mon, 7 Jun 2010 11:25:30 +0000 (13:25 +0200)
Pointer comparison is buggy as they are never null.
For an ipv6 address configuration, we always zeroed the structure,
hence the bcast and acast structure are equal to in6addr_any.

Any change of this value means the user specified something different
in the configuration file, so we fail gracefully.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/network.c

index 82b7f536ab72e5f12aa69292fe2b1d6625015184..6cd5b87d35f00920dc84cb4078d410c6e448866f 100644 (file)
@@ -747,7 +747,9 @@ static int ip_addr_add(int family, int ifindex,
 
        /* TODO : multicast, anycast with ipv6 */
        err = EPROTONOSUPPORT;
-       if ((bcast || acast) && family == AF_INET6)
+       if (family == AF_INET6 &&
+           (memcmp(bcast, &in6addr_any, sizeof(in6addr_any)) ||
+            memcmp(acast, &in6addr_any, sizeof(in6addr_any))))
                goto out;
 
        err = netlink_transaction(&nlh, nlmsg, answer);