It seems that I was overly optimistic in hoping that there was a common
structure for the ifIndex ioctl call based on testing on the SourceForge
compile farm machines. A recent message to the list seems to indicate
that FreeBSD 5.2 does not have the particular structure I used.

Instead of a band-aid to fix this problem, this attached patch does two
things:

1) don't pull in interface_ioctl code for all platforms.
2) ifdef out references in interface_common if architecture has not been
   ported (everyone but Linux, at the moment).


This should prevent future surprises, and is what I should have done in
the first place.

Proposed patches:

Index: agent/mibgroup/if-mib/data_access/interface.h
===================================================================
RCS file:
/cvsroot/net-snmp/net-snmp/agent/mibgroup/if-mib/data_access/interface.
h,v retrieving revision 1.9
diff -u -r1.9 interface.h
--- agent/mibgroup/if-mib/data_access/interface.h       17 Oct 2004 01:49:39 
-0000      1.9
+++ agent/mibgroup/if-mib/data_access/interface.h       9 Nov 2004 20:36:09 
-0000
@@ -21,9 +21,9 @@
  *    be handled in the *_hpux.h header file.
  */
 config_require(if-mib/data_access/interface_common)
-config_require(if-mib/data_access/interface_ioctl);
 #if defined( linux )
 config_require(if-mib/data_access/interface_linux);
+config_require(if-mib/data_access/interface_ioctl);
 #else
 #   define NETSNMP_ACCESS_INTERFACE_NOARCH 1
 #endif
Index: agent/mibgroup/if-mib/data_access/interface_common.c
===================================================================
RCS file:
/cvsroot/net-snmp/net-snmp/agent/mibgroup/if-mib/data_access/interface_
common.c,v retrieving revision 1.19
diff -u -r1.19 interface_common.c
--- agent/mibgroup/if-mib/data_access/interface_common.c        17 Oct 2004 
01:51:20 -0000      1.19
+++ agent/mibgroup/if-mib/data_access/interface_common.c        9 Nov 2004 
20:36:09 -0000
@@ -160,7 +160,6 @@
 
     return container;
 }
-#endif
 
 void
 netsnmp_access_interface_container_free(netsnmp_container *container,
u_int free_flags)@@ -184,6 +183,19 @@
     CONTAINER_FREE(container);
 }
 
+/**
+ * @retval 0  interface not found
+ */
+oid
+netsnmp_access_interface_index_find(const char *name)
+{
+    DEBUGMSGTL(("access:interface:find", "index\n"));
+    netsnmp_assert(1 == _access_interface_init);
+
+    return netsnmp_arch_interface_index_find(name);
+}
+#endif
+

/**--------------------------------------------------------------------
-*/ /*
  * ifentry functions
@@ -238,22 +250,6 @@
 }
 
 /**
- * @retval 0  interface not found
- */
-oid
-netsnmp_access_interface_index_find(const char *name)
-{
-    DEBUGMSGTL(("access:interface:find", "index\n"));
-    netsnmp_assert(1 == _access_interface_init);
-
-#ifndef NETSNMP_ACCESS_INTERFACE_NOARCH
-    return netsnmp_arch_interface_index_find(name);
-#else
-    return netsnmp_access_interface_ioctl_ifindex_get(-1, name);
-#endif
-}
-
-/**
  * @retval NULL  index not found
  */
 const char *
@@ -285,9 +281,11 @@
     /*
      * get if index, and save name for reverse lookup
      */
+#ifndef NETSNMP_ACCESS_INTERFACE_NOARCH
     if (0 == if_index)
         entry->index = netsnmp_access_interface_index_find(name);
     else
+#endif
         entry->index = if_index;
     _access_interface_entry_save_name(name, entry->index);
 


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
Net-snmp-coders mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to