Commit 79881dc6 by Daniel Lezcano

fix ipv6 acast / mcast restriction

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: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent dd04402d
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment