snmp/snmp_agentx.patch

Wed, 08 Feb 2012 20:07:00 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 08 Feb 2012 20:07:00 +0200
changeset 588
300d43423c2e
permissions
-rw-r--r--

Update version, adapt patch, correct PID writing, correct build on newer
FreeBSD releases, and most importantly introduce new patch to try to
avoid segfault caused by multiple network interfaces with the same (or
no) address. This is common when configuring bridges and tunnels.

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

mercurial