Skip to content

Commit

Permalink
Make ip-utils aware of 0.0.0.0 and :: (see #3470)
Browse files Browse the repository at this point in the history
  • Loading branch information
lminiero committed Dec 18, 2024
1 parent c8e8b76 commit a1cc644
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ip-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit a1cc644

Please sign in to comment.