From: Hans Dedecker Date: Fri, 10 Oct 2014 13:35:08 +0000 (+0000) Subject: netifd: Fix lost interface device config for devices having default config X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4210b3247c8afd9981a4534bb3cba9e30959b611;p=oweals%2Fnetifd.git netifd: Fix lost interface device config for devices having default config 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 --- 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);