Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 20db51d70e6b59a061db97ce9b89c771 > files > 36

net-snmp-5.3.2.2-14.el5.src.rpm

396141: snmpd spams syslog with _access_interface_entry_save_name and 
        _check_interface_entry_for_updates

Written-By: Jan Safranek <jsafrane@redhat.com>
Reviewed-By: Radek Vokál <rvokal@redhat.com>

1)
When an interface goes down and is re-instantiated with different interface 
index (e.g. when reusing xenbr0 and ppp0 interfaces), net-snmp is not able to 
distinguish, if the interface is the same or it is a new one and asserts.
This assertion is printed every 30 secs and fills up the log file.

This patch writes something more meaningful to the log and writes it only once.

Bugreport upstream: http://sourceforge.net/tracker/index.php?func=detail&aid=1238981&group_id=12694&atid=112694
Related discussion: http://sourceforge.net/mailarchive/message.php?msg_id=20051123222939.GA12173%40rigacci.org
Patch sent upstream: https://sourceforge.net/tracker/?func=detail&atid=312694&aid=1849903&group_id=12694

2)
When an interface with specific ifIndex changes its name, another assert is
printed to log and net-snmp keeps old interface name. This patches prints
something more meaningful and prints it only once.

--- orig/agent/mibgroup/if-mib/data_access/interface.c	2006-01-25 17:26:38.000000000 +0100
+++ net-snmp-5.3.1/agent/mibgroup/if-mib/data_access/interface.c	2007-12-10 15:06:17.000000000 +0100
@@ -463,8 +463,17 @@
         DEBUGMSGTL(("access:interface:ifIndex", "saved ifIndex %d for %s\n",
                     index, name));
     }
-    else
-        netsnmp_assert(index == tmp);
+    else
+        if (index != tmp) {
+            static int logged = 0;
+            if (!logged) {
+                snmp_log(LOG_ERR, "IfIndex of an interface changed. Such " \
+                         "interfaces will appear multiple times in IF-MIB.\n");
+                logged = 1;
+            }
+            DEBUGMSGTL(("access:interface:ifIndex", "index %d != tmp for %s\n",
+                         index, name));
+        }
 }
 
 /**
--- orig/agent/mibgroup/if-mib/ifTable/ifTable_data_access.c	2007-12-11 12:39:12.000000000 +0100
+++ net-snmp-5.3.1/agent/mibgroup/if-mib/ifTable/ifTable_data_access.c	2007-12-11 12:44:40.000000000 +0100
@@ -205,9 +205,18 @@
 #ifdef USING_IF_MIB_IFXTABLE_IFXTABLE_MODULE
         {
             int rc = strcmp(rowreq_ctx->data.ifName,
-                            ifentry->name);
-            netsnmp_assert(rc == 0);
-        }
+                            ifentry->name);
+            if (rc != 0) {
+                static int logged = 0;
+                if (!logged) {
+                    snmp_log(LOG_ERR, "Name of an interface changed. Such " \
+                        "interfaces will keep its old name in IF-MIB.\n");
+                    logged = 1;
+                }
+                DEBUGMSGTL(("ifTable:access", "interface %s changed name to %s, ignoring\n",
+                    rowreq_ctx->data.ifName, ifentry->name));
+            }
+        }
 #endif
         /*
          * if the interface was missing, but came back, clear the