41 lines
1.7 KiB
Diff
41 lines
1.7 KiB
Diff
From 8da919e4ad66dec376f54a6d2f7dd7a7fe68b8f0 Mon Sep 17 00:00:00 2001
|
|
From: Bart Van Assche <bvanassche@acm.org>
|
|
Date: Sat, 31 Jul 2021 16:01:11 -0700
|
|
Subject: [PATCH] Linux: IF-MIB: Pass the network interface index to
|
|
netsnmp_access_interface_entry_create()
|
|
|
|
Instead of letting netsnmp_access_interface_entry_create() call
|
|
netsnmp_arch_interface_index_find() a second time, pass the network interface
|
|
index to that function.
|
|
---
|
|
agent/mibgroup/if-mib/data_access/interface_linux.c | 5 +++--
|
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/agent/mibgroup/if-mib/data_access/interface_linux.c b/agent/mibgroup/if-mib/data_access/interface_linux.c
|
|
index 9c96eb92d..e99360a21 100644
|
|
--- a/agent/mibgroup/if-mib/data_access/interface_linux.c
|
|
+++ b/agent/mibgroup/if-mib/data_access/interface_linux.c
|
|
@@ -733,8 +733,9 @@ netsnmp_arch_interface_container_load(netsnmp_container* container,
|
|
* ip version is to look for ip addresses. If anyone
|
|
* knows a better way, put it here!
|
|
*/
|
|
-#ifdef NETSNMP_ENABLE_IPV6
|
|
if_index = netsnmp_arch_interface_index_find(ifstart);
|
|
+ netsnmp_assert(if_index != 0);
|
|
+#ifdef NETSNMP_ENABLE_IPV6
|
|
_arch_interface_has_ipv6(if_index, &flags, addr_container);
|
|
#endif
|
|
netsnmp_access_interface_ioctl_has_ipv4(fd, ifstart, 0, &flags, &ifc);
|
|
@@ -752,7 +753,7 @@ netsnmp_arch_interface_container_load(netsnmp_container* container,
|
|
continue;
|
|
}
|
|
|
|
- entry = netsnmp_access_interface_entry_create(ifstart, 0);
|
|
+ entry = netsnmp_access_interface_entry_create(ifstart, if_index);
|
|
if(NULL == entry) {
|
|
#ifdef NETSNMP_ENABLE_IPV6
|
|
netsnmp_access_ipaddress_container_free(addr_container, 0);
|
|
--
|
|
2.33.0
|
|
|