|
1 This patch fixes the issue related to delayed response |
|
2 of the snmpd agent when monitors are used. |
|
3 |
|
4 This patch is taken from the community for the following bug. |
|
5 snmpd: PATCH: 1918383: Fix DisMan monitoring of AgentX subagents |
|
6 http://sourceforge.net/p/net-snmp/patches/897/ |
|
7 --- net-snmp-5.4.1.old/agent/mibgroup/utilities/iquery.c 2006-10-12 15:21:28.000000000 -0700 |
|
8 +++ net-snmp-5.4.1/agent/mibgroup/utilities/iquery.c 2013-07-09 14:39:34.856060200 -0700 |
|
9 @@ -159,6 +159,8 @@ |
|
10 memdup( &(ss->community), secName, strlen(secName)); |
|
11 ss->community_len = strlen(secName); |
|
12 } |
|
13 + ss->myvoid = netsnmp_check_outstanding_agent_requests; |
|
14 + ss->flags |= SNMP_FLAGS_RESP_CALLBACK | SNMP_FLAGS_DONT_PROBE; |
|
15 } |
|
16 #endif |
|
17 |
|
18 --- net-snmp-5.4.1.old/include/net-snmp/library/snmp_api.h 2007-03-23 02:44:49.000000000 -0700 |
|
19 +++ net-snmp-5.4.1/include/net-snmp/library/snmp_api.h 2013-05-08 02:17:51.242309300 -0700 |
|
20 @@ -300,7 +300,10 @@ |
|
21 void *securityInfo; |
|
22 |
|
23 /** |
|
24 - * use as you want data |
|
25 + * use as you want data |
|
26 + * |
|
27 + * used by 'SNMP_FLAGS_RESP_CALLBACK' handling in the agent |
|
28 + * XXX: or should we add a new field into this structure? |
|
29 */ |
|
30 void *myvoid; |
|
31 }; |
|
32 @@ -394,6 +397,7 @@ |
|
33 |
|
34 #define SNMP_DETAIL_SIZE 512 |
|
35 |
|
36 +#define SNMP_FLAGS_RESP_CALLBACK 0x400 /* Additional callback on response */ |
|
37 #define SNMP_FLAGS_USER_CREATED 0x200 /* USM user has been created */ |
|
38 #define SNMP_FLAGS_DONT_PROBE 0x100 /* don't probe for an engineID */ |
|
39 #define SNMP_FLAGS_STREAM_SOCKET 0x80 |
|
40 --- net-snmp-5.4.1.old/snmplib/snmp_client.c 2007-07-03 15:36:42.000000000 -0700 |
|
41 +++ net-snmp-5.4.1/snmplib/snmp_client.c 2013-07-09 14:48:09.041945100 -0700 |
|
42 @@ -1014,7 +1014,7 @@ |
|
43 count = select(numfds, &fdset, 0, 0, tvp); |
|
44 if (count > 0) { |
|
45 snmp_read(&fdset); |
|
46 - } else |
|
47 + } else { |
|
48 switch (count) { |
|
49 case 0: |
|
50 snmp_timeout(); |
|
51 @@ -1040,6 +1040,14 @@ |
|
52 state->status = STAT_ERROR; |
|
53 state->waiting = 0; |
|
54 } |
|
55 + } |
|
56 + |
|
57 + if ( ss->flags & SNMP_FLAGS_RESP_CALLBACK ) { |
|
58 + void (*cb)(void); |
|
59 + cb = ss->myvoid; |
|
60 + cb(); /* Used to invoke 'netsnmp_check_outstanding_agent_requests();' |
|
61 + on internal AgentX queries. */ |
|
62 + } |
|
63 } |
|
64 *response = state->pdu; |
|
65 ss->callback = cbsav; |