Mon, 28 Jan 2013 17:37:18 +0100
Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.
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 }