From b61c3f98223a264de219be37720b3bee5f19cf81 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Tue, 15 Oct 2013 23:35:25 +0200 Subject: [PATCH] Handle reload mechanism --- src/config.c | 10 +++++++++- src/odhcpd.h | 2 ++ src/ubus.c | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/config.c b/src/config.c index a5bcf26..f6a5327 100644 --- a/src/config.c +++ b/src/config.c @@ -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); } diff --git a/src/odhcpd.h b/src/odhcpd.h index 090b07b..5ae6a39 100644 --- a/src/odhcpd.h +++ b/src/odhcpd.h @@ -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); diff --git a/src/ubus.c b/src/ubus.c index bf1d072..2876eb9 100644 --- a/src/ubus.c +++ b/src/ubus.c @@ -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(); } -- 2.25.1