Fix sendmsg error code change for new kernel

This commit is contained in:
Josef Řídký 2023-08-01 08:14:07 +02:00
parent 491853f2e5
commit 0867787a38
2 changed files with 34 additions and 0 deletions

View File

@ -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?= <jridky@redhat.com>
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;
/*

View File

@ -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 <jridky@redhat.com> - 1:5.9.3-7
- Sync fixes with RHEL
- Fix sendmesg error code change for new kernel
* Wed Jul 19 2023 Josef Ridky <jridky@redhat.com> - 1:5.9.3-6
- Migrate to SPDX license format