Skip Menu |

This queue is for tickets about the Mon CPAN distribution.

Report information
The Basics
Id: 1568
Status: new
Priority: 0/
Queue: Mon

People
Owner: Nobody in particular
Requestors: syang [...] aapt.com.au
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.11
Fixed in: (no value)



Subject: Bugs in Mon::SNMP
Perl Version: ----------------- syang@glbdev4[282] perl58 -V Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration: Platform: osname=solaris, osvers=2.8, archname=sun4-solaris uname='sunos glbdev4 5.8 generic_108528-10 sun4u sparc sunw,ultrasparc-iii-cengine ' config_args='-de' hint=previous, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef OS Info: -------------------------------------------- SunOS glbdev4 5.8 Generic_108528-10 sun4u sparc SUNW,UltraSPARC-IIi-cEngine Input buffer data from UDP port (incoming trap data): After using dump(): ------------------------------------------------------ 0000 30 172: SEQUENCE { 0003 02 1: INTEGER = 0 0006 04 6: STRING = 'public' 000E A4 158: CONTEXT [4] { 0011 06 7: OBJECT ID = 1.3.6.1.4.123456 001A 40 4: APPLICATION [0] 001B : C0 A8 09 23 __ __ __ __ __ __ __ __ __ __ __ __ ...# 0020 02 1: INTEGER = 6 0023 02 2: INTEGER = 2278 0027 43 1: APPLICATION [3] 0028 : 64 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ d 002A 30 130: SEQUENCE { 002D 30 20: SEQUENCE { 002F 06 9: OBJECT ID = 1.3.6.1.4.123456.1.3 003A 04 7: STRING = 'Sun Set' 0043 : } 0043 30 37: SEQUENCE { 0045 06 9: OBJECT ID = 1.3.6.1.4.123456.2.4 0050 04 24: STRING = 'Wed Sep 25 00:05:58 2002' 006A : } 006A 30 33: SEQUENCE { 006C 06 9: OBJECT ID = 1.3.6.1.4.123456.1.5 0077 04 20: STRING = 'Because this so that' 008D : } 008D 30 16: SEQUENCE { 008F 06 9: OBJECT ID = 1.3.6.1.4.123456.1.2 009A 04 3: STRING = 'OUT' 009F : } 009F 30 14: SEQUENCE { 00A1 06 9: OBJECT ID = 1.3.6.1.4.123456.1.4 00AC 02 1: INTEGER = 3 00AF : } 00AF : } 00AF : } 00AF : } Mon::SNMP Error Message: ------------------------------------------- problem decoding BER Convert::BER Error Message: ------------------------------------------- Sequence buffer not empty at /pkgs/perl-5.8.0/opt/lib/perl5/site_perl/5.8.0/Convert/BER.pm line 1393. Bug No 1---The Problem: ------------------------------------------------- The decode() method in the module only handles only single BER_VARBINDLIST. As you can see from above input data dump, I passed 5 var elements into decode(), and gives me the error. But it works if I pass only 1 OID=value var element. Where to fix it: --------------------------------------------------- The opList inside the decode() method where called to $self->{"BER"}->decode(), the element of: SEQUENCE => [ ANY => \$self->{"ber_varbindlist"},] should be replaced with: SEQUENCE => \$self->{"ber_varbindlist"} so that it can handle multiple OID=value variable list passed in by client. Bug No 2: ------------------------------------------- the 'agentaddr' returned undef. Where to fix it: ------------------------------------------- under method decode(), at end of the method in return(), the hash element of 'agentaddr', value of it should call function 'inet_ntoa' instead of 'inet_aton' where we only passing in the opaque values not the string. Suggestions: --------------------------------------------- 1. further defining the OID values in the while loop under decode method: Normally, the value passing in by user are String, Integer, or boolean. therefore, it's useful try to decode the ANY => \$val further to above 3 data types, if all failed, the let it remain as what it is as 'ANY'. 2. under the 'return()' statement in decode method, try to leave the generic_trap value as what it was, rather try to define it. 3. catch the error message from Convert::BER instead of passing out the fixed error message of "problem decoding BER". COMMENTS: ---------------------------------------------- The reason I rate this as critical, as most of traps you get from Snmp agents are more than one variable passed in. A part from these bugs, the whole module is very useful, especially where requires you to write a SNMP trapd server. there is not many module around on CPAN to help you to write a trapd server, therefore, if someone can extend this module focus on snmp trapd server creation, then it would be very much helpful. the reason why you need to write a extra trapd server, because sometimes you need to translate one kind of agent trap information from one end into another one to another end of trapd server (data convertion if you like to call). Best Regards, Sam YANG.