Fix error message when the address specified by clientaddr option is wrong or cannot be bound
This commit is contained in:
parent
4d7a6a1463
commit
b6b01ca16f
35
net-snmp-5.8-clientaddr-error-message.patch
Normal file
35
net-snmp-5.8-clientaddr-error-message.patch
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
diff -urNp a/snmplib/snmp_api.c b/snmplib/snmp_api.c
|
||||||
|
--- a/snmplib/snmp_api.c 2020-11-26 11:05:51.084788775 +0100
|
||||||
|
+++ b/snmplib/snmp_api.c 2020-11-26 11:08:27.850751397 +0100
|
||||||
|
@@ -235,7 +235,7 @@ static const char *api_errors[-SNMPERR_M
|
||||||
|
"No error", /* SNMPERR_SUCCESS */
|
||||||
|
"Generic error", /* SNMPERR_GENERR */
|
||||||
|
"Invalid local port", /* SNMPERR_BAD_LOCPORT */
|
||||||
|
- "Unknown host", /* SNMPERR_BAD_ADDRESS */
|
||||||
|
+ "Invalid address", /* SNMPERR_BAD_ADDRESS */
|
||||||
|
"Unknown session", /* SNMPERR_BAD_SESSION */
|
||||||
|
"Too long", /* SNMPERR_TOO_LONG */
|
||||||
|
"No socket", /* SNMPERR_NO_SOCKET */
|
||||||
|
@@ -1662,7 +1662,9 @@ _sess_open(netsnmp_session * in_session)
|
||||||
|
DEBUGMSGTL(("_sess_open", "couldn't interpret peername\n"));
|
||||||
|
in_session->s_snmp_errno = SNMPERR_BAD_ADDRESS;
|
||||||
|
in_session->s_errno = errno;
|
||||||
|
- snmp_set_detail(in_session->peername);
|
||||||
|
+ if (!netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
|
||||||
|
+ NETSNMP_DS_LIB_CLIENT_ADDR))
|
||||||
|
+ snmp_set_detail(in_session->peername);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff -ruNp a/snmplib/transports/snmpUDPIPv4BaseDomain.c b/snmplib/transports/snmpUDPIPv4BaseDomain.c
|
||||||
|
--- a/snmplib/transports/snmpUDPIPv4BaseDomain.c 2021-01-06 12:51:51.948106797 +0100
|
||||||
|
+++ b/snmplib/transports/snmpUDPIPv4BaseDomain.c 2021-01-06 14:17:31.029745744 +0100
|
||||||
|
@@ -209,6 +209,8 @@ netsnmp_udpipv4base_transport_bind(netsn
|
||||||
|
DEBUGMSGTL(("netsnmp_udpbase",
|
||||||
|
"failed to bind for clientaddr: %d %s\n",
|
||||||
|
errno, strerror(errno)));
|
||||||
|
+ NETSNMP_LOGONCE((LOG_ERR, "Cannot bind for clientaddr: %s\n",
|
||||||
|
+ strerror(errno)));
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
@ -51,6 +51,7 @@ Patch21: net-snmp-5.8-rpm-memory-leak.patch
|
|||||||
Patch22: net-snmp-5.9-aes-config.patch
|
Patch22: net-snmp-5.9-aes-config.patch
|
||||||
Patch23: net-snmp-5.9-available-memory.patch
|
Patch23: net-snmp-5.9-available-memory.patch
|
||||||
Patch24: net-snmp-5.8-asn-parse-nlength.patch
|
Patch24: net-snmp-5.8-asn-parse-nlength.patch
|
||||||
|
Patch25: net-snmp-5.8-clientaddr-error-message.patch
|
||||||
|
|
||||||
# Modern RPM API means at least EL6
|
# Modern RPM API means at least EL6
|
||||||
Patch101: net-snmp-5.8-modern-rpm-api.patch
|
Patch101: net-snmp-5.8-modern-rpm-api.patch
|
||||||
@ -225,6 +226,7 @@ cp %{SOURCE10} .
|
|||||||
%patch22 -p1 -b .aes-config
|
%patch22 -p1 -b .aes-config
|
||||||
%patch23 -p1 -b .available-memory
|
%patch23 -p1 -b .available-memory
|
||||||
%patch24 -p1 -b .asn-parse-nlength
|
%patch24 -p1 -b .asn-parse-nlength
|
||||||
|
%patch25 -p1 -b .clientaddr-error-message
|
||||||
|
|
||||||
%patch101 -p1 -b .modern-rpm-api
|
%patch101 -p1 -b .modern-rpm-api
|
||||||
%patch102 -p1
|
%patch102 -p1
|
||||||
@ -494,6 +496,8 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test
|
|||||||
%changelog
|
%changelog
|
||||||
* Mon Jan 18 2021 Josef Ridky <jridky@redhat.com> - 1:5.9-4
|
* Mon Jan 18 2021 Josef Ridky <jridky@redhat.com> - 1:5.9-4
|
||||||
- fix issue with parsing long trap headers (#1912725)
|
- fix issue with parsing long trap headers (#1912725)
|
||||||
|
- fix error message when the address specified by clientaddr option
|
||||||
|
is wrong or cannot be bound
|
||||||
|
|
||||||
* Wed Nov 18 2020 Josef Ridky <jridky@redhat.com> - 1:5.9-3
|
* Wed Nov 18 2020 Josef Ridky <jridky@redhat.com> - 1:5.9-3
|
||||||
- update net-snmp-tmpfs.conf for /var/run to /run (#1893471)
|
- update net-snmp-tmpfs.conf for /var/run to /run (#1893471)
|
||||||
|
Loading…
Reference in New Issue
Block a user