don't overwrite interface config from netifd
[project/odhcpd.git] / src / config.c
index e455965..baa8579 100644 (file)
@@ -270,7 +270,7 @@ int config_parse_interface(struct blob_attr *b, const char *name, bool overwrite
                iface = calloc(1, sizeof(*iface));
                strncpy(iface->name, name, sizeof(iface->name) - 1);
                list_add(&iface->head, &interfaces);
-       } else {
+       } else if (overwrite) {
                clean_interface(iface);
        }
 
@@ -499,6 +499,10 @@ void odhcpd_run(void)
        signal(SIGHUP, set_stop);
        signal(SIGINT, set_stop);
 
+#ifdef WITH_UBUS
+       init_ubus();
+#endif
+
        do {
                do_reload = uloop_cancelled = false;
 
@@ -532,7 +536,7 @@ void odhcpd_run(void)
 #endif
 
                // Evaluate hybrid mode for master
-               struct interface *master = NULL, *i;
+               struct interface *master = NULL, *i, *n;
                list_for_each_entry(i, &interfaces, head) {
                        if (!i->master)
                                continue;
@@ -557,8 +561,8 @@ void odhcpd_run(void)
                }
 
 
-               list_for_each_entry(i, &interfaces, head) {
-                       if (i->inuse && !i->ignore) {
+               list_for_each_entry_safe(i, n, &interfaces, head) {
+                       if (i->inuse) {
                                // Resolve hybrid mode
                                if (i->dhcpv6 == RELAYD_HYBRID)
                                        i->dhcpv6 = (master && master->dhcpv6 == RELAYD_RELAY) ?