#ifdef notdef
if (!s) {
- if (afsifinfo[i].ipaddr != 0x7f000001) { /* ignore loopback */
+ if (!rx_IsLoopbackAddr(afsifinfo[i].ipaddr)) { /* ignore loopback */
*cnt += 1;
if (*cnt > 16)
return;
net = ipif->ipif_local_addr & netmask;
#ifdef notdef
if (!s) {
- if (ipif->ipif_local_addr != 0x7f000001) { /* ignore loopback */
+ if (!rx_IsLoopbackAddr(ipif->ipif_local_addr)) { /* ignore loopback */
*cnt += 1;
if (*cnt > 16)
return;
memcpy(&addr, th->h_addr, sizeof(addr));
}
- if (addr == htonl(0x7f000001)) { /* local host */
+ if (rx_IsLoopbackAddr(ntohl(addr))) { /* local host */
code = gethostname(hostname, MAXHOSTCHARS);
if (code)
return 0;
*(int *)arg1 = different;
}
rxmtu = rxmtu * rxi_nRecvFrags + ((rxi_nRecvFrags - 1) * UDP_HDR_SIZE);
- if ((ifinaddr != 0x7f000001) && (rxmtu > rx_maxReceiveSize)) {
+ if (!rx_IsLoopbackAddr(ifinaddr) && (rxmtu > rx_maxReceiveSize)) {
rx_maxReceiveSize = MIN(RX_MAX_PACKET_SIZE, rxmtu);
rx_maxReceiveSize = MIN(rx_maxReceiveSize, rx_maxReceiveSizeUser);
}
maxmtu = rxi_AdjustMaxMTU(rxmtu, maxmtu);
addrs[i] = ifinaddr;
- if (ifinaddr != 0x7f000001 && maxmtu > rx_maxReceiveSize) {
+ if (!rx_IsLoopbackAddr(ifinaddr) && maxmtu > rx_maxReceiveSize) {
rx_maxReceiveSize = MIN(RX_MAX_PACKET_SIZE, maxmtu);
rx_maxReceiveSize =
MIN(rx_maxReceiveSize, rx_maxReceiveSizeUser);
addrs[i] = ifinaddr;
i++;
- if (ifinaddr != 0x7f000001 && maxmtu > rx_maxReceiveSize) {
+ if (!rx_IsLoopbackAddr(ifinaddr) && maxmtu > rx_maxReceiveSize) {
rx_maxReceiveSize = MIN(RX_MAX_PACKET_SIZE, maxmtu);
rx_maxReceiveSize =
MIN(rx_maxReceiveSize, rx_maxReceiveSizeUser);
#define rx_SecurityClassOf(conn) ((conn)->securityIndex)
#define rx_SecurityObjectOf(conn) ((conn)->securityObject)
+static_inline int
+rx_IsLoopbackAddr(afs_uint32 addr)
+{
+ return (addr == 0x7f000001);
+}
+
/*******************
* Macros callable by the user to further define attributes of a
* service. Must be called before rx_StartServer
if (count >= maxSize) /* no more space */
dpf(("Too many interfaces..ignoring 0x%x\n",
a->sin_addr.s_addr));
- else if (!loopbacks && a->sin_addr.s_addr == htonl(0x7f000001)) {
+ else if (!loopbacks && rx_IsLoopbackAddr(ntohl(a->sin_addr.s_addr))) {
addrcount--;
continue; /* skip loopback address as well. */
} else if (loopbacks && ifm->ifm_flags & IFF_LOOPBACK) {
}
a = (struct sockaddr_in *) info.rti_info[RTAX_IFA];
- if (a->sin_addr.s_addr != htonl(0x7f000001) ) {
+ if (!rx_IsLoopbackAddr(ntohl(a->sin_addr.s_addr))) ) {
if (count >= maxSize) { /* no more space */
dpf(("Too many interfaces..ignoring 0x%x\n",
a->sin_addr.s_addr));
}
if (a->sin_addr.s_addr != 0) {
if (!loopbacks) {
- if (a->sin_addr.s_addr == htonl(0x7f000001))
+ if (rx_IsLoopbackAddr(ntohl(a->sin_addr.s_addr)))
continue; /* skip loopback address as well. */
} else {
if (ifr->ifr_flags & IFF_LOOPBACK)
continue; /* ignore this address */
}
- if (a->sin_addr.s_addr == htonl(0x7f000001) )
+ if (rx_IsLoopbackAddr(ntohl(a->sin_addr.s_addr)))
continue; /* skip loopback address as well. */
if (count >= maxSize) { /* no more space */
rxmtu * rxi_nRecvFrags + ((rxi_nRecvFrags - 1) * UDP_HDR_SIZE);
maxmtu = rxi_AdjustMaxMTU(rxmtu, maxmtu);
addrs[i++] = ifinaddr;
- if ((ifinaddr != 0x7f000001) && (maxmtu > rx_maxReceiveSize)) {
+ if (!rx_IsLoopbackAddr(ifinaddr) && (maxmtu > rx_maxReceiveSize)) {
rx_maxReceiveSize = MIN(RX_MAX_PACKET_SIZE, maxmtu);
rx_maxReceiveSize = MIN(rx_maxReceiveSize, rx_maxReceiveSizeUser);
}
((rxi_nRecvFrags - 1) * UDP_HDR_SIZE);
maxmtu = rxi_AdjustMaxMTU(rxmtu, maxmtu);
addrs[i++] = ifinaddr;
- if ((ifinaddr != 0x7f000001) &&
+ if (!rx_IsLoopbackAddr(ifinaddr) &&
(maxmtu > rx_maxReceiveSize)) {
rx_maxReceiveSize =
MIN(RX_MAX_PACKET_SIZE, maxmtu);
((rxi_nRecvFrags - 1) * UDP_HDR_SIZE);
maxmtu = rxi_AdjustMaxMTU(rxmtu, maxmtu);
addrs[i++] = ifinaddr;
- if ((ifinaddr != 0x7f000001) && (maxmtu > rx_maxReceiveSize)) {
+ if (!rx_IsLoopbackAddr(ifinaddr) && (maxmtu > rx_maxReceiveSize)) {
rx_maxReceiveSize = MIN(RX_MAX_PACKET_SIZE, maxmtu);
rx_maxReceiveSize =
MIN(rx_maxReceiveSize, rx_maxReceiveSizeUser);
if (a->sin_family != AF_INET)
continue;
rxi_NetAddrs[rxi_numNetAddrs] = ntohl(a->sin_addr.s_addr);
- if (rxi_NetAddrs[rxi_numNetAddrs] == 0x7f000001) {
+ if (rx_IsLoopbackAddr(rxi_NetAddrs[rxi_numNetAddrs])) {
/* we don't really care about "localhost" */
continue;
}
#endif
}
- if (rxi_NetAddrs[rxi_numNetAddrs] != 0x7f000001) { /* ignore lo0 */
+ if (!rx_IsLoopbackAddr(rxi_NetAddrs[rxi_numNetAddrs])) { /* ignore lo0 */
int maxsize;
maxsize =
rxi_nRecvFrags * (myNetMTUs[rxi_numNetAddrs] - RX_IP_SIZE);
#define MAX_NETFILE_LINE 2048 /* length of a line in the netrestrict file */
#define MAXIPADDRS 1024 /* from afsd.c */
-#ifndef INADDR_LOOPBACK
-#define INADDR_LOOPBACK (afs_uint32)0x7f000001
-#endif
-
int ParseNetInfoFile_int(afs_uint32 *, afs_uint32 *, afs_uint32 *,
int, char reason[], const char *,
int);
}
/* Always mask loopback address */
- if (found && addr1[i] == INADDR_LOOPBACK)
+ if (found && rx_IsLoopbackAddr(addr1[i]))
found = 0;
if (found) {
memcpy(&addr, th->h_addr, sizeof(addr));
}
- if (addr == htonl(0x7f000001)) { /* local host */
+ if (rx_IsLoopbackAddr(ntohl(addr))) { /* local host */
code = gethostname(hostname, MAXHOSTCHARS);
if (code)
return 0;