Specify the family at run-time for TCP/UDP servers
This is still using IPv4 by default for the moment.
This commit is contained in:
parent
d6ce22b989
commit
32cdd1183e
@ -259,7 +259,7 @@ main(int argc, char **argv)
|
||||
if(opts.enable_udp_server ||
|
||||
strncasecmp(opts.config[CONF_ENABLE_UDP_SERVER], "Y", 1) == 0)
|
||||
{
|
||||
if(run_udp_server(&opts) < 0)
|
||||
if(run_udp_server(&opts, AF_INET) < 0)
|
||||
{
|
||||
log_msg(LOG_ERR, "Fatal run_udp_server() error");
|
||||
clean_exit(&opts, FW_CLEANUP, EXIT_FAILURE);
|
||||
@ -280,7 +280,7 @@ main(int argc, char **argv)
|
||||
*/
|
||||
if(strncasecmp(opts.config[CONF_ENABLE_TCP_SERVER], "Y", 1) == 0)
|
||||
{
|
||||
if(run_tcp_server(&opts) < 0)
|
||||
if(run_tcp_server(&opts, AF_INET) < 0)
|
||||
{
|
||||
log_msg(LOG_ERR, "Fatal run_tcp_server() error");
|
||||
clean_exit(&opts, FW_CLEANUP, EXIT_FAILURE);
|
||||
|
||||
@ -211,7 +211,7 @@ pcap_capture(fko_srv_options_t *opts)
|
||||
|
||||
/* Attempt to restart tcp server ? */
|
||||
usleep(1000000);
|
||||
run_tcp_server(opts);
|
||||
run_tcp_server(opts, AF_INET);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -51,9 +51,8 @@
|
||||
* the child process or -1 if there is a fork error.
|
||||
*/
|
||||
int
|
||||
run_tcp_server(fko_srv_options_t *opts)
|
||||
run_tcp_server(fko_srv_options_t *opts, int family)
|
||||
{
|
||||
const int family = AF_INET;
|
||||
#if !CODE_COVERAGE
|
||||
pid_t pid, ppid;
|
||||
#endif
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
/* Function prototypes
|
||||
*/
|
||||
int run_tcp_server(fko_srv_options_t *opts);
|
||||
int run_tcp_server(fko_srv_options_t *opts, int family);
|
||||
|
||||
#endif /* TCP_SERVER_H */
|
||||
|
||||
|
||||
@ -50,9 +50,8 @@
|
||||
#include <sys/select.h>
|
||||
|
||||
int
|
||||
run_udp_server(fko_srv_options_t *opts)
|
||||
run_udp_server(fko_srv_options_t *opts, int family)
|
||||
{
|
||||
const int family = AF_INET;
|
||||
int s_sock, sfd_flags, selval, pkt_len;
|
||||
int rv=1, chk_rm_all=0;
|
||||
fd_set sfd_set;
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
/* Function prototypes
|
||||
*/
|
||||
int run_udp_server(fko_srv_options_t *opts);
|
||||
int run_udp_server(fko_srv_options_t *opts, int family);
|
||||
|
||||
#endif /* UDP_SERVER_H */
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user