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