diff options
author | Hans Dedecker <dedeckeh@gmail.com> | 2016-02-01 10:56:29 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2016-02-01 11:09:58 +0100 |
commit | abbea9ebe8a8b56032e0f85b8572f0671dc094e5 (patch) | |
tree | 08e964c7f96ca12e6827c07c7a198d4300d5fc93 /system-linux.c | |
parent | fa624787a83347039ff690ec0a8e209fd1642c2e (diff) |
device: Support multicast config option
Make multicast device flag configurable by extending device attributes
with the multicast attribute
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Signed-off-by: Nick Podolak <nicholas.podolak@dtechlabs.com>
Diffstat (limited to 'system-linux.c')
-rw-r--r-- | system-linux.c | 8 |
1 files changed, 8 insertions, 0 deletions
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); } |