Blame SOURCES/net-snmp-5.5-getnext-loop.patch

b5ae06
851637 - snmpd loops inifinitely after receiving SIGTERM
b5ae06
b5ae06
commit 9b15aa36d0fc40b46fe9461d56cf584bbf040691
b5ae06
Author: Jan Safranek <jsafranek@users.sourceforge.net>
b5ae06
Date:   Thu Sep 13 15:25:52 2012 +0200
b5ae06
b5ae06
    CHANGES: snmpd: fixed infinite loop when SIGTEM arrives in middle of internal query processing.
b5ae06
    
b5ae06
    When snmpd starts internal query, e.g. for 'monitor' config options, it calls
b5ae06
    netsnmp_query_walk(). This function loops until either error occurs or the
b5ae06
    internal request is processed. And if SIGTERM comes to this loop, the request
b5ae06
    is not marked as failed.
b5ae06
    
b5ae06
    Patch originally from Masahiro Matsuya, mmatsuya [at] redhat.com
b5ae06
b5ae06
diff --git a/agent/snmp_agent.c b/agent/snmp_agent.c
b5ae06
index 1c00a4c..b7761b0 100644
b5ae06
--- a/agent/snmp_agent.c
b5ae06
+++ b/agent/snmp_agent.c
b5ae06
@@ -3057,6 +3057,9 @@ handle_getnext_loop(netsnmp_agent_session *asp)
b5ae06
             return status;      /* should never really happen */
b5ae06
         }
b5ae06
     }
b5ae06
+    if (!netsnmp_running) {
b5ae06
+        return SNMP_ERR_GENERR;
b5ae06
+    }
b5ae06
     return SNMP_ERR_NOERROR;
b5ae06
 }
b5ae06