From 2cb576b6431713b379843e7920aaee28190336b9 Mon Sep 17 00:00:00 2001 From: Josef Ridky Date: Tue, 16 Jul 2024 10:25:39 +0200 Subject: [PATCH] Resolves: RHEL-46033 - fix segfault with error on subcontainer Signed-off-by: Josef Ridky --- net-snmp-5.9-deleted-iface.patch | 43 ++++++++++++++++++++++++++++++++ net-snmp.spec | 7 +++++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 net-snmp-5.9-deleted-iface.patch diff --git a/net-snmp-5.9-deleted-iface.patch b/net-snmp-5.9-deleted-iface.patch new file mode 100644 index 0000000..cb54152 --- /dev/null +++ b/net-snmp-5.9-deleted-iface.patch @@ -0,0 +1,43 @@ +diff -urNp a/agent/mibgroup/if-mib/data_access/interface_linux.c b/agent/mibgroup/if-mib/data_access/interface_linux.c +--- a/agent/mibgroup/if-mib/data_access/interface_linux.c 2024-07-16 10:05:43.294653089 +0200 ++++ b/agent/mibgroup/if-mib/data_access/interface_linux.c 2024-07-16 10:23:55.392041022 +0200 +@@ -609,7 +609,6 @@ netsnmp_arch_interface_container_load(ne + { + FILE *devin; + char line[256]; +- netsnmp_interface_entry *entry = NULL; + static char scan_expected = 0; + int fd; + int interfaces = 0; +@@ -690,6 +689,7 @@ netsnmp_arch_interface_container_load(ne + * and retrieve (or create) the corresponding data structure. + */ + while (fgets(line, sizeof(line), devin)) { ++ netsnmp_interface_entry *entry = NULL; + char *stats, *ifstart = line; + u_int flags; + oid if_index; +@@ -733,8 +733,13 @@ netsnmp_arch_interface_container_load(ne + * 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); ++ if (if_index == 0) { ++ DEBUGMSGTL(("access:interface", "network interface %s is gone", ++ ifstart)); ++ continue; ++ } ++#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 +757,7 @@ netsnmp_arch_interface_container_load(ne + 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); diff --git a/net-snmp.spec b/net-snmp.spec index 1984959..65f1475 100644 --- a/net-snmp.spec +++ b/net-snmp.spec @@ -10,7 +10,7 @@ Summary: A collection of SNMP protocol tools and libraries Name: net-snmp Version: 5.9.1 -Release: 16%{?dist} +Release: 17%{?dist} Epoch: 1 License: BSD @@ -59,6 +59,7 @@ Patch29: net-snmp-5.9-message-severity.patch Patch30: net-snmp-5.9-rpmdb.patch Patch31: net-snmp-5.9-CVE-2022-24805-24810.patch Patch32: net-snmp-5.9.4-kernel-6.7.patch +Patch33: net-snmp-5.9-deleted-iface.patch # Modern RPM API means at least EL6 Patch101: net-snmp-5.8-modern-rpm-api.patch @@ -243,6 +244,7 @@ cp %{SOURCE10} . %patch30 -p1 -b .rpmdb %patch31 -p1 -b .CVE-2022-24805-24810 %patch32 -p1 -b .kernel-6.7-fix +%patch33 -p1 -b .iface %patch101 -p1 -b .modern-rpm-api %patch102 -p1 @@ -512,6 +514,9 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test %{_libdir}/libnetsnmptrapd*.so.%{soname}* %changelog +* Tue Jul 16 2024 Josef Ridky - 1:5.9.1-17 +- fix segfault with error on subcontainer (RHEL-46033) + * Fri Jun 21 2024 Josef Ridky - 1:5.9.1-16 - fix unexpected header length in /proc/net/snmp (RHEL-44357)