diff --git a/src/rx/rx_getaddr.c b/src/rx/rx_getaddr.c index b917f8e39e..ea8fa598cd 100644 --- a/src/rx/rx_getaddr.c +++ b/src/rx/rx_getaddr.c @@ -139,6 +139,18 @@ rt_xaddrs(caddr_t cp, caddr_t cplim, struct rt_addrinfo *rtinfo) } #endif +static_inline int +rxi_IsLoopbackIface(struct sockaddr_in *a, unsigned long flags) +{ + afs_uint32 addr = ntohl(a->sin_addr.s_addr); + if (rx_IsLoopbackAddr(addr)) { + return 1; + } + if ((flags & IFF_LOOPBACK) && ((addr & 0xff000000) == 0x7f000000)) { + return 1; + } + return 0; +} /* this function returns the total number of interface addresses ** the buffer has to be passed in by the caller @@ -240,7 +252,7 @@ rx_getAllAddr_internal(afs_uint32 buffer[], int maxSize, int loopbacks) if (count >= maxSize) /* no more space */ dpf(("Too many interfaces..ignoring 0x%x\n", a->sin_addr.s_addr)); - else if (!loopbacks && rx_IsLoopbackAddr(ntohl(a->sin_addr.s_addr))) { + else if (!loopbacks && rxi_IsLoopbackIface(a, ifm->ifm_flags)) { addrcount--; continue; /* skip loopback address as well. */ } else if (loopbacks && ifm->ifm_flags & IFF_LOOPBACK) { @@ -430,7 +442,7 @@ rx_getAllAddr_internal(afs_uint32 buffer[], int maxSize, int loopbacks) } if (a->sin_addr.s_addr != 0) { if (!loopbacks) { - if (rx_IsLoopbackAddr(ntohl(a->sin_addr.s_addr))) + if (rxi_IsLoopbackIface(a, ifr->ifr_flags)) continue; /* skip loopback address as well. */ } else { if (ifr->ifr_flags & IFF_LOOPBACK)