Skip to content

Commit 5daa522

Browse files
committed
Specify the family at run-time for TCP/UDP servers
This is still using IPv4 by default for the moment.
1 parent 3b8ff51 commit 5daa522

File tree

6 files changed

+7
-9
lines changed

6 files changed

+7
-9
lines changed

server/fwknopd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ main(int argc, char **argv)
259259
if(opts.enable_udp_server ||
260260
strncasecmp(opts.config[CONF_ENABLE_UDP_SERVER], "Y", 1) == 0)
261261
{
262-
if(run_udp_server(&opts) < 0)
262+
if(run_udp_server(&opts, AF_INET) < 0)
263263
{
264264
log_msg(LOG_ERR, "Fatal run_udp_server() error");
265265
clean_exit(&opts, FW_CLEANUP, EXIT_FAILURE);
@@ -280,7 +280,7 @@ main(int argc, char **argv)
280280
*/
281281
if(strncasecmp(opts.config[CONF_ENABLE_TCP_SERVER], "Y", 1) == 0)
282282
{
283-
if(run_tcp_server(&opts) < 0)
283+
if(run_tcp_server(&opts, AF_INET) < 0)
284284
{
285285
log_msg(LOG_ERR, "Fatal run_tcp_server() error");
286286
clean_exit(&opts, FW_CLEANUP, EXIT_FAILURE);

server/pcap_capture.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ pcap_capture(fko_srv_options_t *opts)
211211

212212
/* Attempt to restart tcp server ? */
213213
usleep(1000000);
214-
run_tcp_server(opts);
214+
run_tcp_server(opts, AF_INET);
215215
}
216216
}
217217

server/tcp_server.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@
5151
* the child process or -1 if there is a fork error.
5252
*/
5353
int
54-
run_tcp_server(fko_srv_options_t *opts)
54+
run_tcp_server(fko_srv_options_t *opts, int family)
5555
{
56-
const int family = AF_INET;
5756
#if !CODE_COVERAGE
5857
pid_t pid, ppid;
5958
#endif

server/tcp_server.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
/* Function prototypes
3434
*/
35-
int run_tcp_server(fko_srv_options_t *opts);
35+
int run_tcp_server(fko_srv_options_t *opts, int family);
3636

3737
#endif /* TCP_SERVER_H */
3838

server/udp_server.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,8 @@
5050
#include <sys/select.h>
5151

5252
int
53-
run_udp_server(fko_srv_options_t *opts)
53+
run_udp_server(fko_srv_options_t *opts, int family)
5454
{
55-
const int family = AF_INET;
5655
int s_sock, sfd_flags, selval, pkt_len;
5756
int rv=1, chk_rm_all=0;
5857
fd_set sfd_set;

server/udp_server.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
/* Function prototypes
3434
*/
35-
int run_udp_server(fko_srv_options_t *opts);
35+
int run_udp_server(fko_srv_options_t *opts, int family);
3636

3737
#endif /* UDP_SERVER_H */
3838

0 commit comments

Comments
 (0)