diff --git a/ChangeLog b/ChangeLog index 74c77816..d6c9d145 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ fwknop-2.6.8 (11//2015): - [server] open/close functionality... + - [server] Bug fix to not send the TCP server a TERM signal even when it is + not running when fwknopd receives a HUP signal. fwknop-2.6.7 (08/24/2015): - [server] When command execution is enabled with ENABLE_CMD_EXEC for an diff --git a/server/fwknopd.c b/server/fwknopd.c index d2963130..e2db810c 100644 --- a/server/fwknopd.c +++ b/server/fwknopd.c @@ -556,7 +556,8 @@ static int handle_signals(fko_srv_options_t *opts) { log_msg(LOG_WARNING, "Got SIGHUP. Re-reading configs."); free_configs(opts); - kill(opts->tcp_server_pid, SIGTERM); + if(opts->tcp_server_pid > 0) + kill(opts->tcp_server_pid, SIGTERM); usleep(1000000); got_sighup = 0; rv = 0; /* this means fwknopd will not exit */ diff --git a/test/test-fwknop.pl b/test/test-fwknop.pl index c11f8fd7..9b6e7114 100755 --- a/test/test-fwknop.pl +++ b/test/test-fwknop.pl @@ -320,6 +320,7 @@ my $NO_SERVER_RECEIVE_CHECK = 2; my $APPEND_RESULTS = 1; my $NO_APPEND_RESULTS = 2; my %sigs = ( + 'SIGHUP' => 1, 'SIGINT' => 2, 'SIGUSR1' => 10, 'SIGUSR2' => 12, @@ -2190,8 +2191,8 @@ sub server_start_stop_cycle() { ### send additional signals for code coverage if (-e $default_pid_file) { sleep 1; - for my $sig ($sigs{'SIGINT'}, $sigs{'SIGUSR1'}, - $sigs{'SIGUSR2'}) { + for my $sig ($sigs{'SIGHUP'}, $sigs{'SIGINT'}, + $sigs{'SIGUSR1'}, $sigs{'SIGUSR2'}) { &run_cmd("$lib_view_str $valgrind_str $fwknopdCmd $default_server_conf_args -R", $cmd_out_tmp, $curr_test_file); sleep 1; @@ -2210,7 +2211,8 @@ sub server_start_stop_cycle() { $cmd_out_tmp, $curr_test_file); ### now send the signals against a non-daemon fwknopd process - for my $sig ($sigs{'SIGINT'}, $sigs{'SIGUSR1'}, $sigs{'SIGUSR2'}) { + for my $sig ($sigs{'SIGHUP'}, $sigs{'SIGINT'}, + $sigs{'SIGUSR1'}, $sigs{'SIGUSR2'}) { &do_fwknopd_cmd("$lib_view_str $valgrind_str " . "$fwknopdCmd $default_server_conf_args -f");