Add a command-line option to enable IPv6 (TCP/UDP)
This is currently "--ipv6", or "-6" for short.
This commit is contained in:
parent
1fd5fe197d
commit
6405398858
@ -181,9 +181,9 @@ enum {
|
||||
/* Our getopt_long options string.
|
||||
*/
|
||||
#if USE_LIBNETFILTER_QUEUE
|
||||
#define GETOPTS_OPTION_STRING "Aa:c:C:d:Dfhi:Kl:nO:p:P:Rr:StUvV"
|
||||
#define GETOPTS_OPTION_STRING "Aa:c:C:d:Dfhi:6Kl:nO:p:P:Rr:StUvV"
|
||||
#else
|
||||
#define GETOPTS_OPTION_STRING "Aa:c:C:d:Dfhi:Kl:O:p:P:Rr:StUvV"
|
||||
#define GETOPTS_OPTION_STRING "Aa:c:C:d:Dfhi:6Kl:O:p:P:Rr:StUvV"
|
||||
#endif
|
||||
|
||||
/* Our program command-line options...
|
||||
@ -206,6 +206,7 @@ static struct option cmd_opts[] =
|
||||
{"fault-injection-tag", 1, NULL, FAULT_INJECTION_TAG},
|
||||
{"help", 0, NULL, 'h'},
|
||||
{"interface", 1, NULL, 'i'},
|
||||
{"ipv6", 0, NULL, '6'},
|
||||
{"key-gen", 0, NULL, 'k'},
|
||||
{"key-gen-file", 1, NULL, KEY_GEN_FILE },
|
||||
{"key-len", 1, NULL, KEY_LEN },
|
||||
|
||||
@ -1372,6 +1372,9 @@ config_init(fko_srv_options_t *opts, int argc, char **argv)
|
||||
case 'i':
|
||||
set_config_entry(opts, CONF_PCAP_INTF, optarg);
|
||||
break;
|
||||
case '6':
|
||||
opts->ipv6 = 1;
|
||||
break;
|
||||
case FIREWD_DISABLE_CHECK_SUPPORT:
|
||||
opts->firewd_disable_check_support = 1;
|
||||
break;
|
||||
@ -1498,6 +1501,7 @@ usage(void)
|
||||
" a background daemon).\n"
|
||||
" -i, --interface - Specify interface to listen for incoming SPA\n"
|
||||
" packets.\n"
|
||||
" -6, --ipv6 - Start the server in IPv6 mode (TCP/UDP).\n"
|
||||
" -C, --packet-limit - Limit the number of candidate SPA packets to\n"
|
||||
" process and exit when this limit is reached.\n"
|
||||
" -d, --digest-file - Specify an alternate digest.cache file.\n"
|
||||
|
||||
@ -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, AF_INET) < 0)
|
||||
if(run_udp_server(&opts, opts.ipv6 ? AF_INET6 : 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, AF_INET) < 0)
|
||||
if(run_tcp_server(&opts, opts.ipv6 ? AF_INET6 : AF_INET) < 0)
|
||||
{
|
||||
log_msg(LOG_ERR, "Fatal run_tcp_server() error");
|
||||
clean_exit(&opts, FW_CLEANUP, EXIT_FAILURE);
|
||||
|
||||
@ -688,6 +688,7 @@ typedef struct fko_srv_options
|
||||
unsigned char enable_nfq_capture; /* Enable Netfilter Queue capture mode */
|
||||
unsigned char enable_fw; /* Command modes by themselves don't
|
||||
need firewall support. */
|
||||
unsigned char ipv6; /* Enable IPv6 mode (TCP/UDP) */
|
||||
|
||||
unsigned char firewd_disable_check_support; /* Don't use firewall-cmd ... -C */
|
||||
unsigned char ipt_disable_check_support; /* Don't use iptables -C */
|
||||
|
||||
@ -211,7 +211,7 @@ pcap_capture(fko_srv_options_t *opts)
|
||||
|
||||
/* Attempt to restart tcp server ? */
|
||||
usleep(1000000);
|
||||
run_tcp_server(opts, AF_INET);
|
||||
run_tcp_server(opts, opts->ipv6 ? AF_INET6 : AF_INET);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user