diff options
Diffstat (limited to 'debian/patches/dropped_25_duplicate_iftable.patch')
-rw-r--r-- | debian/patches/dropped_25_duplicate_iftable.patch | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/debian/patches/dropped_25_duplicate_iftable.patch b/debian/patches/dropped_25_duplicate_iftable.patch new file mode 100644 index 0000000..6d2e841 --- /dev/null +++ b/debian/patches/dropped_25_duplicate_iftable.patch @@ -0,0 +1,115 @@ +Patch from +http://sourceforge.net/tracker/index.php?func=detail&aid=1513191&group_id=12694&atid=312694 : + +This patch fixes bug #1238981 for me. If a new device +will be added, the old device are first checked. If +there's an old device with the same name is found, the +old device is removed from the list. This fixes the +problem that i have tons of ppp0 interfaces in the +snmpd ifTable. + +Signed-of-by: Sven Schnelle <svens@gmx.de> + +-> not applied to current code. need to investigate more + Hideki Yamane <henrich@debian.org> + + +diff -ru net-snmp-5.4.2.1.orig/agent/mibgroup/if-mib/data_access/interface.c net-snmp-5.4.2.1/agent/mibgroup/if-mib/data_access/interface.c +--- net-snmp-5.4.2.1.orig/agent/mibgroup/if-mib/data_access/interface.c 2008-02-23 00:52:33.000000000 +0100 ++++ net-snmp-5.4.2.1/agent/mibgroup/if-mib/data_access/interface.c 2009-07-31 17:10:49.000000000 +0200 +@@ -469,12 +469,12 @@ + 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"); ++ snmp_log(LOG_ERR, "IfIndex of an interface changed.\n"); + logged = 1; + } +- DEBUGMSGTL(("access:interface:ifIndex", "index %d != tmp for %s\n", +- index, name)); ++ se_remove_value_from_slist("interfaces", name); ++ se_add_pair_to_slist("interfaces", strdup(name), index); ++ DEBUGMSGTL(("access:interface:ifIndex", "ifname %s, old index %d, already existing, replaced with %d\n", name, tmp, index)); + } + } + +diff -ru net-snmp-5.4.2.1.orig/agent/mibgroup/if-mib/ifTable/ifTable_data_access.c net-snmp-5.4.2.1/agent/mibgroup/if-mib/ifTable/ifTable_data_access.c +--- net-snmp-5.4.2.1.orig/agent/mibgroup/if-mib/ifTable/ifTable_data_access.c 2008-02-12 20:05:24.000000000 +0100 ++++ net-snmp-5.4.2.1/agent/mibgroup/if-mib/ifTable/ifTable_data_access.c 2009-07-31 17:04:17.000000000 +0200 +@@ -266,8 +266,21 @@ + _add_new_interface(netsnmp_interface_entry *ifentry, + netsnmp_container *container) + { +- ifTable_rowreq_ctx *rowreq_ctx; +- ++ ifTable_rowreq_ctx *rowreq_ctx, *container_entry; ++ netsnmp_iterator *ctxit; ++ ctxit = CONTAINER_ITERATOR(container); ++ container_entry = ITERATOR_FIRST(ctxit); ++ ++ for(; container_entry; container_entry = ITERATOR_NEXT(ctxit)) { ++ if(!strcmp(ifentry->name, container_entry->data.ifName) && \ ++ ifentry->index != container_entry->data.ifentry->index) { ++ DEBUGMSGTL(("ifTable:access", "removing old entry %s (index %d != %d)\n", ++ container_entry->data.ifName, container_entry->data.ifentry->index, ifentry->index)); ++ se_remove_value_from_slist("interfaces", container_entry->data.ifName); ++ CONTAINER_REMOVE(container, container_entry); ++ ifTable_release_rowreq_ctx(container_entry); ++ } ++ } + DEBUGMSGTL(("ifTable:access", "creating new entry\n")); + + /* +Nur in net-snmp-5.4.2.1/agent/mibgroup/if-mib/ifTable: ifTable_data_access.c.orig. +diff -ru net-snmp-5.4.2.1.orig/snmplib/snmp_enum.c net-snmp-5.4.2.1/snmplib/snmp_enum.c +--- net-snmp-5.4.2.1.orig/snmplib/snmp_enum.c 2005-02-09 20:46:35.000000000 +0100 ++++ net-snmp-5.4.2.1/snmplib/snmp_enum.c 2009-07-31 17:04:17.000000000 +0200 +@@ -213,6 +213,27 @@ + return SE_DNE; /* XXX: um, no good solution here */ + } + ++int se_remove_value_from_list(struct snmp_enum_list **list, const char *label) ++{ ++ struct snmp_enum_list *lastlist; ++ if(!list) ++ return SE_DNE; ++ ++ lastlist = NULL; ++ while(*list) { ++ if(strcmp((*list)->label, label) == 0) { ++ free((*list)->label); ++ if(lastlist) ++ lastlist->next = (*list)->next; ++ free(*list); ++ *list = NULL; ++ return 0; ++ } ++ lastlist = *list; ++ (*list) = (*list)->next; ++ } ++ ++} + int + se_find_free_value_in_list(struct snmp_enum_list *list) + { +@@ -331,6 +352,19 @@ + return (se_find_value_in_list(se_find_slist(listname), label)); + } + ++void se_remove_value_from_slist(const char *listname, const char *label) ++{ ++ struct snmp_enum_list_str *sptr, *lastp = NULL; ++ struct snmp_enum_list *list; ++ if (!listname) ++ return; ++ ++ for (sptr = sliststorage; ++ sptr != NULL; lastp = sptr, sptr = sptr->next) ++ if (sptr->name && strcmp(sptr->name, listname) == 0) ++ se_remove_value_from_list(&sptr->list, label); ++} ++ + int + se_find_free_value_in_slist(const char *listname) + { |