[Server] Moves signal handling code to earlier in fwknopd initialization
Also serves to de-duplicate code slightly
This commit is contained in:
parent
4122199139
commit
db1cdd2fea
@ -128,6 +128,12 @@ main(int argc, char **argv)
|
|||||||
if(!opts.afl_fuzzing
|
if(!opts.afl_fuzzing
|
||||||
&& ! check_dir_path((const char *)opts.config[CONF_FWKNOP_RUN_DIR], "Run", 0))
|
&& ! check_dir_path((const char *)opts.config[CONF_FWKNOP_RUN_DIR], "Run", 0))
|
||||||
clean_exit(&opts, NO_FW_CLEANUP, EXIT_FAILURE);
|
clean_exit(&opts, NO_FW_CLEANUP, EXIT_FAILURE);
|
||||||
|
/* Initialize our signal handlers. You can check the return value for
|
||||||
|
* the number of signals that were *not* set. Those that were not set
|
||||||
|
* will be listed in the log/stderr output.
|
||||||
|
*/
|
||||||
|
if(set_sig_handlers() > 0)
|
||||||
|
log_msg(LOG_ERR, "Errors encountered when setting signal handlers.");
|
||||||
|
|
||||||
/* Initialize the firewall rules handler based on the fwknopd.conf
|
/* Initialize the firewall rules handler based on the fwknopd.conf
|
||||||
* file, but (for iptables firewalls) don't flush any rules or create
|
* file, but (for iptables firewalls) don't flush any rules or create
|
||||||
|
|||||||
@ -165,13 +165,6 @@ nfq_capture(fko_srv_options_t *opts)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize our signal handlers. You can check the return value for
|
|
||||||
* the number of signals that were *not* set. Those that were not set
|
|
||||||
* will be listed in the log/stderr output.
|
|
||||||
*/
|
|
||||||
if(set_sig_handlers() > 0)
|
|
||||||
log_msg(LOG_ERR, "Errors encountered when setting signal handlers.");
|
|
||||||
|
|
||||||
log_msg(LOG_INFO, "Starting fwknopd main event loop.");
|
log_msg(LOG_INFO, "Starting fwknopd main event loop.");
|
||||||
|
|
||||||
/* Jump into our home-grown packet cature loop.
|
/* Jump into our home-grown packet cature loop.
|
||||||
|
|||||||
@ -183,13 +183,6 @@ pcap_capture(fko_srv_options_t *opts)
|
|||||||
clean_exit(opts, FW_CLEANUP, EXIT_FAILURE);
|
clean_exit(opts, FW_CLEANUP, EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize our signal handlers. You can check the return value for
|
|
||||||
* the number of signals that were *not* set. Those that were not set
|
|
||||||
* will be listed in the log/stderr output.
|
|
||||||
*/
|
|
||||||
if(set_sig_handlers() > 0)
|
|
||||||
log_msg(LOG_ERR, "Errors encountered when setting signal handlers.");
|
|
||||||
|
|
||||||
log_msg(LOG_INFO, "Starting fwknopd main event loop.");
|
log_msg(LOG_INFO, "Starting fwknopd main event loop.");
|
||||||
|
|
||||||
/* Jump into our home-grown packet cature loop.
|
/* Jump into our home-grown packet cature loop.
|
||||||
|
|||||||
@ -109,13 +109,6 @@ run_udp_server(fko_srv_options_t *opts)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize our signal handlers. You can check the return value for
|
|
||||||
* the number of signals that were *not* set. Those that were not set
|
|
||||||
* will be listed in the log/stderr output.
|
|
||||||
*/
|
|
||||||
if(set_sig_handlers() > 0)
|
|
||||||
log_msg(LOG_ERR, "Errors encountered when setting signal handlers.");
|
|
||||||
|
|
||||||
FD_ZERO(&sfd_set);
|
FD_ZERO(&sfd_set);
|
||||||
|
|
||||||
/* Now loop and receive SPA packets
|
/* Now loop and receive SPA packets
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user