components/net-snmp/patches/035.15997718-17208688.interface.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 is a combined patch taken from the community merging 2 patches
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
for issues related to incorrect reporting of interface details when 
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
interfaces are changed dynamically. 
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
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
The following are the community bug/patch details.
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
snmpd: BUG: 1400101: remove deleted interfaces from ifTable
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
http://sourceforge.net/p/net-snmp/patches/640/
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
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
snmpd: PATCH: 1849903: from jsafranek: do not spam log with asserts when XEN is 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
    10
http://sourceforge.net/p/net-snmp/patches/872/
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
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
--- net-snmp-5.4.1.old/agent/mibgroup/if-mib/data_access/interface.c	2007-01-22 08:18:29.000000000 -0800
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
+++ net-snmp-5.4.1/agent/mibgroup/if-mib/data_access/interface.c	2013-07-11 13:27:55.792579500 -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
    14
@@ -465,8 +465,13 @@
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
         DEBUGMSGTL(("access:interface:ifIndex", "saved ifIndex %d for %s\n",
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
                     index, name));
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
-    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
    19
-        netsnmp_assert(index == tmp);
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
+    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
    21
+       if(index != tmp) {
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
+         se_remove_value_from_slist("interfaces", name);
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
+         se_add_pair_to_slist("interfaces", strdup(name), index);
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
+         DEBUGMSGTL(("access:interface:ifIndex", "ifname %s, old index %d, already existing, replaced with %d\n", name, tmp, index));
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
+       }      
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
 }
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
 
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
--- net-snmp-5.4.1.old/agent/mibgroup/if-mib/ifTable/ifTable_data_access.c	2007-02-05 07:10:28.000000000 -0800
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
+++ net-snmp-5.4.1/agent/mibgroup/if-mib/ifTable/ifTable_data_access.c	2013-07-11 14:39:08.458138600 -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
    32
@@ -23,6 +23,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
    33
 #   include "mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable.h"
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
 #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
    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
+typedef struct cd_container_s {
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
+    netsnmp_container *current;
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
+    netsnmp_container *deleted;
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
+} cd_container;
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
+
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
+
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
 /*
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
  * flag so we know not to set row/table last change times
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
  * during startup.
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
@@ -158,9 +164,11 @@
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
  */
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
 static 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
    48
 _check_interface_entry_for_updates(ifTable_rowreq_ctx * rowreq_ctx,
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
-                                   netsnmp_container *ifcontainer)
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
+                                   cd_container *cdc)
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
 {
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
     char            oper_changed = 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
    53
+    u_long lastchange = rowreq_ctx->data.ifLastChange;
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
+    netsnmp_container *ifcontainer = cdc->current;
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
      * check for matching entry. We can do this directly, since
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
@@ -192,17 +200,32 @@
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
          * deleted (and thus need to update ifTableLastChanged)?
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
          */
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
         if (!rowreq_ctx->known_missing) {
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
-            DEBUGMSGTL(("ifTable:access", "updating missing entry\n"));
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
             rowreq_ctx->known_missing = 1;
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
+            DEBUGMSGTL(("ifTable:access", "updating missing entry %s\n",rowreq_ctx->data.ifName));
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
             rowreq_ctx->data.ifAdminStatus = IFADMINSTATUS_DOWN;
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
    66
-            if ((!(rowreq_ctx->data.ifentry->ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_LASTCHANGE))
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
    67
-                && (rowreq_ctx->data.ifOperStatus != IFOPERSTATUS_DOWN))
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
    68
-                oper_changed = 1;
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
    69
             rowreq_ctx->data.ifOperStatus = IFOPERSTATUS_DOWN;
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
    70
+            rowreq_ctx->data.ifOperStatus = IFOPERSTATUS_DOWN;
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
    71
+            oper_changed = 1;
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
    72
+        } 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
    73
+            time_t now = netsnmp_get_agent_uptime();
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
    74
+            u_long diff = (now - rowreq_ctx->data.ifLastChange) / 100;
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
    75
+            DEBUGMSGTL(("verbose:ifTable:access", "missing entry for %ld seconds\n", diff));
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
    76
+            if (diff > IFTABLE_REMOVE_MISSING_AFTER) {
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
    77
+                DEBUGMSGTL(("ifTable:access", "marking missing entry %s for "
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
    78
+                            "removal after %d seconds\n", rowreq_ctx->data.ifName,
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
    79
+                            IFTABLE_REMOVE_MISSING_AFTER));
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
    80
+                if (NULL == cdc->deleted)
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
    81
+                   cdc->deleted = netsnmp_container_find("ifTable_deleted:linked_list");
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
    82
+                if (NULL == cdc->deleted)
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
    83
+                   snmp_log(LOG_ERR, "couldn't create container for deleted interface\n");
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
    84
+                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
    85
+                   CONTAINER_INSERT(cdc->deleted, rowreq_ctx);
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
    86
+                }
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
    87
+            }
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
    88
         }
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
    89
     } 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
    90
