mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-11 01:06:59 +08:00
udp-port can now be unset, and that will disable listening to UDP.
This commit is contained in:
2
NEWS
2
NEWS
@@ -4,6 +4,8 @@
|
||||
compatibility. Patch by Kevin Cernekee.
|
||||
- When a new connection presents a cookie of an existing session
|
||||
the previous session is disconnected (and its IP is hijacked).
|
||||
- If udp-port is unset or set to zero then the server will not listen
|
||||
for UDP sessions.
|
||||
|
||||
|
||||
* Version 0.2.2 (released 2013-11-23)
|
||||
|
||||
@@ -452,9 +452,6 @@ static void check_cfg( struct cfg_st *config)
|
||||
if (config->dpd == 0)
|
||||
config->keepalive = 60;
|
||||
|
||||
if (config->udp_port == 0)
|
||||
config->udp_port = config->port;
|
||||
|
||||
if (config->priorities == NULL)
|
||||
config->priorities = "NORMAL:%SERVER_PRECEDENCE:%COMPAT";
|
||||
}
|
||||
|
||||
36
src/main.c
36
src/main.c
@@ -209,29 +209,31 @@ listen_ports(struct cfg_st* config, struct listen_list_st *list, const char *nod
|
||||
exit(1);
|
||||
}
|
||||
|
||||
snprintf(portname, sizeof(portname), "%d", config->udp_port);
|
||||
if (config->udp_port) {
|
||||
snprintf(portname, sizeof(portname), "%d", config->udp_port);
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_socktype = SOCK_DGRAM;
|
||||
hints.ai_flags = AI_PASSIVE
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_socktype = SOCK_DGRAM;
|
||||
hints.ai_flags = AI_PASSIVE
|
||||
#ifdef AI_ADDRCONFIG
|
||||
| AI_ADDRCONFIG
|
||||
| AI_ADDRCONFIG
|
||||
#endif
|
||||
;
|
||||
;
|
||||
|
||||
ret = getaddrinfo(node, portname, &hints, &res);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "getaddrinfo() failed: %s\n",
|
||||
gai_strerror(ret));
|
||||
return -1;
|
||||
}
|
||||
ret = getaddrinfo(node, portname, &hints, &res);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "getaddrinfo() failed: %s\n",
|
||||
gai_strerror(ret));
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = _listen_ports(config, res, list);
|
||||
if (ret < 0) {
|
||||
return -1;
|
||||
}
|
||||
ret = _listen_ports(config, res, list);
|
||||
if (ret < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
freeaddrinfo(res);
|
||||
freeaddrinfo(res);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user