components/net-snmp/patches/035.15997718-17208688.interface.patch
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Mon, 23 Mar 2015 20:28:41 -0700
changeset 4011 5a309c9572e8
parent 1733 01e7b01b604b
permissions -rw-r--r--
Close of build 71.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1733
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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 
01e7b01b604b 15997718 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. 
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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.
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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/
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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/
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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 @@
01e7b01b604b 15997718 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",
01e7b01b604b 15997718 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));
01e7b01b604b 15997718 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
     }
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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);
01e7b01b604b 15997718 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 {
01e7b01b604b 15997718 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) {
01e7b01b604b 15997718 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);
01e7b01b604b 15997718 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);
01e7b01b604b 15997718 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));
01e7b01b604b 15997718 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
+       }      
01e7b01b604b 15997718 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
+    }
01e7b01b604b 15997718 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
 }
01e7b01b604b 15997718 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
 
01e7b01b604b 15997718 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
 /**
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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 @@
01e7b01b604b 15997718 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"
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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
 
01e7b01b604b 15997718 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 {
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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
+
01e7b01b604b 15997718 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
+
01e7b01b604b 15997718 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
 /*
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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.
01e7b01b604b 15997718 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 @@
01e7b01b604b 15997718 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
  */
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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,
01e7b01b604b 15997718 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)
01e7b01b604b 15997718 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)
01e7b01b604b 15997718 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
 {
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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
 
01e7b01b604b 15997718 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
     /*
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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 @@
01e7b01b604b 15997718 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)?
01e7b01b604b 15997718 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
          */
01e7b01b604b 15997718 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) {
01e7b01b604b 15997718 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"));
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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));
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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))
01e7b01b604b 15997718 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))
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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 {
01e7b01b604b 15997718 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();
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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));
01e7b01b604b 15997718 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) {
01e7b01b604b 15997718 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 "
01e7b01b604b 15997718 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,
01e7b01b604b 15997718 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));
01e7b01b604b 15997718 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)
01e7b01b604b 15997718 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");
01e7b01b604b 15997718 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)
01e7b01b604b 15997718 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");
01e7b01b604b 15997718 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 {
01e7b01b604b 15997718 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);
01e7b01b604b 15997718 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
+                }
01e7b01b604b 15997718 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
+            }
01e7b01b604b 15997718 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
         }
01e7b01b604b 15997718 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 {
01e7b01b604b 15997718 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"));
01e7b01b604b 15997718 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
-
01e7b01b604b 15997718 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",
01e7b01b604b 15997718 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));
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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
         {
01e7b01b604b 15997718 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,
01e7b01b604b 15997718 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 @@
01e7b01b604b 15997718 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
      */
01e7b01b604b 15997718 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)
01e7b01b604b 15997718 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();
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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
 
01e7b01b604b 15997718 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
 }
01e7b01b604b 15997718 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
 
01e7b01b604b 15997718 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 @@
01e7b01b604b 15997718 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,
01e7b01b604b 15997718 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)
01e7b01b604b 15997718 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
 {
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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
-
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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);
01e7b01b604b 15997718 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);
01e7b01b604b 15997718 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
+
01e7b01b604b 15997718 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)) {
01e7b01b604b 15997718 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) && \
01e7b01b604b 15997718 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) {
01e7b01b604b 15997718 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",
01e7b01b604b 15997718 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));
01e7b01b604b 15997718 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);
01e7b01b604b 15997718 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);
01e7b01b604b 15997718 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);
01e7b01b604b 15997718 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
+		}
01e7b01b604b 15997718 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
+    }
01e7b01b604b 15997718 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"));
01e7b01b604b 15997718 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
 
