gluon-radv-filterd: Call cleanup when stopping daemon
Signed-off-by: Sven Eckelmann <sven@narfation.org>
This commit is contained in:
parent
2d3614c1a9
commit
2394ad0c07
@ -115,6 +115,7 @@ static struct global {
|
|||||||
uint16_t max_tq;
|
uint16_t max_tq;
|
||||||
uint16_t hysteresis_thresh;
|
uint16_t hysteresis_thresh;
|
||||||
struct router *best_router;
|
struct router *best_router;
|
||||||
|
volatile sig_atomic_t stop_daemon;
|
||||||
} G = {
|
} G = {
|
||||||
.mesh_iface = "bat0",
|
.mesh_iface = "bat0",
|
||||||
};
|
};
|
||||||
@ -726,6 +727,11 @@ static void update_ebtables(void) {
|
|||||||
error_message(0, 0, "warning: adding new rule to ebtables chain %s failed", G.chain);
|
error_message(0, 0, "warning: adding new rule to ebtables chain %s failed", G.chain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void sighandler(int sig __attribute__((unused)))
|
||||||
|
{
|
||||||
|
G.stop_daemon = 1;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
int retval;
|
int retval;
|
||||||
fd_set rfds;
|
fd_set rfds;
|
||||||
@ -746,7 +752,11 @@ int main(int argc, char *argv[]) {
|
|||||||
if (G.chain == NULL)
|
if (G.chain == NULL)
|
||||||
usage("No chain set!");
|
usage("No chain set!");
|
||||||
|
|
||||||
while (1) {
|
G.stop_daemon = 0;
|
||||||
|
signal(SIGINT, sighandler);
|
||||||
|
signal(SIGTERM, sighandler);
|
||||||
|
|
||||||
|
while (!G.stop_daemon) {
|
||||||
FD_ZERO(&rfds);
|
FD_ZERO(&rfds);
|
||||||
FD_SET(G.sock, &rfds);
|
FD_SET(G.sock, &rfds);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user