Try to fix horrible SIGSEGV frequent crashes by patching snmp_agentx logic.

Wed, 21 Sep 2011 16:28:06 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 21 Sep 2011 16:28:06 +0200
changeset 384
590d931d793c
parent 383
ff9d497ea16d
child 385
7d62cfad2a24

Try to fix horrible SIGSEGV frequent crashes by patching snmp_agentx logic.

snmp/snmp.spec file | annotate | diff | comparison | revisions
snmp/snmp_agentx.patch file | annotate | diff | comparison | revisions
     1.1 --- a/snmp/snmp.spec	Wed Sep 21 16:27:30 2011 +0200
     1.2 +++ b/snmp/snmp.spec	Wed Sep 21 16:28:06 2011 +0200
     1.3 @@ -32,7 +32,7 @@
     1.4  Group:        Network
     1.5  License:      BSD
     1.6  Version:      5.7
     1.7 -Release:      20110914
     1.8 +Release:      20110915
     1.9  
    1.10  #   package options
    1.11  %option       with_fsl          yes
    1.12 @@ -50,6 +50,7 @@
    1.13  Source3:      snmpd.conf
    1.14  Source4:      snmptrapd.conf
    1.15  Patch0:       snmp.patch
    1.16 +Patch1:       snmp_agentx.patch
    1.17  
    1.18  #   build information
    1.19  Prefix:       %{l_prefix}
    1.20 @@ -87,6 +88,7 @@
    1.21      #   unpack and patch package
    1.22      %setup -q -n net-snmp-%{version}
    1.23      %patch -p0
    1.24 +    %patch -p0 -P 1
    1.25  
    1.26      #   provide a default PID file location
    1.27      %{l_shtool} subst %{l_value -s -a} \
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/snmp/snmp_agentx.patch	Wed Sep 21 16:28:06 2011 +0200
     2.3 @@ -0,0 +1,74 @@
     2.4 +diff Nau agent/snmp_agent.c.orig agent/snmp_agent.c
     2.5 +Index: agent/snmp_agent.c
     2.6 +--- agent/snmp_agent.c.orig
     2.7 ++++ agent/snmp_agent.c
     2.8 +@@ -1535,38 +1535,42 @@ int
     2.9 + netsnmp_remove_delegated_requests_for_session(netsnmp_session *sess)
    2.10 + {
    2.11 +     netsnmp_agent_session *asp;
    2.12 +-    int count = 0;
    2.13 +-    
    2.14 +-    for (asp = agent_delegated_list; asp; asp = asp->next) {
    2.15 +-        /*
    2.16 +-         * check each request
    2.17 +-         */
    2.18 +-        netsnmp_request_info *request;
    2.19 +-        for(request = asp->requests; request; request = request->next) {
    2.20 +-            /*
    2.21 +-             * check session
    2.22 +-             */
    2.23 +-            netsnmp_assert(NULL!=request->subtree);
    2.24 +-            if(request->subtree->session != sess)
    2.25 +-                continue;
    2.26 ++    int count;
    2.27 + 
    2.28 ++    do {
    2.29 ++        count = 0;
    2.30 ++        for (asp = agent_delegated_list; asp; asp = asp->next) {
    2.31 +             /*
    2.32 +-             * matched! mark request as done
    2.33 ++             * check each request
    2.34 +              */
    2.35 +-            netsnmp_request_set_error(request, SNMP_ERR_GENERR);
    2.36 +-            ++count;
    2.37 ++            netsnmp_request_info *request;
    2.38 ++            for(request = asp->requests; request; request = request->next) {
    2.39 ++                /*
    2.40 ++                 * check session
    2.41 ++                 */
    2.42 ++                netsnmp_assert(NULL!=request->subtree);
    2.43 ++                if(request->subtree->session != sess)
    2.44 ++                    continue;
    2.45 ++
    2.46 ++                /*
    2.47 ++                 * matched! mark request as done
    2.48 ++                 */
    2.49 ++                netsnmp_request_set_error(request, SNMP_ERR_GENERR);
    2.50 ++                ++count;
    2.51 ++            }
    2.52 +         }
    2.53 +-    }
    2.54 + 
    2.55 +-    /*
    2.56 +-     * if we found any, that request may be finished now
    2.57 +-     */
    2.58 +-    if(count) {
    2.59 +-        DEBUGMSGTL(("snmp_agent", "removed %d delegated request(s) for session "
    2.60 +-                    "%8p\n", count, sess));
    2.61 +-        netsnmp_check_outstanding_agent_requests();
    2.62 +-    }
    2.63 +-    
    2.64 ++        /*
    2.65 ++         * if we found any, that request may be finished now
    2.66 ++         */
    2.67 ++        if(count) {
    2.68 ++            DEBUGMSGTL(("snmp_agent", "removed %d delegated request(s) for session "
    2.69 ++                        "%8p\n", count, sess));
    2.70 ++            netsnmp_check_outstanding_agent_requests();
    2.71 ++            /* the request may get delegated if it was GETNEXT, retry the loop */
    2.72 ++        }
    2.73 ++    } while (count);
    2.74 ++
    2.75 +     return count;
    2.76 + }
    2.77 + 

mercurial