config: restore interface defaults when cleaning interface
authorHans Dedecker <dedeckeh@gmail.com>
Wed, 8 Feb 2017 15:36:02 +0000 (16:36 +0100)
committerHans Dedecker <dedeckeh@gmail.com>
Thu, 9 Feb 2017 08:39:58 +0000 (09:39 +0100)
Interface defaults are whiped when clean interface is executed
resulting into loss of default behavior for the ndproxy_routing
and ra_management uci parameters

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
src/config.c

index ba513757202acac8830842a60b86a55d8b791f2f..5174f2c7dde12c38c00938c7f7a7568a42dbb9b5 100644 (file)
@@ -180,6 +180,12 @@ static struct interface* get_interface(const char *name)
        return NULL;
 }
 
+static void set_interface_defaults(struct interface *iface)
+{
+       iface->managed = 1;
+       iface->learn_routes = 1;
+}
+
 static void clean_interface(struct interface *iface)
 {
        free(iface->dns);
@@ -190,6 +196,7 @@ static void clean_interface(struct interface *iface)
        free(iface->dhcpv6_raw);
        free(iface->filter_class);
        memset(&iface->ra, 0, sizeof(*iface) - offsetof(struct interface, ra));
+       set_interface_defaults(iface);
 }
 
 static void close_interface(struct interface *iface)
@@ -357,9 +364,7 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
 
                strncpy(iface->name, name, sizeof(iface->name) - 1);
 
-               /* Default settings */
-               iface->managed = 1;
-               iface->learn_routes = true;
+               set_interface_defaults(iface);
 
                list_add(&iface->head, &interfaces);
                overwrite = true;