From 9d8dd091f8f336b111364ed211165b5ec9842a24 Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Thu, 4 Dec 2014 12:07:15 +0000 Subject: [PATCH] netifd: Fix restore of original device settings 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 --- 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; } -- 2.11.0