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