diff -up net-snmp-5.4.1/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.c.backup_patch_13 net-snmp-5.4.1/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.c --- net-snmp-5.4.1/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.c.backup_patch_13 2007-05-17 23:53:28.000000000 +0200 +++ net-snmp-5.4.1/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.c 2008-07-25 12:53:42.000000000 +0200 @@ -272,11 +272,15 @@ _netsnmp_ioctl_ipaddress_container_load_ /* * add entry to container */ - if (CONTAINER_INSERT(container, entry) < 0) - { - DEBUGMSGTL(("access:ipaddress:container","error with ipaddress_entry: insert into container failed.\n")); + rc = CONTAINER_TRY_INSERT(container, entry); + if (rc < 0) { + static int logged = 0; + if (!logged) { + snmp_log(LOG_NOTICE, "Duplicate IP address detected, some interfaces may not be visible in IP-MIB\n"); + logged = 1; + } + rc = 0; netsnmp_access_ipaddress_entry_free(entry); - continue; } } diff -up net-snmp-5.4.1/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c.backup_patch_13 net-snmp-5.4.1/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c --- net-snmp-5.4.1/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c.backup_patch_13 2006-09-15 02:48:50.000000000 +0200 +++ net-snmp-5.4.1/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c 2008-07-25 12:53:42.000000000 +0200 @@ -324,7 +324,16 @@ _load_v6(netsnmp_container *container, i /* * add entry to container */ - CONTAINER_INSERT(container, entry); + rc = CONTAINER_TRY_INSERT(container, entry); + if (rc < 0) { + static int logged = 0; + if (!logged) { + snmp_log(LOG_NOTICE, "Duplicate IP address detected, some interfaces may not be visible in IP-MIB\n"); + logged = 1; + } + netsnmp_access_ipaddress_entry_free(entry); + } + } fclose(in); diff -up net-snmp-5.4.1/include/net-snmp/library/container.h.backup_patch_13 net-snmp-5.4.1/include/net-snmp/library/container.h --- net-snmp-5.4.1/include/net-snmp/library/container.h.backup_patch_13 2005-12-04 19:43:04.000000000 +0100 +++ net-snmp-5.4.1/include/net-snmp/library/container.h 2008-07-25 12:53:42.000000000 +0200 @@ -370,8 +370,32 @@ extern "C" { } } return rc; + } + + NETSNMP_STATIC_INLINE + int CONTAINER_TRY_INSERT(netsnmp_container *x, const void *k) + { + const void *res = NULL; + + netsnmp_container *start; + /** start at first container */ + while(x->prev) + x = x->prev; + + start = x; + + for(; x; x = x->next) { + if ((NULL != x->insert_filter) && + (x->insert_filter(x,k) == 1)) + continue; + res = x->find(x,k); + if (res) { + return -1; + } + } + return CONTAINER_INSERT(start, k); } - + /*------------------------------------------------------------------ * These functions should EXACTLY match the function version in * container.c. If you change one, change them both. diff -up net-snmp-5.4.1/snmplib/container.c.backup_patch_13 net-snmp-5.4.1/snmplib/container.c --- net-snmp-5.4.1/snmplib/container.c.backup_patch_13 2006-08-25 11:41:06.000000000 +0200 +++ net-snmp-5.4.1/snmplib/container.c 2008-07-25 12:53:42.000000000 +0200 @@ -286,6 +286,29 @@ int CONTAINER_INSERT(netsnmp_container * return rc; } +int CONTAINER_TRY_INSERT(netsnmp_container *x, const void *k) +{ + const void *res = NULL; + + netsnmp_container *start; + /** start at first container */ + while(x->prev) + x = x->prev; + + start = x; + + for(; x; x = x->next) { + if ((NULL != x->insert_filter) && + (x->insert_filter(x,k) == 1)) + continue; + res = x->find(x,k); + if (res) { + return -1; + } + } + return CONTAINER_INSERT(start, k); +} + /*------------------------------------------------------------------ * These functions should EXACTLY match the inline version in * container.h. If you change one, change them both.