version 1.1.1.2, 2012/05/29 12:55:57
|
version 1.1.1.3, 2013/07/22 00:32:35
|
Line 1
|
Line 1
|
/* $Id$ */ |
/* $Id$ */ |
/* MiniUPnP project |
/* MiniUPnP project |
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ |
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ |
* (c) 2006-2011 Thomas Bernard | * (c) 2006-2011 Thomas Bernard |
* This software is subject to the conditions detailed |
* This software is subject to the conditions detailed |
* in the LICENCE file provided within the distribution */ |
* in the LICENCE file provided within the distribution */ |
|
|
Line 13
|
Line 13
|
#include <sys/types.h> |
#include <sys/types.h> |
#include <sys/socket.h> |
#include <sys/socket.h> |
#include <net/if.h> |
#include <net/if.h> |
#include <arpa/inet.h> |
|
#include <netinet/in.h> |
#include <netinet/in.h> |
|
#include <arpa/inet.h> |
#if defined(sun) |
#if defined(sun) |
#include <sys/sockio.h> |
#include <sys/sockio.h> |
#endif |
#endif |
Line 74 getifaddr(const char * ifname, char * buf, int len)
|
Line 74 getifaddr(const char * ifname, char * buf, int len)
|
} |
} |
for(ife = ifap; ife; ife = ife->ifa_next) |
for(ife = ifap; ife; ife = ife->ifa_next) |
{ |
{ |
/* skip other interfaces */ | /* skip other interfaces if one was specified */ |
if(0 != strcmp(ifname, ife->ifa_name)) | if(ifname && (0 != strcmp(ifname, ife->ifa_name))) |
continue; |
continue; |
|
if(ife->ifa_addr == NULL) |
|
continue; |
switch(ife->ifa_addr->sa_family) |
switch(ife->ifa_addr->sa_family) |
{ |
{ |
case AF_INET: |
case AF_INET: |
Line 121 find_ipv6_addr(const char * ifname,
|
Line 123 find_ipv6_addr(const char * ifname,
|
/* skip other interfaces if one was specified */ |
/* skip other interfaces if one was specified */ |
if(ifname && (0 != strcmp(ifname, ife->ifa_name))) |
if(ifname && (0 != strcmp(ifname, ife->ifa_name))) |
continue; |
continue; |
|
if(ife->ifa_addr == NULL) |
|
continue; |
if(ife->ifa_addr->sa_family == AF_INET6) |
if(ife->ifa_addr->sa_family == AF_INET6) |
{ |
{ |
addr = (const struct sockaddr_in6 *)ife->ifa_addr; |
addr = (const struct sockaddr_in6 *)ife->ifa_addr; |
Line 136 find_ipv6_addr(const char * ifname,
|
Line 140 find_ipv6_addr(const char * ifname,
|
} |
} |
} |
} |
} |
} |
|
freeifaddrs(ifap); |
return r; |
return r; |
} |
} |
#endif |
#endif |