[raop] Allow configuration of raop control and timing ports

This commit is contained in:
Nigel Hannam 2020-04-08 21:16:00 +01:00
parent c4cc366e6f
commit 19d1d4f67b
3 changed files with 14 additions and 4 deletions

View File

@ -29,6 +29,10 @@ general {
# Websocket port for the web interface.
# websocket_port = 3688
# Ports for airplay raop server
# raop_control_port = 0
# raop_timing_port = 0
# Sets who is allowed to connect without authorisation. This applies to
# client types like Remotes, DAAP clients (iTunes) and to the web
# interface. Options are "any", "localhost" or the prefix to one or

View File

@ -50,6 +50,8 @@ static cfg_opt_t sec_general[] =
CFG_INT_CB("loglevel", E_LOG, CFGF_NONE, &cb_loglevel),
CFG_STR("admin_password", NULL, CFGF_NONE),
CFG_INT("websocket_port", 3688, CFGF_NONE),
CFG_INT("raop_control_port", 0, CFGF_NONE),
CFG_INT("raop_timing_port", 0, CFGF_NONE),
CFG_STR_LIST("trusted_networks", "{localhost,192.168,fd}", CFGF_NONE),
CFG_BOOL("ipv6", cfg_true, CFGF_NONE),
CFG_STR("cache_path", STATEDIR "/cache/" PACKAGE "/cache.db", CFGF_NONE),

View File

@ -3064,6 +3064,7 @@ raop_v2_timing_start_one(struct raop_service *svc, int family)
int on;
int len;
int ret;
int timing_port;
#ifdef SOCK_CLOEXEC
svc->fd = socket(family, SOCK_DGRAM | SOCK_CLOEXEC, 0);
@ -3092,17 +3093,18 @@ raop_v2_timing_start_one(struct raop_service *svc, int family)
memset(&sa, 0, sizeof(union sockaddr_all));
sa.ss.ss_family = family;
timing_port = cfg_getint(cfg_getsec(cfg, "general"), "raop_timing_port");
switch (family)
{
case AF_INET:
sa.sin.sin_addr.s_addr = INADDR_ANY;
sa.sin.sin_port = 0;
sa.sin.sin_port = htons(timing_port);
len = sizeof(sa.sin);
break;
case AF_INET6:
sa.sin6.sin6_addr = in6addr_any;
sa.sin6.sin6_port = 0;
sa.sin6.sin6_port = htons(timing_port);
len = sizeof(sa.sin6);
break;
}
@ -3316,6 +3318,7 @@ raop_v2_control_start_one(struct raop_service *svc, int family)
int on;
int len;
int ret;
int control_port;
#ifdef SOCK_CLOEXEC
svc->fd = socket(family, SOCK_DGRAM | SOCK_CLOEXEC, 0);
@ -3344,17 +3347,18 @@ raop_v2_control_start_one(struct raop_service *svc, int family)
memset(&sa, 0, sizeof(union sockaddr_all));
sa.ss.ss_family = family;
control_port = cfg_getint(cfg_getsec(cfg, "general"), "raop_control_port");
switch (family)
{
case AF_INET:
sa.sin.sin_addr.s_addr = INADDR_ANY;
sa.sin.sin_port = 0;
sa.sin.sin_port = htons(control_port);
len = sizeof(sa.sin);
break;
case AF_INET6:
sa.sin6.sin6_addr = in6addr_any;
sa.sin6.sin6_port = 0;
sa.sin6.sin6_port = htons(control_port);
len = sizeof(sa.sin6);
break;
}