From a1cc6448880b8da563aeee2c8c73d62237d241c8 Mon Sep 17 00:00:00 2001 From: Lorenzo Miniero Date: Wed, 18 Dec 2024 13:37:41 +0100 Subject: [PATCH] Make ip-utils aware of 0.0.0.0 and :: (see #3470) --- ip-utils.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ip-utils.c b/ip-utils.c index 071c15db74..a06a2a6600 100644 --- a/ip-utils.c +++ b/ip-utils.c @@ -242,6 +242,15 @@ int janus_network_lookup_interface(const struct ifaddrs *ifas, const char *iface if(ifas == NULL || iface == NULL || result == NULL) return -EINVAL; janus_network_address_nullify(result); + if(!strcmp(iface, "0.0.0.0")) { + result->family = AF_INET; + result->ipv4.s_addr = INADDR_ANY; + return 0; + } else if(!strcmp(iface, "::")) { + result->family = AF_INET6; + result->ipv6 = in6addr_any; + return 0; + } janus_network_query_config q; /* Let's see if iface is an IPv4 address, an IPv6 address, or possibly an interface name */ int res = janus_network_prepare_device_query(iface,