snmp/snmp_agentx.patch

Thu, 04 Oct 2012 20:30:05 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 04 Oct 2012 20:30:05 +0200
changeset 715
c10fb90893b9
permissions
-rw-r--r--

Correct out of date build configuration, porting to Solaris 11 network
link infrastructure and new libpcap logic. This additionally allows for
device drivers in subdirectories of /dev. Correct packaged nmap
personalities and signatures to work out of the box. Finally, hack
arpd logic to properly close sockets and quit on TERM by repeating
signaling in the run command script. Sadly, all this fails to correct
the run time behaviour of honeyd which fails to bind to the IP layer.

     1 diff Nau agent/snmp_agent.c.orig agent/snmp_agent.c
     2 Index: agent/snmp_agent.c
     3 --- agent/snmp_agent.c.orig
     4 +++ agent/snmp_agent.c
     5 @@ -1535,38 +1535,42 @@ int
     6  netsnmp_remove_delegated_requests_for_session(netsnmp_session *sess)
     7  {
     8      netsnmp_agent_session *asp;
     9 -    int count = 0;
    10 -    
    11 -    for (asp = agent_delegated_list; asp; asp = asp->next) {
    12 -        /*
    13 -         * check each request
    14 -         */
    15 -        netsnmp_request_info *request;
    16 -        for(request = asp->requests; request; request = request->next) {
    17 -            /*
    18 -             * check session
    19 -             */
    20 -            netsnmp_assert(NULL!=request->subtree);
    21 -            if(request->subtree->session != sess)
    22 -                continue;
    23 +    int count;
    25 +    do {
    26 +        count = 0;
    27 +        for (asp = agent_delegated_list; asp; asp = asp->next) {
    28              /*
    29 -             * matched! mark request as done
    30 +             * check each request
    31               */
    32 -            netsnmp_request_set_error(request, SNMP_ERR_GENERR);
    33 -            ++count;
    34 +            netsnmp_request_info *request;
    35 +            for(request = asp->requests; request; request = request->next) {
    36 +                /*
    37 +                 * check session
    38 +                 */
    39 +                netsnmp_assert(NULL!=request->subtree);
    40 +                if(request->subtree->session != sess)
    41 +                    continue;
    42 +
    43 +                /*
    44 +                 * matched! mark request as done
    45 +                 */
    46 +                netsnmp_request_set_error(request, SNMP_ERR_GENERR);
    47 +                ++count;
    48 +            }
    49          }
    50 -    }
    52 -    /*
    53 -     * if we found any, that request may be finished now
    54 -     */
    55 -    if(count) {
    56 -        DEBUGMSGTL(("snmp_agent", "removed %d delegated request(s) for session "
    57 -                    "%8p\n", count, sess));
    58 -        netsnmp_check_outstanding_agent_requests();
    59 -    }
    60 -    
    61 +        /*
    62 +         * if we found any, that request may be finished now
    63 +         */
    64 +        if(count) {
    65 +            DEBUGMSGTL(("snmp_agent", "removed %d delegated request(s) for session "
    66 +                        "%8p\n", count, sess));
    67 +            netsnmp_check_outstanding_agent_requests();
    68 +            /* the request may get delegated if it was GETNEXT, retry the loop */
    69 +        }
    70 +    } while (count);
    71 +
    72      return count;
    73  }

mercurial