diff --git a/miniupnpd/getifaddr.c b/miniupnpd/getifaddr.c index f7268ab..b6eaee1 100644 --- a/miniupnpd/getifaddr.c +++ b/miniupnpd/getifaddr.c @@ -2,7 +2,7 @@ /* vim: tabstop=4 shiftwidth=4 noexpandtab * MiniUPnP project * http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/ - * (c) 2006-2022 Thomas Bernard + * (c) 2006-2023 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -148,6 +148,12 @@ getifaddr(const char * ifname, char * buf, int len, if(addr) *addr = ((struct sockaddr_in *)candidate->ifa_addr)->sin_addr; if(mask) *mask = ((struct sockaddr_in *)candidate->ifa_netmask)->sin_addr; } + else + { + syslog(LOG_WARNING, "no AF_INET address found for %s", ifname); + freeifaddrs(ifap); + return -1; + } freeifaddrs(ifap); #endif return 0;