Do the same for VideoRoom remote publishers

This commit is contained in:
Lorenzo Miniero 2025-03-03 14:39:58 +01:00
parent 22abdc2a31
commit a231fbcefa

View File

@ -13602,7 +13602,8 @@ static int janus_videoroom_create_fd(int port, in_addr_t mcast, const janus_netw
int fd = -1, family = 0;
while(1) {
family = 0; /* By default, we bind to both IPv4 and IPv6 */
/* By default, we bind to both IPv4 and IPv6, unless IPv6 is disabled */
family = ipv6_disabled ? AF_INET : 0;
if(use_range && rtp_port_wrap && rtp_port_next >= rtp_port_start) {
/* Full range scanned */
JANUS_LOG(LOG_ERR, "No ports available for RTP/RTCP in range: %u -- %u\n",
@ -13695,6 +13696,12 @@ static int janus_videoroom_create_fd(int port, in_addr_t mcast, const janus_netw
if(host && hostlen > 0)
g_strlcpy(host, janus_network_address_string_from_buffer(&address_representation), hostlen);
} else if(iface->family == AF_INET6) {
if(ipv6_disabled) {
JANUS_LOG(LOG_ERR, "Can't bind remote publisher to IPv6 address, IPv6 is disabled\n");
close(fd);
janus_mutex_unlock(&fd_mutex);
return -1;
}
memcpy(&address6.sin6_addr, &iface->ipv6, sizeof(iface->ipv6));
(void) janus_network_address_to_string_buffer(iface, &address_representation); /* This is OK: if we get here iface must be non-NULL */
JANUS_LOG(LOG_VERB, "Remote publisher restricted to interface address: %s\n",