Blob Blame History Raw
--- net-snmp-5.1.1/agent/mibgroup/mibII/ipAddr.c.ipAdEntIfIndex	2004-04-08 17:38:48.368076685 +0200
+++ net-snmp-5.1.1/agent/mibgroup/mibII/ipAddr.c	2004-04-08 17:48:52.977283961 +0200
@@ -199,6 +199,10 @@
     static struct in_ifaddr in_ifaddr, lowin_ifaddr;
 #else
     static struct ifnet lowin_ifnet;
+    static in_addr_t addr_ret;
+#if defined(linux)
+    static struct in_ifaddr in_ifaddr;
+#endif
 #endif
     static struct ifnet ifnet;
 #endif                          /* hpux11 */
@@ -211,14 +214,14 @@
     memcpy((char *) current, (char *) vp->name,
            (int) vp->namelen * sizeof(oid));
 
-#if !defined(freebsd2) && !defined(hpux11) && !defined(linux)
+#if !defined(freebsd2) && !defined(hpux11)
     Interface_Scan_Init();
 #else
     Address_Scan_Init();
 #endif
     for (;;) {
 
-#if !defined(freebsd2) && !defined(hpux11) && !defined(linux)
+#if !defined(freebsd2) && !defined(hpux11)
         if (Interface_Scan_Next(&interface, NULL, &ifnet, &in_ifaddr) == 0)
             break;
 #ifdef STRUCT_IFNET_HAS_IF_ADDRLIST
@@ -226,10 +229,7 @@
             continue;           /* No address found for interface */
 #endif
 #else                           /* !freebsd2 && !hpux11 */
-#if defined(linux)
-        if (Address_Scan_Next(&interface, &ifnet) == 0)
-            break;
-#else
+#if !defined(linux)
         if (Address_Scan_Next(&interface, &in_ifaddr) == 0)
             break;
 #endif
@@ -240,6 +240,9 @@
 #elif defined(linux) || defined(sunV3)
         cp = (u_char *) & (((struct sockaddr_in *) &(ifnet.if_addr))->
                            sin_addr.s_addr);
+
+        if (*cp == 0)		/* first octet is zero? 0.x.x.x is not a */
+            continue;		/* legal address for an interface */
 #else
         cp = (u_char *) & (((struct sockaddr_in *) &(in_ifaddr.ia_addr))->
                            sin_addr.s_addr);