Blame SOURCES/net-snmp-5.5-trap-forward-reqid.patch

34d7f3
Bug 1146948 - snmptrapd "Forward failed" when SNMPv3 requestid=0
34d7f3
Bug 1192511 - snmptrapd "Forward failed" when SNMPv3 requestid=0
34d7f3
34d7f3
commit 148f2de48e1cd6ba8ebdab8591424df64ab967a3
34d7f3
Author: Jan Safranek <jsafranek@users.sourceforge.net>
34d7f3
Date:   Thu Feb 5 14:01:44 2015 +0100
34d7f3
34d7f3
    CHANGES: snmptrapd: Correctly forward traps with Request-ID '0'.
34d7f3
    
34d7f3
    Request-ID of forwarded traps is taken from the incoming trap and it can be zero.
34d7f3
    We should not report error in this case.
34d7f3
34d7f3
diff --git a/apps/snmptrapd_handlers.c b/apps/snmptrapd_handlers.c
34d7f3
index 37ca5ab..74cc62e 100644
34d7f3
--- a/apps/snmptrapd_handlers.c
34d7f3
+++ b/apps/snmptrapd_handlers.c
34d7f3
@@ -1013,9 +1013,12 @@ int   forward_handler( netsnmp_pdu           *pdu,
34d7f3
         pdu2->transport_data        = NULL;
34d7f3
         pdu2->transport_data_length = 0;
34d7f3
     }
34d7f3
-    if (!snmp_send( ss, pdu2 )) {
34d7f3
-	snmp_sess_perror("Forward failed", ss);
34d7f3
-	snmp_free_pdu(pdu2);
34d7f3
+
34d7f3
+    ss->s_snmp_errno = SNMPERR_SUCCESS;
34d7f3
+    if (!snmp_send( ss, pdu2 ) &&
34d7f3
+            ss->s_snmp_errno != SNMPERR_SUCCESS) {
34d7f3
+        snmp_sess_perror("Forward failed", ss);
34d7f3
+        snmp_free_pdu(pdu2);
34d7f3
     }
34d7f3
     snmp_close( ss );
34d7f3
     return NETSNMPTRAPD_HANDLER_OK;