-        DEBUGMSGTL(("ifTable:access", "updating existing entry\n"));
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
    91
-
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
    92
+        DEBUGMSGTL(("ifTable:access", "updating existing entry %s\n",
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
    93
+                    rowreq_ctx->data.ifName));
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
    94
 #ifdef USING_IF_MIB_IFXTABLE_IFXTABLE_MODULE
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
    95
         {
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
    96
             int rc = strcmp(rowreq_ctx->data.ifName,
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
    97
@@ -245,6 +268,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
    98
      */
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
    99
     if (oper_changed)
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
   100
         rowreq_ctx->data.ifLastChange = netsnmp_get_agent_uptime();
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
   101
+    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
   102
+        rowreq_ctx->data.ifLastChange = lastchange;
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
   103
 
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
   104
 }
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
   105
 
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
   106
@@ -255,8 +280,21 @@
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
   107
 _add_new_interface(netsnmp_interface_entry *ifentry,
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
   108
                    netsnmp_container *container)
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
   109
 {
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
   110
-    ifTable_rowreq_ctx *rowreq_ctx;
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
   111
-
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
   112
+    ifTable_rowreq_ctx *rowreq_ctx, *container_entry;
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
   113
+    netsnmp_iterator *ctxit;
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
   114
+    ctxit = CONTAINER_ITERATOR(container);
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
   115
+    container_entry = ITERATOR_FIRST(ctxit);
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
   116
+
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
   117
+    for(; container_entry; container_entry = ITERATOR_NEXT(ctxit)) {
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
   118
+	if(!strcmp(ifentry->name, container_entry->data.ifName) && \
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
   119
+	    ifentry->index != container_entry->data.ifentry->index) {
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
   120
+		DEBUGMSGTL(("ifTable:access", "removing old entry %s (index %d != %d)\n",
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
   121
+		    container_entry->data.ifName, container_entry->data.ifentry->index, ifentry->index));
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
   122
+		    se_remove_value_from_slist("interfaces", container_entry->data.ifName);
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
   123
+		CONTAINER_REMOVE(container, container_entry);
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
   124
+		ifTable_release_rowreq_ctx(container_entry);
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
   125
+		}
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
   126
+    }
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
   127
     DEBUGMSGTL(("ifTable:access", "creating new entry\n"));
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
   128
 
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
   129
     /*
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
   130
@@ -300,6 +338,21 @@
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
   131
         }
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
   132
     }
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
   133
 }
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
   134
+ 
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
   135
+/**
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
   136
+ * delete removed entry
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
   137
+ */
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
   138
+static 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
   139
+_delete_missing_interface(ifTable_rowreq_ctx *rowreq_ctx,
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
   140
+                          netsnmp_container *container)
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
   141
+{
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
   142
+    DEBUGMSGTL(("ifTable:access", "removing missing entry %s\n",
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
   143
+                rowreq_ctx->data.ifName));
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
   144
+
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
   145
+    CONTAINER_REMOVE(container, rowreq_ctx);
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
   146
+
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
   147
+    ifTable_release_rowreq_ctx(rowreq_ctx);
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
   148
+}
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
   149
 
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
   150
 /**
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
   151
  * container shutdown
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
   152
@@ -365,8 +418,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
   153
 int
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
   154
 ifTable_container_load(netsnmp_container *container)
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
   155
 {
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
   156
-    netsnmp_container *ifcontainer;
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
   157
-
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
   158
+    cd_container cdc;	
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
   159
     DEBUGMSGTL(("verbose:ifTable:ifTable_container_load", "called\n"));
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
   160
 
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
   161
     /*
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
   162
@@ -378,31 +430,42 @@
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
   163
     /*
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
   164
      * ifTable gets its data from the netsnmp_interface API.
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
   165
      */
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
   166
-    ifcontainer =
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
   167
+    cdc.current =
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
   168
         netsnmp_access_interface_container_load(NULL,
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
   169
                                                 NETSNMP_ACCESS_INTERFACE_INIT_NOFLAGS);
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
   170
-    if (NULL == ifcontainer)
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
   171
+    if (NULL == cdc.current)
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
   172
         return MFD_RESOURCE_UNAVAILABLE;        /* msg already logged */
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
   173
 
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
   174
+    cdc.deleted = NULL; /* created as needed */
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
   175
+
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
   176
     /*
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
   177
      * we just got a fresh copy of interface data. compare it to
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
   178
      * what we've already got, and make any adjustements...
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
   179
      */
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
   180
     CONTAINER_FOR_EACH(container, (netsnmp_container_obj_func *)
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
   181
-                       _check_interface_entry_for_updates, ifcontainer);
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
   182
+                       _check_interface_entry_for_updates, &cdc);
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
   183
 
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
   184
     /*
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
   185
      * now add any new interfaces
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
   186
      */
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
   187
-    CONTAINER_FOR_EACH(ifcontainer,
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
   188
+    CONTAINER_FOR_EACH(cdc.current,
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
   189
                        (netsnmp_container_obj_func *) _add_new_interface,
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
   190
                        container);
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
   191
 
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
   192
+
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
   193
+     /*
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
   194
+     * now remove any missing interfaces
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
   195
+     */
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
   196
+    if (NULL != cdc.deleted)
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
   197
+       CONTAINER_FOR_EACH(cdc.deleted,
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
   198
+                          (netsnmp_container_obj_func *) _delete_missing_interface,
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
   199
+                          container);
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
   200
+
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
   201
     /*
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
   202
      * free the container. we've either claimed each ifentry, or released it,
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
   203
      * so the dal function doesn't need to clear the container.
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
   204
      */
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
   205
-    netsnmp_access_interface_container_free(ifcontainer,
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
   206
+    netsnmp_access_interface_container_free(cdc.current,
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
   207
                                             NETSNMP_ACCESS_INTERFACE_FREE_DONT_CLEAR);
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
   208
 
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
   209
     DEBUGMSGT(("verbose:ifTable:ifTable_cache_load",
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
   210
--- net-snmp-5.4.1.old/agent/mibgroup/if-mib/ifTable/ifTable_data_access.h	2006-04-09 21:59:10.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
   211
+++ net-snmp-5.4.1/agent/mibgroup/if-mib/ifTable/ifTable_data_access.h	2013-07-11 13:58:33.862743400 -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
   212
@@ -48,6 +48,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
   213
      */
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
   214
 #define IFTABLE_CACHE_TIMEOUT   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
   215
 
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
   216
+#define IFTABLE_REMOVE_MISSING_AFTER     (5 * 60) /* seconds */
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
   217
+
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
   218
     void            ifTable_container_init(netsnmp_container
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
   219
                                            **container_ptr_ptr,
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
   220
                                            netsnmp_cache * cache);
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
   221
--- net-snmp-5.4.1.old/snmplib/snmp_enum.c	2005-02-09 11:46:35.000000000 -0800
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
   222
+++ net-snmp-5.4.1/snmplib/snmp_enum.c	2013-07-10 04:08:50.542006500 -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
   223
@@ -213,6 +213,28 @@
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
   224
     return SE_DNE;              /* XXX: um, no good solution here */
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
   225
 }
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
   226
 
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
   227
+int se_remove_value_from_list(struct snmp_enum_list **list, const char *label)
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
   228
+{
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
   229
+   struct snmp_enum_list *lastlist;
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
   230
+   if(!list)
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
   231
+     return SE_DNE;
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
   232
+
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
   233
+   lastlist = NULL;
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
   234
+   while(*list) {
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
   235
+      if(strcmp((*list)->label, label) == 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
   236
+	 free((*list)->label);
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
   237
+	 if(lastlist)
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
   238
+	   lastlist->next = (*list)->next;
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
   239
+	 free(*list);
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
   240
+	 *list = NULL;
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
   241
+	 return 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
   242
+      }
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
   243
+      lastlist = *list;
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
   244
+      (*list) = (*list)->next;
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
   245
+   }
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
   246
+   
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
   247
+}
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
   248
+
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
   249
 int
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
   250
 se_find_free_value_in_list(struct snmp_enum_list *list)
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
   251
 {
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
   252
@@ -337,6 +359,19 @@
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
   253
     return (se_find_free_value_in_list(se_find_slist(listname)));
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
   254
 }
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
   255
 
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
   256
+void se_remove_value_from_slist(const char *listname, const char *label)
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
   257
+{
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
   258
+   struct snmp_enum_list_str *sptr, *lastp = NULL;
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
   259
+   struct snmp_enum_list *list;
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
   260
+   if (!listname)
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
   261
+     return;
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
   262
+
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
   263
+   for (sptr = sliststorage;
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
   264
+	sptr != NULL; lastp = sptr, sptr = sptr->next)
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
   265
+     if (sptr->name && strcmp(sptr->name, listname) == 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
   266
+       se_remove_value_from_list(&sptr->list, label);
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
   267
+}
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
   268
+
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
   269
 int
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
   270
 se_add_pair_to_slist(const char *listname, char *label, int value)
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
   271
 {