From 27fbf495163784c7d9a88001441b671f446ce547 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Sun, 7 Nov 2004 17:11:50 +0000 Subject: [PATCH] mask-loopback-address-allow-loopback-interfaces-to-be-advertised-20041106 some software network adapters use instances of lo but are real network adapters . allow them to be advertised. the modified functions are called only in the pro cess of collecting a list to advertise. at the same time, make sure we mask 127.0.0.1. i wonder if that's a mistake. --- src/rx/rx_getaddr.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/rx/rx_getaddr.c b/src/rx/rx_getaddr.c index 870946997..cb7c7e1ab 100644 --- a/src/rx/rx_getaddr.c +++ b/src/rx/rx_getaddr.c @@ -342,18 +342,22 @@ rx_getAllAddr_internal(afs_int32 buffer[], int maxSize, int loopbacks) for (cp = (char *)ifc.ifc_buf, cplim = ifc.ifc_buf + ifc.ifc_len; cp < cplim; #if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) - cp += _SIZEOF_ADDR_IFREQ(*ifr)) + cp += _SIZEOF_ADDR_IFREQ(*ifr) #else #ifdef AFS_AIX51_ENV - cp = cpnext) + cp = cpnext #else - cp += sizeof(ifr->ifr_name) + MAX(a->sin_len, sizeof(*a))) + cp += sizeof(ifr->ifr_name) + MAX(a->sin_len, sizeof(*a)) #endif +#endif + ) +#else + for (i = 0; i < len; ++i) #endif { +#if defined(AFS_AIX41_ENV) || defined (AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) ifr = (struct ifreq *)cp; #else - for (i = 0; i < len; ++i) { ifr = &ifs[i]; #endif a = (struct sockaddr_in *)&ifr->ifr_addr; @@ -367,8 +371,12 @@ rx_getAllAddr_internal(afs_int32 buffer[], int maxSize, int loopbacks) continue; /* ignore this address */ } if (a->sin_addr.s_addr != 0) { - if (!loopbacks && (ifr->ifr_flags & IFF_LOOPBACK)) { - continue; /* skip aliased loopbacks as well. */ + if (!loopbacks) { + if (a->sin_addr.s_addr == htonl(0x7f000001)) + continue; /* skip loopback address as well. */ + } else { + if (ifr->ifr_flags & IFF_LOOPBACK) + continue; /* skip aliased loopbacks as well. */ } if (count >= maxSize) /* no more space */ printf("Too many interfaces..ignoring 0x%x\n", -- 2.39.5