My agent crashes with segmentation fault on snmpwalk

Javier Torres López-Sepúlveda <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Hello,

 

I have a problem with my snmp agent in Net-SNMP (tested with versions
5.6.2.1 & 5.7.3) my agent crashes when responding to snmpwalk. When it
reaches the end of my MIB tree it gives segmentation fault

 

Steps to replicate the problem:

 

snmpwalk -m ALL -v1 -cpublic localhost enterprises.XXXXX

 

NOTE: XXXXX stands for my enterprise ID

 

 

snmpd response:

 

SNMPv2-SMI::enterprises.XXXXX.1.1.1.1.0 = STRING: "-100.0 dBm"

SNMPv2-SMI::enterprises.XXXXX.1.1.1.2.0 = INTEGER: 3

 

.

. more messages 

.

 

SNMPv2-SMI::enterprises.XXXXX.1.1.15.8.0 = STRING: "+3.0 A"

SNMPv2-SMI::enterprises.XXXXX.1.1.16.1.0 = STRING: "not-initialized"

SNMPv2-SMI::enterprises.XXXXX.1.1.17.1.0 = INTEGER: 1

Timeout: No Response from localhost

 

I executed snmp by means of gdb and get this output:

 

Received 46 byte packet from UDP: [127.0.0.1]:58230->[127.0.0.1]:161

0000: 30 2C 02 01  00 04 06 70  75 62 6C 69  63 A1 1F 02    0,.....public...

0016: 04 7D 9F C1  6C 02 01 00  02 01 00 30  11 30 0F 06    .}..l......0.0..

0032: 0B 2B 06 01  04 01 82 B5  2E 01 01 11  05 00          .+............

 

 

Sending 49 bytes to UDP: [127.0.0.1]:58230->[127.0.0.1]:161

0000: 30 2F 02 01  00 04 06 70  75 62 6C 69  63 A2 22 02    0/.....public.".

0016: 04 7D 9F C1  6C 02 01 00  02 01 00 30  14 30 12 06    .}..l......0.0..

0032: 0D 2B 06 01  04 01 82 B5  2E 01 01 11  01 00 02 01    .+..............

0048: 01                                                    .

 

 

Received 48 byte packet from UDP: [127.0.0.1]:58230->[127.0.0.1]:161

0000: 30 2E 02 01  00 04 06 70  75 62 6C 69  63 A1 21 02    0......public.!.

0016: 04 7D 9F C1  6D 02 01 00  02 01 00 30  13 30 11 06    .}..m......0.0..

0032: 0D 2B 06 01  04 01 82 B5  2E 01 01 11  01 00 05 00    .+..............

 

ERROR:: FILE NOT FOUND 

ERROR:: FILE NOT FOUND 

ERROR:: FILE NOT FOUND

...

 

ERROR:: FILE NOT FOUND

 

(Those messages are generated by my own programs but I do not know which one
is snmpd trying to execute at this point)

 

Program received signal SIGSEGV, Segmentation fault.

_IO_fgets (buf=buf@entry=0xbefff5ec "\030\324\023", n=n@entry=60,
fp=fp@entry=0x0) at iofgets.c:50

50      iofgets.c: No such file or directory.

 

 

gdb Backtrace:

 

Program received signal SIGSEGV, Segmentation fault.

_IO_fgets (buf=buf@entry=0xbefff5ec "\030\324\023", n=n@entry=60,
fp=fp@entry=0x0) at iofgets.c:50

50      iofgets.c: No such file or directory.

(gdb) bt

#0  _IO_fgets (buf=buf@entry=0xbefff5ec "\030\324\023", n=n@entry=60,
fp=fp@entry=0x0) at iofgets.c:50

#1  0xb6db1240 in eventTable1_handler (handler=<optimized out>,
reginfo=<optimized out>, reqinfo=0x109e20, requests=0x13d418) at
eventTable1.c:176

#2  0xb6f9f602 in netsnmp_call_handler (requests=0x13d418, reqinfo=0x109e20,
reginfo=0x52338, next_handler=0x52310) at agent_handler.c:526

#3  netsnmp_call_next_handler (current=current@entry=0x52698,
reginfo=reginfo@entry=0x52338, reqinfo=reqinfo@entry=0x109e20,
requests=requests@entry=0x13d418) at agent_handler.c:640

#4  0xb6f9763e in table_helper_handler (handler=0x52698, reginfo=0x52338,
reqinfo=<optimized out>, requests=0x13d418) at helpers/table.c:712

#5  0xb6f9f214 in netsnmp_call_handler (requests=0x13d418, reqinfo=0x109e20,
reginfo=0x52338, next_handler=0x52698) at agent_handler.c:526

#6  netsnmp_call_handlers (reginfo=0x52338, reqinfo=0x109e20,
requests=0x13d418) at agent_handler.c:611

#7  0xb6fa8940 in handle_var_requests (asp=asp@entry=0x12a350) at
snmp_agent.c:2676

#8  0xb6fa8c70 in handle_getnext_loop (asp=asp@entry=0x12a350) at
snmp_agent.c:3122

#9  0xb6fa92ba in handle_pdu (asp=asp@entry=0x12a350) at snmp_agent.c:3451

#10 0xb6fa93b6 in netsnmp_handle_request (asp=asp@entry=0x12a350,
status=status@entry=0) at snmp_agent.c:3281

#11 0xb6fa9760 in handle_snmp_packet (op=<optimized out>, session=<optimized
out>, reqid=<optimized out>, pdu=0x157b40, magic=0x0) at snmp_agent.c:1987

#12 0xb6cf21dc in _sess_process_packet (sessp=sessp@entry=0x10dc28,
sp=sp@entry=0x1450f8, isp=isp@entry=0x1354d8,
transport=transport@entry=0xf26a0, opaque=opaque@entry=0x127e58,
olength=olength@entry=36,

    packetptr=packetptr@entry=0x147b38 "0.\002\001", length=48) at
snmp_api.c:5437

#13 0xb6cf2a6c in _sess_read (sessp=sessp@entry=0x10dc28,
fdset=fdset@entry=0xbefffa40) at snmp_api.c:5872

#14 0xb6cf35e4 in snmp_sess_read2 (sessp=sessp@entry=0x10dc28,
fdset=fdset@entry=0xbefffa40) at snmp_api.c:5904

#15 0xb6cf3618 in snmp_read2 (fdset=fdset@entry=0xbefffa40) at
snmp_api.c:5500

#16 0x00013436 in receive () at snmpd.c:1328

#17 main (argc=<optimized out>, argv=<optimized out>) at snmpd.c:1115

(gdb) q

 

 

Thanks you in advance,

Javier

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.