#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
static void
-rt_xaddrs(cp, cplim, rtinfo)
- caddr_t cp, cplim;
- struct rt_addrinfo *rtinfo;
+rt_xaddrs(caddr_t cp, caddr_t cplim, struct rt_addrinfo *rtinfo)
{
struct sockaddr *sa;
int i;
*/
#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
int
-rx_getAllAddr(buffer, maxSize)
- afs_int32 buffer[];
- int maxSize; /* sizeof of buffer in afs_int32 units */
+rx_getAllAddr(afs_int32 buffer[], int maxSize)
{
size_t needed;
int mib[6];
}
int
-rxi_getAllAddrMaskMtu(addrBuffer, maskBuffer, mtuBuffer, maxSize)
- afs_int32 addrBuffer[]; /* the network addrs in net byte order */
- afs_int32 maskBuffer[]; /* the subnet masks */
- afs_int32 mtuBuffer[]; /* the MTU sizes */
- int maxSize; /* sizeof of buffer in afs_int32 units */
+rxi_getAllAddrMaskMtu(afs_int32 addrBuffer[], afs_int32 maskBuffer[],
+ afs_int32 mtuBuffer[], int maxSize)
{
int s;
}
if ((ifm->ifm_flags & IFF_UP) == 0)
continue; /* not up */
- if (ifm->ifm_flags & IFF_LOOPBACK) {
- continue; /* skip aliased loopbacks as well. */
- }
while (addrcount > 0) {
struct sockaddr_in *a;
free(buf);
return count;
}
-
-
#else
-int
-rx_getAllAddr(buffer, maxSize)
- afs_int32 buffer[];
- int maxSize; /* sizeof of buffer in afs_int32 units */
+static int
+rx_getAllAddr_internal(afs_int32 buffer[], int maxSize, int loopbacks)
{
int s;
int i, len, count = 0;
continue; /* ignore this address */
}
if (a->sin_addr.s_addr != 0) {
- if (ifr->ifr_flags & IFF_LOOPBACK) {
+ if (!loopbacks && (ifr->ifr_flags & IFF_LOOPBACK)) {
continue; /* skip aliased loopbacks as well. */
}
if (count >= maxSize) /* no more space */
return count;
}
+int
+rx_getAllAddr(afs_int32 buffer[], int maxSize)
+{
+ return rx_getAllAddr_internal(buffer, maxSize, 0);
+}
+
/* this function returns the total number of interface addresses
* the buffer has to be passed in by the caller. It also returns
* the interface mask. If AFS_USERSPACE_IP_ADDR is defined, it
* by afsi_SetServerIPRank().
*/
int
-rxi_getAllAddrMaskMtu(addrBuffer, maskBuffer, mtuBuffer, maxSize)
- afs_int32 addrBuffer[]; /* the network addrs in net byte order */
- afs_int32 maskBuffer[]; /* the subnet masks */
- afs_int32 mtuBuffer[]; /* the MTU sizes */
- int maxSize; /* sizeof of buffer in afs_int32 units */
+rxi_getAllAddrMaskMtu(afs_int32 addrBuffer[], afs_int32 maskBuffer[],
+ afs_int32 mtuBuffer[], int maxSize)
{
int s;
int i, len, count = 0;
#endif
#if !defined(AFS_USERSPACE_IP_ADDR)
- count = rx_getAllAddr(addrBuffer, 1024);
+ count = rx_getAllAddr_internal(addrBuffer, 1024, 1);
for (i = 0; i < count; i++) {
maskBuffer[i] = htonl(0xffffffff);
mtuBuffer[i] = htonl(1500);
perror("SIOCGIFFLAGS");
continue; /* ignore this address */
}
- 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",