[OpenWrt-Devel] [PATCH 1/4] netifd: Fix restore of original device settings

Hans Dedecker dedeckeh at gmail.com
Wed Dec 3 05:15:17 EST 2014


Don't restore original device settings based on the device settings flags in system_if_down
as device flags are already reset when the device config is deleted.
Therefore move the masking of the relevant original device settings to system_if_up.

Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
---
 system-linux.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/system-linux.c b/system-linux.c
index ed69bef..4662bf8 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -1033,6 +1033,8 @@ system_if_apply_settings(struct device *dev, struct device_settings *s, unsigned
 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.flags &= dev->settings.flags;
 	system_if_apply_settings(dev, &dev->settings, dev->settings.flags);
 	return system_if_flags(dev->ifname, IFF_UP, 0);
 }
@@ -1040,7 +1042,6 @@ int system_if_up(struct device *dev)
 int system_if_down(struct device *dev)
 {
 	int ret = system_if_flags(dev->ifname, 0, IFF_UP);
-	dev->orig_settings.flags &= dev->settings.flags;
 	system_if_apply_settings(dev, &dev->orig_settings, dev->orig_settings.flags);
 	return ret;
 }
-- 
1.9.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list