From 0867787a38c8b596e7e1630d9dfb1e9e985cead9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20=C5=98=C3=ADdk=C3=BD?= Date: Tue, 1 Aug 2023 08:14:07 +0200 Subject: [PATCH] Fix sendmsg error code change for new kernel --- net-snmp-5.9-sendmsg-error-code.patch | 31 +++++++++++++++++++++++++++ net-snmp.spec | 3 +++ 2 files changed, 34 insertions(+) create mode 100644 net-snmp-5.9-sendmsg-error-code.patch 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 4a67f14..da99d50 100644 --- a/net-snmp.spec +++ b/net-snmp.spec @@ -51,6 +51,7 @@ Patch21: net-snmp-5.9.1-autoconf.patch Patch22: net-snmp-libs-misunderstanding.patch Patch23: net-snmp-5.9-CVE-2022-44792-44793.patch Patch24: net-snmp-5.9-ipv6-disable-leak.patch +Patch25: net-snmp-5.9-sendmsg-error-code.patch # Modern RPM API means at least EL6 Patch101: net-snmp-5.8-modern-rpm-api.patch @@ -226,6 +227,7 @@ cp %{SOURCE10} . %patch 22 -p1 %patch 23 -p1 %patch 24 -p1 -b .ipv6-disable-leak +%patch 25 -p1 -b .sendmsg-error-code %patch 101 -p1 -b .modern-rpm-api %patch 102 -p1 @@ -496,6 +498,7 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test %changelog * Tue Aug 01 2023 Josef Ridky - 1:5.9.3-7 - Sync fixes with RHEL +- Fix sendmesg error code change for new kernel * Wed Jul 19 2023 Josef Ridky - 1:5.9.3-6 - Migrate to SPDX license format