01e7b01b604b 15997718 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
     /*
01e7b01b604b 15997718 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 @@
01e7b01b604b 15997718 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
         }
01e7b01b604b 15997718 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
     }
01e7b01b604b 15997718 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
 }
01e7b01b604b 15997718 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
+ 
01e7b01b604b 15997718 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
+/**
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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
+ */
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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,
01e7b01b604b 15997718 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)
01e7b01b604b 15997718 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
+{
01e7b01b604b 15997718 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",
01e7b01b604b 15997718 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));
01e7b01b604b 15997718 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
+
01e7b01b604b 15997718 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);
01e7b01b604b 15997718 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
+
01e7b01b604b 15997718 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);
01e7b01b604b 15997718 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
+}
01e7b01b604b 15997718 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
 
01e7b01b604b 15997718 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
 /**
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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 @@
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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)
01e7b01b604b 15997718 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
 {
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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
-
01e7b01b604b 15997718 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;	
01e7b01b604b 15997718 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"));
01e7b01b604b 15997718 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
 
01e7b01b604b 15997718 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
     /*
01e7b01b604b 15997718 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 @@
01e7b01b604b 15997718 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
     /*
01e7b01b604b 15997718 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.
01e7b01b604b 15997718 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
      */
01e7b01b604b 15997718 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 =
01e7b01b604b 15997718 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 =
01e7b01b604b 15997718 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,
01e7b01b604b 15997718 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);
01e7b01b604b 15997718 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)
01e7b01b604b 15997718 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)
01e7b01b604b 15997718 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 */
01e7b01b604b 15997718 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
 
01e7b01b604b 15997718 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 */
01e7b01b604b 15997718 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
+
01e7b01b604b 15997718 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
     /*
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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...
01e7b01b604b 15997718 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
      */
01e7b01b604b 15997718 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 *)
01e7b01b604b 15997718 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);
01e7b01b604b 15997718 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);
01e7b01b604b 15997718 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
 
01e7b01b604b 15997718 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
     /*
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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
      */
01e7b01b604b 15997718 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,
01e7b01b604b 15997718 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,
01e7b01b604b 15997718 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,
01e7b01b604b 15997718 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);
01e7b01b604b 15997718 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
 
01e7b01b604b 15997718 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
+
01e7b01b604b 15997718 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
+     /*
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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
+     */
01e7b01b604b 15997718 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)
01e7b01b604b 15997718 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,
01e7b01b604b 15997718 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,
01e7b01b604b 15997718 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);
01e7b01b604b 15997718 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
+
01e7b01b604b 15997718 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
     /*
01e7b01b604b 15997718 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,
01e7b01b604b 15997718 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.
01e7b01b604b 15997718 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
      */
01e7b01b604b 15997718 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,
01e7b01b604b 15997718 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,
01e7b01b604b 15997718 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);
01e7b01b604b 15997718 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
 
01e7b01b604b 15997718 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",
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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 @@
01e7b01b604b 15997718 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
      */
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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
 
01e7b01b604b 15997718 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 */
01e7b01b604b 15997718 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
+
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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,
01e7b01b604b 15997718 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);
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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 @@
01e7b01b604b 15997718 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 */
01e7b01b604b 15997718 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
 }
01e7b01b604b 15997718 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
 
01e7b01b604b 15997718 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)
01e7b01b604b 15997718 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
+{
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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)
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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
+
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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) {
01e7b01b604b 15997718 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) {
01e7b01b604b 15997718 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);
01e7b01b604b 15997718 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)
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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);
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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
+      }
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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
+   }
01e7b01b604b 15997718 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
+   
01e7b01b604b 15997718 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
+}
01e7b01b604b 15997718 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
+
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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)
01e7b01b604b 15997718 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
 {
01e7b01b604b 15997718 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 @@
01e7b01b604b 15997718 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)));
01e7b01b604b 15997718 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
 }
01e7b01b604b 15997718 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
 
01e7b01b604b 15997718 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)
01e7b01b604b 15997718 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
+{
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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)
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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
+
01e7b01b604b 15997718 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;
01e7b01b604b 15997718 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)
01e7b01b604b 15997718 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)
01e7b01b604b 15997718 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);
01e7b01b604b 15997718 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
+}
01e7b01b604b 15997718 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
+
01e7b01b604b 15997718 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
01e7b01b604b 15997718 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)
01e7b01b604b 15997718 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
 {