--- net-snmp-5.7.1/agent/mibgroup/if-mib/data_access/interface_linux.c 2012-08-29 11:28:43.000000000 -0500 +++ net-snmp-5.7.1.patched/agent/mibgroup/if-mib/data_access/interface_linux.c 2012-08-29 11:22:05.000000000 -0500 @@ -7,6 +7,9 @@ #include #include +#include "../../../../../cpqNic/data_access/nic_linux.h" +#include "../../../../../common/utils.h" + netsnmp_feature_require(fd_event_manager) netsnmp_feature_require(delete_prefix_info) netsnmp_feature_require(create_prefix_info) @@ -47,6 +50,7 @@ #include #include #include "if-mib/data_access/interface.h" +#include "if-mib/ifTable/ifTable_interface.h" #include "mibgroup/util_funcs.h" #include "interface_ioctl.h" @@ -284,7 +288,6 @@ } } -#ifdef HAVE_PCI_LOOKUP_NAME /* Get value from sysfs file */ static int sysfs_get_id(const char *path, unsigned short *id) @@ -314,11 +317,21 @@ static void _arch_interface_description_get(netsnmp_interface_entry *entry) { - const char *descr; char buf[256]; unsigned short vendor_id, device_id; + unsigned short subsystem_vendor_id, subsystem_device_id; + nic_hw_db *pnic_hw_db; + + snprintf(buf, sizeof(buf), + "/sys/class/net/%s/device/subsystem_vendor", entry->name); + + if (!sysfs_get_id(buf, &subsystem_vendor_id)) + return; + + snprintf(buf, sizeof(buf), + "/sys/class/net/%s/device/subsystem_device", entry->name); - if (!pci_access) + if (!sysfs_get_id(buf, &subsystem_device_id)) return; snprintf(buf, sizeof(buf), @@ -333,19 +346,15 @@ if (!sysfs_get_id(buf, &device_id)) return; - descr = pci_lookup_name(pci_access, buf, sizeof(buf), - PCI_LOOKUP_VENDOR | PCI_LOOKUP_DEVICE, - vendor_id, device_id, 0, 0); - if (descr) { - free(entry->descr); - entry->descr = strdup(descr); - } else { - DEBUGMSGTL(("access:interface", - "Failed pci_lookup_name vendor=%#hx device=%#hx\n", - vendor_id, device_id)); - } + /* get model name and part number from database created struct */ + if ((pnic_hw_db = get_nic_hw_info(vendor_id, device_id, + subsystem_vendor_id, subsystem_device_id)) + != NULL) { + if (entry->descr != NULL) + free(entry->descr); + entry->descr = strdup( pnic_hw_db->pname); + } } -#endif #ifdef NETSNMP_ENABLE_IPV6 @@ -704,9 +710,7 @@ } entry->ns_flags = flags; /* initial flags; we'll set more later */ -#ifdef HAVE_PCI_LOOKUP_NAME _arch_interface_description_get(entry); -#endif /*