netifd : Reinsert ip parameters (addresses/routes) based on old interface config...
authorHans Dedecker <dedeckeh@gmail.com>
Thu, 23 Oct 2014 09:12:53 +0000 (11:12 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 24 Oct 2014 17:53:26 +0000 (19:53 +0200)
Reinserts the config IP parameters as the config_ip
parameter of the new interface is set to false in
interface_alloc and thus not loading the config ip
options of the old interface

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
interface.c

index 45432506eedc89dbfe8ba17e6f7e76675c95592a..733b5f10fd0fb0fdc005ef662c2d801e174c6dfe 100644 (file)
@@ -1045,10 +1045,13 @@ interface_change_config(struct interface *if_old, struct interface *if_new)
        }
 
        if (reload_ip) {
+               bool config_ip_enabled = if_old->config_ip.enabled;
+               bool proto_ip_enabled = if_old->proto_ip.enabled;
+
                interface_ip_set_enabled(&if_old->config_ip, false);
                interface_ip_set_enabled(&if_old->proto_ip, false);
-               interface_ip_set_enabled(&if_old->proto_ip, if_new->proto_ip.enabled);
-               interface_ip_set_enabled(&if_old->config_ip, if_new->config_ip.enabled);
+               interface_ip_set_enabled(&if_old->proto_ip, proto_ip_enabled);
+               interface_ip_set_enabled(&if_old->config_ip, config_ip_enabled);
        }
 
        interface_write_resolv_conf();