mirror of
https://github.com/status-im/miniupnp.git
synced 2025-01-11 06:35:39 +00:00
inet_pton() instead of inet_addr()
This commit is contained in:
parent
69fc376929
commit
7a66f373fc
miniupnpc
@ -52,11 +52,14 @@ static const struct { uint32_t address; uint32_t rmask; } reserved[] = {
|
||||
*/
|
||||
int addr_is_reserved(const char * addr_str)
|
||||
{
|
||||
unsigned long addr_n;
|
||||
uint32_t address;
|
||||
uint32_t addr_n, address;
|
||||
size_t i;
|
||||
|
||||
addr_n = inet_addr(addr_str);
|
||||
/* was : addr_n = inet_addr(addr_str); */
|
||||
if (inet_pton(AF_INET, addr_str, &addr_n) < 0) {
|
||||
/* error */
|
||||
return 0;
|
||||
}
|
||||
if (addr_n == INADDR_NONE)
|
||||
return 1;
|
||||
|
||||
|
@ -720,7 +720,10 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
||||
#if defined(_WIN32) && (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
|
||||
InetPtonA(AF_INET, multicastif, &mc_if);
|
||||
#else
|
||||
mc_if.s_addr = inet_addr(multicastif); /* ex: 192.168.x.x */
|
||||
/* was : mc_if.s_addr = inet_addr(multicastif); */ /* ex: 192.168.x.x */
|
||||
if (inet_pton(AF_INET, multicastif, &mc_if.s_addr) < 0) {
|
||||
mc_if.s_addr = INADDR_NONE;
|
||||
}
|
||||
#endif
|
||||
if(mc_if.s_addr != INADDR_NONE)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user