Sophie

Sophie

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

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

504742: [5.3] A large amount of error messages of snmp are output

Source: upstream, SVN rev. 17738

I added the CONTAINER_TRY_INSERT to hide 'error on subcontainer 'dr_addr' insert' error
(upstream introduced different approach in later versions)

diff -up net-snmp-5.3.2.2/agent/mibgroup/ip-mib/data_access/defaultrouter_linux.c.defaultroute-loop net-snmp-5.3.2.2/agent/mibgroup/ip-mib/data_access/defaultrouter_linux.c
--- net-snmp-5.3.2.2/agent/mibgroup/ip-mib/data_access/defaultrouter_linux.c.defaultroute-loop	2009-11-12 13:45:59.000000000 +0100
+++ net-snmp-5.3.2.2/agent/mibgroup/ip-mib/data_access/defaultrouter_linux.c	2009-11-12 15:03:23.000000000 +0100
@@ -288,13 +288,12 @@ _load(netsnmp_container *container)
                 entry->dr_lifetime    = lifetime;
                 entry->dr_preference  = preference;
 
-                if (CONTAINER_INSERT(container, entry) < 0)
+                if (CONTAINER_TRY_INSERT(container, entry) < 0)
                 {
                     DEBUGMSGTL(("access:arp:container",
                                 "error with defaultrouter_entry: "
                                 "insert into container failed.\n"));
                     netsnmp_access_defaultrouter_entry_free(entry);
-                    continue;
                 }
             }
 
diff -up net-snmp-5.3.2.2/agent/mibgroup/ip-forward-mib/data_access/route_linux.c.default net-snmp-5.3.2.2/agent/mibgroup/ip-forward-mib/data_access/route_linux.c
--- net-snmp-5.3.2.2/agent/mibgroup/ip-forward-mib/data_access/route_linux.c.default	2009-12-14 15:55:20.000000000 +0100
+++ net-snmp-5.3.2.2/agent/mibgroup/ip-forward-mib/data_access/route_linux.c	2009-12-14 15:55:25.000000000 +0100
@@ -184,7 +184,7 @@ _load_ipv4(netsnmp_container* container,
         /*
          * insert into container
          */
-        if (CONTAINER_INSERT(container, entry) < 0)
+        if (CONTAINER_TRY_INSERT(container, entry) < 0)
         {
             DEBUGMSGTL(("access:route:container", "error with route_entry: insert into container failed.\n"));
             netsnmp_access_route_entry_free(entry);
diff -up net-snmp-5.3.2.2/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_data_access.c.default net-snmp-5.3.2.2/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_data_access.c
--- net-snmp-5.3.2.2/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_data_access.c.default	2009-12-14 16:37:17.000000000 +0100
+++ net-snmp-5.3.2.2/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_data_access.c	2009-12-14 16:39:16.000000000 +0100
@@ -143,7 +143,7 @@ _snarf_route_entry(netsnmp_route_entry *
                    netsnmp_container *container)
 {
     ipCidrRouteTable_rowreq_ctx *rowreq_ctx;
-
+    int ret;
     DEBUGTRACE;
 
     netsnmp_assert(NULL != route_entry);
@@ -159,8 +159,11 @@ _snarf_route_entry(netsnmp_route_entry *
          (rowreq_ctx, *((u_long *) route_entry->rt_dest),
           route_entry->rt_mask, route_entry->rt_tos,
           *((u_long *) route_entry->rt_nexthop)))) {
-        CONTAINER_INSERT(container, rowreq_ctx);
-        rowreq_ctx->ipCidrRouteStatus = ROWSTATUS_ACTIVE;
+        ret = CONTAINER_TRY_INSERT(container, rowreq_ctx);
+        if (ret < 0)
+            ipCidrRouteTable_release_rowreq_ctx(rowreq_ctx);
+        else
+            rowreq_ctx->ipCidrRouteStatus = ROWSTATUS_ACTIVE;
     } else {
         if (rowreq_ctx) {
             snmp_log(LOG_ERR, "error setting index while loading "
diff -up net-snmp-5.3.2.2/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_data_access.c.new net-snmp-5.3.2.2/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_data_access.c
--- net-snmp-5.3.2.2/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_data_access.c.new	2009-12-15 12:35:29.000000000 +0100
+++ net-snmp-5.3.2.2/agent/mibgroup/ip-mib/ipv6ScopeZoneIndexTable/ipv6ScopeZoneIndexTable_data_access.c	2009-12-15 12:50:16.000000000 +0100
@@ -158,6 +158,7 @@ _snarf_zoneindex_entry(netsnmp_v6scopezo
                        netsnmp_container *container)
 {
     ipv6ScopeZoneIndexTable_rowreq_ctx *rowreq_ctx;
+    int ret;
 
     DEBUGTRACE;
     netsnmp_assert(NULL != scopezone_entry);
@@ -166,7 +167,9 @@ _snarf_zoneindex_entry(netsnmp_v6scopezo
     if ((NULL != rowreq_ctx) &&
          (MFD_SUCCESS == ipv6ScopeZoneIndexTable_indexes_set
          (rowreq_ctx, rowreq_ctx->data->index))) {
-        CONTAINER_INSERT(container, rowreq_ctx);
+        ret = CONTAINER_TRY_INSERT(container, rowreq_ctx);
+        if (ret < 0)
+            ipv6ScopeZoneIndexTable_release_rowreq_ctx(rowreq_ctx);
     } else {
        if (rowreq_ctx) {
             snmp_log(LOG_ERR, "error setting index while loading "