Blame SOURCES/net-snmp-5.7.2-smux-logging.patch

9a6c41
Bug 1140234 - unexpected messages in log while smux processing
9a6c41
Bug 1189393 - unexpected messages in log while smux processing
9a6c41
9a6c41
Backported from:
9a6c41
9a6c41
commit 75d17a242e524e66b6c8214f68dc9920d5bd59df
9a6c41
Author: Jan Safranek <jsafranek@users.sourceforge.net>
9a6c41
Date:   Fri Jan 30 11:29:53 2015 +0100
9a6c41
9a6c41
    CHANGES: snmpd: Remove some log messages from SMUX processing.
9a6c41
    
9a6c41
    These messages are not useful to system admin and only makes system log unreadable. Let's move them to debug level.
9a6c41
9a6c41
diff -up net-snmp-5.7.2/agent/mibgroup/smux/smux.c.smux-logging net-snmp-5.7.2/agent/mibgroup/smux/smux.c
9a6c41
--- net-snmp-5.7.2/agent/mibgroup/smux/smux.c.smux-logging	2015-06-18 10:49:01.165899644 +0200
9a6c41
+++ net-snmp-5.7.2/agent/mibgroup/smux/smux.c	2015-06-18 10:50:01.650157657 +0200
9a6c41
@@ -536,8 +536,8 @@ var_smux_write(int action,
9a6c41
 
9a6c41
             if (buf[0] == SMUX_TRAP) {
9a6c41
                 DEBUGMSGTL(("smux", "[var_smux_write] Received trap\n"));
9a6c41
-                snmp_log(LOG_INFO, "Got trap from peer on fd %d\n",
9a6c41
-                         rptr->sr_fd);
9a6c41
+                DEBUGMSGTL(("smux", "Got trap from peer on fd %d\n",
9a6c41
+                         rptr->sr_fd));
9a6c41
                 ptr = asn_parse_header(buf, &len, &type);
9a6c41
                 smux_trap_process(ptr, &len;;
9a6c41
 
9a6c41
@@ -646,9 +646,9 @@ smux_accept(int sd)
9a6c41
         snmp_log_perror("[smux_accept] accept failed");
9a6c41
         return -1;
9a6c41
     } else {
9a6c41
-        snmp_log(LOG_INFO, "[smux_accept] accepted fd %d from %s:%d\n",
9a6c41
+    	DEBUGMSGTL(("smux", "[smux_accept] accepted fd %d from %s:%d\n",
9a6c41
                  fd, inet_ntoa(in_socket.sin_addr),
9a6c41
-                 ntohs(in_socket.sin_port));
9a6c41
+                 ntohs(in_socket.sin_port)));
9a6c41
         if (npeers + 1 == SMUXMAXPEERS) {
9a6c41
             snmp_log(LOG_ERR,
9a6c41
                      "[smux_accept] denied peer on fd %d, limit %d reached",
9a6c41
@@ -747,7 +747,8 @@ smux_process(int fd)
9a6c41
 
9a6c41
     if (length <= 0)
9a6c41
     {
9a6c41
-       snmp_log_perror("[smux_process] peek failed");
9a6c41
+       if (length < 0)
9a6c41
+    	   snmp_log_perror("[smux_process] peek failed");
9a6c41
        smux_peer_cleanup(fd);
9a6c41
        return -1;
9a6c41
     }
9a6c41
@@ -837,7 +838,7 @@ smux_pdu_process(int fd, u_char * data,
9a6c41
             DEBUGMSGTL(("smux", "This shouldn't have happened!\n"));
9a6c41
             break;
9a6c41
         case SMUX_TRAP:
9a6c41
-            snmp_log(LOG_INFO, "Got trap from peer on fd %d\n", fd);
9a6c41
+        	DEBUGMSGTL(("smux", "Got trap from peer on fd %d\n", fd));
9a6c41
             if (ptr)
9a6c41
             {
9a6c41
                DEBUGMSGTL(("smux", "[smux_pdu_process] call smux_trap_process.\n"));
9a6c41
@@ -943,9 +944,9 @@ smux_open_process(int fd, u_char * ptr,
9a6c41
         *fail = TRUE;
9a6c41
         return ptr;
9a6c41
     }
9a6c41
-    snmp_log(LOG_INFO,
9a6c41
+    DEBUGMSGTL(("smux",
9a6c41
              "accepted smux peer: oid %s, descr %s\n",
9a6c41
-             oid_print, descr);
9a6c41
+             oid_print, descr));
9a6c41
     *fail = FALSE;
9a6c41
     return ptr;
9a6c41
 }
9a6c41
@@ -1538,7 +1539,7 @@ smux_snmp_process(int exact,
9a6c41
 
9a6c41
         if (result[0] == SMUX_TRAP) {
9a6c41
             DEBUGMSGTL(("smux", "[smux_snmp_process] Received trap\n"));
9a6c41
-            snmp_log(LOG_INFO, "Got trap from peer on fd %d\n", sd);
9a6c41
+            DEBUGMSGTL(("smux", "Got trap from peer on fd %d\n", sd));
9a6c41
             ptr = asn_parse_header(result, (size_t *) &length, &type);
9a6c41
             smux_trap_process(ptr, (size_t *) &length);
9a6c41
 
9a6c41
@@ -1906,7 +1907,7 @@ smux_peer_cleanup(int sd)
9a6c41
             Auths[i]->sa_active_fd = -1;
9a6c41
             snprint_objid(oid_name, sizeof(oid_name), Auths[i]->sa_oid,
9a6c41
                           Auths[i]->sa_oid_len);
9a6c41
-            snmp_log(LOG_INFO, "peer disconnected: %s\n", oid_name);
9a6c41
+            DEBUGMSGTL(("smux", "peer disconnected: %s\n", oid_name));
9a6c41
         }
9a6c41
     }
9a6c41
 }