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

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