Minor fixes
authorSteven Barth <steven@midlink.org>
Wed, 16 Oct 2013 08:42:16 +0000 (10:42 +0200)
committerSteven Barth <steven@midlink.org>
Wed, 16 Oct 2013 08:42:16 +0000 (10:42 +0200)
src/config.c
src/dhcpv4.c

index d33309f6dc9809dec74d74d9bd5eed076ffd7ca4..06e54072546efa0b949f7b8993b0f2d96a5a011c 100644 (file)
@@ -282,10 +282,13 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
        if (overwrite || !iface->ifname[0])
                ifname = ubus_get_ifname(name);
 #endif
-       if ((c = tb[IFACE_ATTR_IFNAME]))
-               ifname = blobmsg_get_string(c);
-       else if ((c = tb[IFACE_ATTR_NETWORKID]))
-               ifname = blobmsg_get_string(c);
+
+       if (overwrite) {
+               if ((c = tb[IFACE_ATTR_IFNAME]))
+                       ifname = blobmsg_get_string(c);
+               else if ((c = tb[IFACE_ATTR_NETWORKID]))
+                       ifname = blobmsg_get_string(c);
+       }
 
        if (!iface->ifname[0] && !ifname)
                return -1;
@@ -301,7 +304,7 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
        if ((c = tb[IFACE_ATTR_DYNAMICDHCP]))
                iface->no_dynamic_dhcp = !blobmsg_get_bool(c);
 
-       if ((c = tb[IFACE_ATTR_IGNORE]))
+       if (overwrite && (c = tb[IFACE_ATTR_IGNORE]))
                iface->ignore = blobmsg_get_bool(c);
 
        if ((c = tb[IFACE_ATTR_LEASETIME])) {
@@ -340,7 +343,7 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
        if ((c = tb[IFACE_ATTR_MASTER]))
                iface->master = blobmsg_get_bool(c);
 
-       if ((c = tb[IFACE_ATTR_UPSTREAM])) {
+       if (overwrite && (c = tb[IFACE_ATTR_UPSTREAM])) {
                struct blob_attr *cur;
                unsigned rem;
 
index b4b072041c93ec43ae763350e8a457a7da91d765..6f15a0ab586274d33b2afe6cd61b132d2addab9f 100644 (file)
@@ -49,6 +49,7 @@ int init_dhcpv4(void)
 int setup_dhcpv4_interface(struct interface *iface, bool enable)
 {
        if (iface->dhcpv4_event.uloop.fd > 0) {
+               uloop_fd_delete(&iface->dhcpv4_event.uloop);
                close(iface->dhcpv4_event.uloop.fd);
                iface->dhcpv4_event.uloop.fd = -1;
        }