[OpenWrt-Devel] [PATCH 2/2] netifd: Fix lost interface device config for devices having default config

Hans Dedecker dedeckeh at gmail.com
Fri Oct 10 10:35:08 EDT 2014


As the PPP main device (either a simple or old style vlan device) is freed when PPP interfaces are reloaded; interface device specific config (eg mtu/macaddr/...) is lost as the interface config is not re-applied on the newly created device.
Patch fixes the issue by re-applying the interface device config after the main device is claimed and is having default config.

Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
---
 interface.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/interface.c b/interface.c
index 35f20b0..4543250 100644
--- a/interface.c
+++ b/interface.c
@@ -501,6 +501,8 @@ interface_claim_device(struct interface *iface)
 	} else if (iface->ifname &&
 		!(iface->proto_handler->flags & PROTO_FLAG_NODEV)) {
 		dev = device_get(iface->ifname, true);
+		if (dev && dev->default_config && iface->device_config)
+			device_set_config(dev, dev->type, iface->config);
 	} else {
 		dev = iface->ext_dev.dev;
 	}
@@ -881,8 +883,8 @@ interface_handle_link(struct interface *iface, const char *name, bool add, bool
 
 	if (add) {
 		device_set_present(dev, true);
-		if (iface->device_config)
-			device_set_config(dev, &simple_device_type, iface->config);
+		if (iface->device_config && dev->default_config)
+			device_set_config(dev, dev->type, iface->config);
 
 		system_if_apply_settings(dev, &dev->settings, dev->settings.flags);
 		ret = interface_add_link(iface, dev, link_ext);
-- 
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