Commit 56ff3b53 authored by Pekka Pessi's avatar Pekka Pessi

su_localinfo(): do not include interfaces that are down in the list.

darcs-hash:20060817173902-65a35-b78d5c30d1c2c0fa9e181125d7cbb1bdaab7a92c.gz
parent f5fd09f0
......@@ -67,6 +67,8 @@ enum {
LI_NAMEREQD = 6,
/** Instead of domain name, use numeric form */
LI_NUMERIC = 8,
/** Interfaces are down. New in 1.12.2. */
LI_DOWN = 16,
/** Get interface name */
LI_IFNAME = 256
};
......
......@@ -585,9 +585,10 @@ int localinfo4(su_localinfo_t const *hints, su_localinfo_t **rresult)
error = ELI_SYSTEM;
goto err;
}
/* Do not include interfaces that are down */
if ((ifreq->ifr_flags & IFF_UP) == 0) {
SU_DEBUG_9(("su_localinfo: if %s with index %d is down\n", if_name, if_index));
/* Do not include interfaces that are down unless explicitly asked */
if ((ifreq->ifr_flags & IFF_UP) == 0 && (hints->li_flags & LI_DOWN) == 0) {
SU_DEBUG_9(("su_localinfo: if %s with index %d is down\n",
if_name, if_index));
continue;
}
#else
......@@ -1041,6 +1042,10 @@ int bsd_localinfo(su_localinfo_t const hints[1],
char const *ifname = 0;
size_t ifnamelen = 0;
/* no ip address from if that is down */
if ((ifa->ifa_flags & IFF_UP) == 0 && (hints->li_flags & LI_DOWN) == 0)
continue;
su = (su_sockaddr_t *)ifa->ifa_addr;
if (!su)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment