Handle reload mechanism
authorSteven Barth <steven@midlink.org>
Tue, 15 Oct 2013 21:35:25 +0000 (23:35 +0200)
committerSteven Barth <steven@midlink.org>
Tue, 15 Oct 2013 21:35:25 +0000 (23:35 +0200)
src/config.c
src/odhcpd.h
src/ubus.c

index a5bcf265107318d94afbf7b68c2afcc2ef1385b6..f6a5327179228f03f61a2ba4c39b83495ca766b9 100644 (file)
@@ -488,9 +488,16 @@ static int set_interface(struct uci_section *s)
 
 
 static volatile int do_reload = false;
+void odhcpd_reload(void)
+{
+       uloop_cancelled = true;
+       do_reload = true;
+}
+
+
 static void set_stop(int signal)
 {
-       uloop_end();
+       uloop_cancelled = true;
        do_reload = (signal == SIGHUP);
 }
 
@@ -582,6 +589,7 @@ void odhcpd_run(void)
                                setup_dhcpv6_interface(i, true);
                                setup_ndp_interface(i, true);
                                setup_dhcpv4_interface(i, true);
+                               i->inuse = false;
                        } else {
                                close_interface(i);
                        }
index 090b07bdc3807e815fece3e2ef2ed93bad570a98..5ae6a390e5ddb1d6dd0c111dd6b4b13583ea4316 100644 (file)
@@ -206,3 +206,5 @@ int setup_router_interface(struct interface *iface, bool enable);
 int setup_dhcpv6_interface(struct interface *iface, bool enable);
 int setup_ndp_interface(struct interface *iface, bool enable);
 int setup_dhcpv4_interface(struct interface *iface, bool enable);
+
+void odhcpd_reload(void);
index bf1d072d5d5bc3fae37ec1e3512ccfbd10541ecb..2876eb9e6bf54b3ff608aae1564e459d01fae630 100644 (file)
@@ -182,7 +182,7 @@ static void handle_dump(_unused struct ubus_request *req, _unused int type, stru
 
        free(dump);
        dump = blob_memdup(tb[DUMP_ATTR_INTERFACE]);
-       raise(SIGHUP);
+       odhcpd_reload();
 }