miniupnpd/getifaddr.c: Uses ifr_addr if ifr_netmask is not defined in struct ifreq

This commit is contained in:
Thomas Bernard 2013-04-27 17:51:53 +02:00
parent 1a2984c1d8
commit 333c28a502
2 changed files with 9 additions and 2 deletions

View File

@ -1,4 +1,7 @@
$Id: Changelog.txt,v 1.335 2013/04/26 15:17:09 nanard Exp $
$Id: Changelog.txt,v 1.336 2013/04/27 15:40:09 nanard Exp $
2013/04/27:
Uses ifr_addr if ifr_netmask is not defined in struct ifreq
2013/04/26:
Correctly handle truncated snprintf() in SSDP code

View File

@ -1,4 +1,4 @@
/* $Id: getifaddr.c,v 1.16 2013/03/23 10:46:54 nanard Exp $ */
/* $Id: getifaddr.c,v 1.17 2013/04/27 15:40:09 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2013 Thomas Bernard
@ -70,7 +70,11 @@ getifaddr(const char * ifname, char * buf, int len,
close(s);
return -1;
}
#ifdef ifr_netmask
*mask = ((struct sockaddr_in *)&ifr.ifr_netmask)->sin_addr;
#else
*mask = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr;
#endif
}
close(s);
#else /* ifndef USE_GETIFADDRS */