device: preserve orig_settings flags for querying device status
authorFelix Fietkau <nbd@openwrt.org>
Tue, 17 Nov 2015 14:05:01 +0000 (15:05 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 17 Nov 2015 14:05:01 +0000 (15:05 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
device.c
device.h
system-linux.c

index a29c981e334c3206e8fc1bd1d4d4987b3c8ee68e..67e9d9ac63624b9d657176240f61e0f5c2f40187 100644 (file)
--- a/device.c
+++ b/device.c
@@ -174,7 +174,7 @@ device_merge_settings(struct device *dev, struct device_settings *n)
                s->dadtransmits : os->dadtransmits;
        n->multicast_to_unicast = s->multicast_to_unicast;
        n->multicast_router = s->multicast_router;
-       n->flags = s->flags | os->flags;
+       n->flags = s->flags | os->flags | os->valid_flags;
 }
 
 void
index 4ff335d116fe43a9b6dbbc0e631fc6292e0a849d..a6c131aa13715eb37765c21bc1c3582cc1c29c5c 100644 (file)
--- a/device.h
+++ b/device.h
@@ -128,6 +128,7 @@ struct device_user {
 
 struct device_settings {
        unsigned int flags;
+       unsigned int valid_flags;
        unsigned int mtu;
        unsigned int mtu6;
        unsigned int txqueuelen;
index 4ccc9d251d15ccc9f34153cc59e8054200fba3b9..b190ec64b35a5d15c8209adcfdfe43e5dcd6824d 100644 (file)
@@ -1225,6 +1225,7 @@ int system_if_up(struct device *dev)
 {
        system_if_get_settings(dev, &dev->orig_settings);
        /* Only keep orig settings based on what needs to be set */
+       dev->orig_settings.valid_flags = dev->orig_settings.flags;
        dev->orig_settings.flags &= dev->settings.flags;
        system_if_apply_settings(dev, &dev->settings, dev->settings.flags);
        return system_if_flags(dev->ifname, IFF_UP, 0);