components/net-snmp/patches/036.16356248.mteTrigger.patch
author Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
Mon, 24 Mar 2014 15:04:05 -0700
branchs11-update
changeset 3004 856505663cc3
permissions -rw-r--r--
15997718 Interface addition/deletion causing frequent error messages in snmpd.log 17208688 MIB II SNMP table data discrepancy for network interfaces 16356248 snmpd unresponsive for 30 seconds after start with monitors set in snmpd.conf 17651108 snmpd dumps core when there are duplicate "exec" entries in snmpd.conf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3004
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
     1
This patch fixes the issue related to delayed response
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
     2
of the snmpd agent when monitors are used.
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
     3
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
     4
This patch is taken from the community for the following bug. 
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
     5
snmpd: PATCH: 1918383: Fix DisMan monitoring of AgentX subagents
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
     6
http://sourceforge.net/p/net-snmp/patches/897/
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
     7
--- net-snmp-5.4.1.old/agent/mibgroup/utilities/iquery.c	2006-10-12 15:21:28.000000000 -0700
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
     8
+++ net-snmp-5.4.1/agent/mibgroup/utilities/iquery.c	2013-07-09 14:39:34.856060200 -0700
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
     9
@@ -159,6 +159,8 @@
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    10
             memdup( &(ss->community), secName, strlen(secName));
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    11
             ss->community_len = strlen(secName);
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    12
         }
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    13
+        ss->myvoid = netsnmp_check_outstanding_agent_requests;
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    14
+        ss->flags |= SNMP_FLAGS_RESP_CALLBACK | SNMP_FLAGS_DONT_PROBE;
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    15
     }
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    16
 #endif
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    17
 
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    18
--- net-snmp-5.4.1.old/include/net-snmp/library/snmp_api.h	2007-03-23 02:44:49.000000000 -0700
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    19
+++ net-snmp-5.4.1/include/net-snmp/library/snmp_api.h	2013-05-08 02:17:51.242309300 -0700
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    20
@@ -300,7 +300,10 @@
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    21
     void           *securityInfo;
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    22
 
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    23
     /**
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    24
-     * use as you want data 
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    25
+     * use as you want data
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    26
+     *
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    27
+     *     used by 'SNMP_FLAGS_RESP_CALLBACK' handling in the agent
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    28
+     * XXX: or should we add a new field into this structure? 
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    29
      */
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    30
     void           *myvoid;
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    31
 };
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    32
@@ -394,6 +397,7 @@
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    33
 
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    34
 #define SNMP_DETAIL_SIZE        512
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    35
 
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    36
+#define SNMP_FLAGS_RESP_CALLBACK   0x400      /* Additional callback on response */
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    37
 #define SNMP_FLAGS_USER_CREATED    0x200      /* USM user has been created */
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    38
 #define SNMP_FLAGS_DONT_PROBE      0x100      /* don't probe for an engineID */
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    39
 #define SNMP_FLAGS_STREAM_SOCKET   0x80
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    40
--- net-snmp-5.4.1.old/snmplib/snmp_client.c	2007-07-03 15:36:42.000000000 -0700
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    41
+++ net-snmp-5.4.1/snmplib/snmp_client.c	2013-07-09 14:48:09.041945100 -0700
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    42
@@ -1014,7 +1014,7 @@
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    43
         count = select(numfds, &fdset, 0, 0, tvp);
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    44
         if (count > 0) {
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    45
             snmp_read(&fdset);
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    46
-        } else
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    47
+        } else {
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    48
             switch (count) {
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    49
             case 0:
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    50
                 snmp_timeout();
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    51
@@ -1040,6 +1040,14 @@
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    52
                 state->status = STAT_ERROR;
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    53
                 state->waiting = 0;
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    54
             }
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    55
+        }
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    56
+
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    57
+        if ( ss->flags & SNMP_FLAGS_RESP_CALLBACK ) {
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    58
+            void (*cb)(void);
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    59
+            cb = ss->myvoid;
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    60
+            cb();        /* Used to invoke 'netsnmp_check_outstanding_agent_requests();'
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    61
+                            on internal AgentX queries.  */
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    62
+        }
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    63
     }
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    64
     *response = state->pdu;
856505663cc3 15997718 Interface addition/deletion causing frequent error messages in snmpd.log
Lijo George - Oracle Corporation - Bangalore India <lijo.x.george@oracle.com>
parents:
diff changeset
    65
     ss->callback = cbsav;