mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-11 17:26:58 +08:00
Add udp-listen-host option for DTLS
This option supports different listen addresses for tcp and udp such as haproxy for tcp, but support dtls at the same time (haproxy does not support UDP at the moment)
This commit is contained in:
@@ -720,6 +720,8 @@ static int cfg_ini_handler(void *_ctx, const char *section, const char *name, co
|
||||
vhost->acct = talloc_strdup(pool, value);
|
||||
} else if (strcmp(name, "listen-host") == 0) {
|
||||
PREAD_STRING(pool, vhost->perm_config.listen_host);
|
||||
} else if (strcmp(name, "udp-listen-host") == 0) {
|
||||
PREAD_STRING(pool, vhost->perm_config.udp_listen_host);
|
||||
} else if (strcmp(name, "listen-clear-file") == 0) {
|
||||
if (!PWARN_ON_VHOST_STRDUP(vhost->name, "listen-clear-file", unix_conn_file))
|
||||
PREAD_STRING(pool, vhost->perm_config.unix_conn_file);
|
||||
@@ -785,7 +787,6 @@ static int cfg_ini_handler(void *_ctx, const char *section, const char *name, co
|
||||
} else {
|
||||
stage1_found = 0;
|
||||
}
|
||||
|
||||
if (stage1_found)
|
||||
goto exit;
|
||||
}
|
||||
@@ -1328,6 +1329,11 @@ static void check_cfg(vhost_cfg_st *vhost, vhost_cfg_st *defvhost, unsigned sile
|
||||
if (config->no_compress_limit < MIN_NO_COMPRESS_LIMIT)
|
||||
config->no_compress_limit = MIN_NO_COMPRESS_LIMIT;
|
||||
|
||||
/* use tcp listen host by default */
|
||||
if (vhost->perm_config.udp_listen_host == NULL) {
|
||||
vhost->perm_config.udp_listen_host = vhost->perm_config.listen_host;
|
||||
}
|
||||
|
||||
#if !defined(HAVE_LIBSECCOMP)
|
||||
if (config->isolate != 0 && !silent) {
|
||||
fprintf(stderr, ERRSTR"%s'isolate-workers' is set to true, but not compiled with seccomp or Linux namespaces support\n", PREFIX_VHOST(vhost));
|
||||
|
||||
@@ -419,7 +419,7 @@ listen_ports(void *pool, struct perm_cfg_st* config,
|
||||
#endif
|
||||
;
|
||||
|
||||
ret = getaddrinfo(config->listen_host, portname, &hints, &res);
|
||||
ret = getaddrinfo(config->udp_listen_host, portname, &hints, &res);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "getaddrinfo() failed: %s\n",
|
||||
gai_strerror(ret));
|
||||
|
||||
Reference in New Issue
Block a user