diff --git a/net-snmp-5.9-sendmsg-error-code.patch b/net-snmp-5.9-sendmsg-error-code.patch new file mode 100644 index 0000000..6709cef --- /dev/null +++ b/net-snmp-5.9-sendmsg-error-code.patch @@ -0,0 +1,31 @@ +From 298c8103db80b292791616af4fd497342a71867f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Josef=20=C5=98=C3=ADdk=C3=BD?= +Date: Wed, 24 May 2023 10:49:41 +0200 +Subject: [PATCH] libsnmp, UDP transport: Fix sendmsg() error code handling + +This change has been made because of Linux kernel commit "ipv4: Return +-ENETUNREACH if we can't create route but saddr is valid" +(https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=595e0651d029) + +Fixes: https://github.com/net-snmp/net-snmp/issues/564 +Fixes: https://github.com/net-snmp/net-snmp/pull/576 + +[ bvanassche: edited commit message ] +--- + snmplib/transports/snmpUDPBaseDomain.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/snmplib/transports/snmpUDPBaseDomain.c b/snmplib/transports/snmpUDPBaseDomain.c +index ca8f9a5554..cd6b15e2ad 100644 +--- a/snmplib/transports/snmpUDPBaseDomain.c ++++ b/snmplib/transports/snmpUDPBaseDomain.c +@@ -315,7 +315,7 @@ int netsnmp_udpbase_sendto_unix(int fd, const struct in_addr *srcip, + sizeof(struct sockaddr)); + else + rc = sendmsg(fd, &m, MSG_DONTWAIT); +- if (rc >= 0 || errno != EINVAL) ++ if (rc >= 0 || (errno != EINVAL && errno != ENETUNREACH)) + return rc; + + /* + diff --git a/net-snmp.spec b/net-snmp.spec index d7b1491..0006af9 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: 9%{?dist} +Release: 10%{?dist} Epoch: 1 License: BSD @@ -54,6 +54,7 @@ Patch24: net-snmp-5.9-twice-IP-parsing.patch Patch25: net-snmp-5.9-openssl-3.0.patch Patch26: net-snmp-5.9-CVE-2022-44792-44793.patch Patch27: net-snmp-5.9-ipv6-disable-leak.patch +Patch28: net-snmp-5.9-sendmsg-error-code.patch # Modern RPM API means at least EL6 Patch101: net-snmp-5.8-modern-rpm-api.patch @@ -233,6 +234,7 @@ cp %{SOURCE10} . %patch25 -p1 -b .openssl-3-0 %patch26 -p1 %patch27 -p1 -b .ipv6-disable-leak +%patch28 -p1 -b .sendmsg-error-code %patch101 -p1 -b .modern-rpm-api %patch102 -p1 @@ -502,6 +504,9 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test %{_libdir}/libnetsnmptrapd*.so.%{soname}* %changelog +* Wed Aug 02 2023 Josef Ridky - 1:5.9.1-10 +- fix sendmsg error code for new kernel (#2210892) + * Wed Feb 15 2023 Josef Ridky - 1:5.9.1-9 - fix CVE-2022-44792 and CVE-2022-44793 (#2141902) and (#2141906) - fix memory leak when ipv6 disable set to 1 (#2151540)