Skip Menu |
 
rt.cpan.org will be shut down on March 1st, 2021.

This queue is for tickets about the Net-SNMP CPAN distribution.

Report information
The Basics
Id: 70580
Status: stalled
Worked: 1 min
Priority: 0/
Queue: Net-SNMP

People
Owner: dtown [...] cpan.org
Requestors: BitCard [...] ResonatorSoft.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: v6.0.1
Fixed in: (no value)



Subject: SNMP.pm Debug flag patch
Download (untitled) / with headers
text/plain 680b
Made the following changes: * Removed some overly verbose debug messages within get_entries * Added a debug flag for SNMP.pm itself Seems to work okay. The get_entries messages were to hit multiple times on each and every response packet. This sort of verbosity isn't available on get_table, so I removed the DEBUG_INFO lines. Figured they were useful when the feature was first being implemented, but it's just spammy now. The debug flag gives the user the ability to filter out messages like that, since SNMP.pm holds a lot of code. Previously, if there were ANY debug flags turned on, then the DEBUG_INFO messages from SNMP.pm would be turned on. This patch fixes that.
Subject: SNMP-DebugFlag.patch.txt
diff -bcdr /usr/local/share/perl/5.10.1/Net/SNMP.pm Net/SNMP.pm *** /usr/local/share/perl/5.10.1/Net/SNMP.pm 2010-09-09 20:02:45.000000000 -0400 --- Net/SNMP.pm 2011-08-01 10:12:13.000000000 -0400 *************** *** 137,144 **** GET_BULK_REQUEST INFORM_REQUEST SNMPV2_TRAP REPORT ) ], debug => [ ! qw( DEBUG_ALL DEBUG_NONE DEBUG_MESSAGE DEBUG_TRANSPORT DEBUG_DISPATCHER ! DEBUG_PROCESSING DEBUG_SECURITY snmp_debug ) ], generictrap => [ qw( COLD_START WARM_START LINK_DOWN LINK_UP AUTHENTICATION_FAILURE --- 159,166 ---- GET_BULK_REQUEST INFORM_REQUEST SNMPV2_TRAP REPORT ) ], debug => [ ! qw( DEBUG_ALL DEBUG_NONE DEBUG_SNMP DEBUG_MESSAGE DEBUG_TRANSPORT ! DEBUG_DISPATCHER DEBUG_PROCESSING DEBUG_SECURITY snmp_debug ) ], generictrap => [ qw( COLD_START WARM_START LINK_DOWN LINK_UP AUTHENTICATION_FAILURE *************** *** 165,170 **** --- 187,193 ---- sub DEBUG_ALL { 0xff } # All sub DEBUG_NONE { 0x00 } # None + sub DEBUG_SNMP { 0x01 } # Main Net::SNMP functions sub DEBUG_MESSAGE { 0x02 } # Message/PDU encoding/decoding sub DEBUG_TRANSPORT { 0x04 } # Transport Layer sub DEBUG_DISPATCHER { 0x08 } # Dispatcher *************** *** 173,179 **** ## Package variables ! our $DEBUG = DEBUG_NONE; # Debug mask our $DISPATCHER; # Dispatcher instance --- 196,203 ---- ## Package variables ! our $DEBUG_MASK = DEBUG_NONE; # Debug mask ! our $DEBUG = 0; # Debug mode for just Net::SNMP our $DISPATCHER; # Dispatcher instance *************** *** 1947,1952 **** --- 2020,2029 ---- =item * + 0x01 - Main Net::SNMP functions + + =item * + 0x02 - Message or PDU encoding and decoding =item * *************** *** 1985,2001 **** if (@_ == 2) { ! $DEBUG = ($mask =~ /^\d+$/) ? $mask : ($mask) ? DEBUG_ALL : DEBUG_NONE; ! eval { Net::SNMP::Message->debug($DEBUG & DEBUG_MESSAGE); }; ! eval { Net::SNMP::Transport->debug($DEBUG & DEBUG_TRANSPORT); }; ! eval { Net::SNMP::Dispatcher->debug($DEBUG & DEBUG_DISPATCHER); }; ! eval { Net::SNMP::MessageProcessing->debug($DEBUG & DEBUG_PROCESSING); }; ! eval { Net::SNMP::Security->debug($DEBUG & DEBUG_SECURITY); }; } ! return $DEBUG; } sub snmp_debug --- 2062,2079 ---- if (@_ == 2) { ! $DEBUG_MASK = ($mask =~ /^\d+$/) ? $mask : ($mask) ? DEBUG_ALL : DEBUG_NONE; ! $DEBUG = $DEBUG_MASK & DEBUG_SNMP; ! eval { Net::SNMP::Message->debug($DEBUG_MASK & DEBUG_MESSAGE); }; ! eval { Net::SNMP::Transport->debug($DEBUG_MASK & DEBUG_TRANSPORT); }; ! eval { Net::SNMP::Dispatcher->debug($DEBUG_MASK & DEBUG_DISPATCHER); }; ! eval { Net::SNMP::MessageProcessing->debug($DEBUG_MASK & DEBUG_PROCESSING); }; ! eval { Net::SNMP::Security->debug($DEBUG_MASK & DEBUG_SECURITY); }; } ! return $DEBUG_MASK; } sub snmp_debug *************** *** 2836,2848 **** # The response column does not map to the the request, there # could be a "hole" or we are out of entries. - DEBUG_INFO('last_entry: column mismatch: %s', $name); $last_entry = TRUE; next; } - DEBUG_INFO('found index [%s]', $index); - # Validate the index of the response. if ((defined $argv->{start_index}) && --- 2915,2924 ---- *************** *** 2897,2903 **** @row = (); $row_index = $index; $row[$col_num] = $name; - DEBUG_INFO('new minimum row_index [%s]', $row_index); } else { --- 2973,2978 ---- *************** *** 2950,2956 **** # Store the maximum index found to be used for the next request. if (oid_lex_cmp($row_index, $max_index) > 0) { $max_index = $row_index; - DEBUG_INFO('new max_index [%s]', $max_index); } } --- 3025,3030 ---- *************** *** 3048,3055 **** } } ! # Send the next PDU with no delay. ! $DISPATCHER->send_pdu($this->{_pdu}, 0); return; } --- 3122,3130 ---- } } ! # Send the next PDU as a priority ! # (Existing requests get priority over new ones) ! $DISPATCHER->send_pdu_priority($this->{_pdu}); return; }
From: BitCard [...] ResonatorSoft.org
Download (untitled) / with headers
text/plain 165b
Sorry, disregard the last item on the patch (send_pdu_priority change). Leftover from another patch, and I have confirmed that it's not missing for the other one.
Download (untitled) / with headers
text/plain 346b
I will consider the specific flag for the top level module, but always felt that if any debugging was enabled, debugging at the top level should be enabled since it is the core module. I will not remove the debugging in get_table(). There have been many unique problems with this method and the debug messages have aided in their resolution.
Download (untitled) / with headers
text/plain 110b
This request will be addressed when there are enough changes to the Net::SNMP module to warrant a new release.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.