From abbea9ebe8a8b56032e0f85b8572f0671dc094e5 Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Mon, 1 Feb 2016 10:56:29 +0100 Subject: device: Support multicast config option Make multicast device flag configurable by extending device attributes with the multicast attribute Signed-off-by: Hans Dedecker Signed-off-by: Nick Podolak --- system-linux.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'system-linux.c') diff --git a/system-linux.c b/system-linux.c index 9978ade..86e373c 100644 --- a/system-linux.c +++ b/system-linux.c @@ -1089,6 +1089,9 @@ system_if_get_settings(struct device *dev, struct device_settings *s) if (ioctl(sock_ioctl, SIOCGIFFLAGS, &ifr) == 0) { s->promisc = ifr.ifr_flags & IFF_PROMISC; s->flags |= DEV_OPT_PROMISC; + + s->multicast = ifr.ifr_flags & IFF_MULTICAST; + s->flags |= DEV_OPT_MULTICAST; } if (!system_get_rpfilter(dev, buf, sizeof(buf))) { @@ -1219,6 +1222,11 @@ system_if_apply_settings(struct device *dev, struct device_settings *s, unsigned snprintf(buf, sizeof(buf), "%d", s->dadtransmits); system_set_dadtransmits(dev, buf); } + if (s->flags & DEV_OPT_MULTICAST & apply_mask) { + if (system_if_flags(dev->ifname, s->multicast ? IFF_MULTICAST : 0, + !s->multicast ? IFF_MULTICAST : 0) < 0) + s->flags &= ~DEV_OPT_MULTICAST; + } system_if_apply_rps_xps(dev, s); } -- cgit v1.2.3