diff options
author | Martin Hundebøll <martin@hundeboll.net> | 2014-09-15 11:57:50 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2014-09-17 13:38:06 +0200 |
commit | b965453c9df60f1c2681c3bfb7e8cff671c4b223 (patch) | |
tree | 2455ba1fa2ebdb8ccf408a47356abc859ace94ba /system-linux.c | |
parent | 46c569989f984226916fec28dd8ef152a664043e (diff) |
netifd-device: add support for promisc setting
Signed-off-by: Martin Hundebøll <martin@hundeboll.net>
Diffstat (limited to 'system-linux.c')
-rw-r--r-- | system-linux.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/system-linux.c b/system-linux.c index 2a281cc..c4d89be 100644 --- a/system-linux.c +++ b/system-linux.c @@ -943,6 +943,11 @@ system_if_get_settings(struct device *dev, struct device_settings *s) s->ipv6 = !strtoul(buf, NULL, 0); s->flags |= DEV_OPT_IPV6; } + + if (ioctl(sock_ioctl, SIOCGIFFLAGS, &ifr) == 0) { + s->promisc = ifr.ifr_flags & IFF_PROMISC; + s->flags |= DEV_OPT_PROMISC; + } } void @@ -973,6 +978,11 @@ system_if_apply_settings(struct device *dev, struct device_settings *s, unsigned } if (s->flags & DEV_OPT_IPV6 & apply_mask) system_set_disable_ipv6(dev, s->ipv6 ? "0" : "1"); + if (s->flags & DEV_OPT_PROMISC & apply_mask) { + if (system_if_flags(dev->ifname, s->promisc ? IFF_PROMISC : 0, + !s->promisc ? IFF_PROMISC : 0) < 0) + s->flags &= ~DEV_OPT_PROMISC; + } } int system_if_up(struct device *dev) |