netrestrict-netinfo-20081129
[openafs.git] / src / rx / rx_user.c
index 4537559..efd5f22 100644 (file)
@@ -308,14 +308,14 @@ rx_getAllAddr(afs_uint32 * buffer, int maxSize)
     /* The IP address list can change so we must query for it */
     rx_GetIFInfo();
 
-#ifndef AFS_NT40_ENV
+#ifdef AFS_DJGPP_ENV
     /* we don't want to use the loopback adapter which is first */
     /* this is a bad bad hack.
      * and doesn't hold true on Windows.
      */
     if ( rxi_numNetAddrs > 1 )
         offset = 1;
-#endif /* AFS_NT40_ENV */
+#endif /* AFS_DJGPP_ENV */
 
     for (count = 0; offset < rxi_numNetAddrs && maxSize > 0;
         count++, offset++, maxSize--)
@@ -323,6 +323,39 @@ rx_getAllAddr(afs_uint32 * buffer, int maxSize)
 
     return count;
 }
+
+/* this function returns the total number of interface addresses
+ * the buffer has to be passed in by the caller. It also returns
+ * the matching interface mask and mtu.  All values are returned
+ * in network byte order.
+ */
+int
+rx_getAllAddrMaskMtu(afs_uint32 addrBuffer[], afs_uint32 maskBuffer[],
+                     afs_uint32 mtuBuffer[], int maxSize)
+{
+    int count = 0, offset = 0;
+
+    /* The IP address list can change so we must query for it */
+    rx_GetIFInfo();
+
+#ifdef AFS_DJGPP_ENV
+    /* we don't want to use the loopback adapter which is first */
+    /* this is a bad bad hack.
+     * and doesn't hold true on Windows.
+     */
+    if ( rxi_numNetAddrs > 1 )
+        offset = 1;
+#endif /* AFS_DJGPP_ENV */
+
+    for (count = 0; 
+         offset < rxi_numNetAddrs && maxSize > 0;
+         count++, offset++, maxSize--) {
+       addrBuffer[count] = htonl(rxi_NetAddrs[offset]);
+       maskBuffer[count] = htonl(myNetMasks[offset]);
+       mtuBuffer[count]  = htonl(myNetMTUs[offset]);
+    }
+    return count;
+}
 #endif
 
 #ifdef AFS_NT40_ENV