Hello, I have encountered a segment fault in the handle_subagent_response() function. I am using net-snmp-5.2.1.2 on Linux.
[EMAIL PROTECTED]:~/derekli# uname -a Linux probe-59 2.6.10_mvlcge401-pc_target-x86_pentium4-05 #1 SMP Thu Jul 6 17:50:28 BST 2006 i686 GNU/Linux Core was generated by `/opt/feed/bin/probed 0 0 1'. Program terminated with signal 11, Segmentation fault. #0 0xb7b237b3 in handle_subagent_response () from /opt/feed/lib/libSNMP.so (gdb) bt #0 0xb7b237b3 in handle_subagent_response () from /opt/feed/lib/libSNMP.so #1 0xb7ba101f in _sess_process_packet () from /opt/feed/lib/libSNMP.so #2 0xb7ba1fbf in _sess_read () from /opt/feed/lib/libSNMP.so #3 0xb7ba1ff7 in snmp_sess_read () from /opt/feed/lib/libSNMP.so #4 0xb7ba12ba in snmp_read () from /opt/feed/lib/libSNMP.so #5 0xb7b801e2 in snmp_synch_response_cb () from /opt/feed/lib/libSNMP.so #6 0xb7b2eda8 in agentx_synch_response () from /opt/feed/lib/libSNMP.so #7 0xb7b2ee84 in agentx_open_session () from /opt/feed/lib/libSNMP.so #8 0xb7b24164 in subagent_open_master_session () from /opt/feed/lib/libSNMP.so #9 0xb7b24575 in agentx_reopen_session () from /opt/feed/lib/libSNMP.so #10 0xb7b248eb in agentx_check_session () from /opt/feed/lib/libSNMP.so #11 0xb7bb8b1d in run_alarms () from /opt/feed/lib/libSNMP.so #12 0xb7b148cc in agent_check_and_process () from /opt/feed/lib/libSNMP.so #13 0xb7b12c14 in SNMP::mainLoopCb () from /opt/feed/lib/libSNMP.so #14 0xb7dae483 in MainLoopManager::handleCallbacks () from /opt/feed/lib/libScheduler.so #15 0xb7db3c68 in Scheduler::enterMainLoop () from /opt/feed/lib/libScheduler.so #16 0xb7e4df29 in Loader::enterMainLoop () from /opt/feed/lib/libLoader.so ---Type <return> to continue, or q <return> to quit--- #17 0xb7e4c168 in Loader::startTheMEB () from /opt/feed/lib/libLoader.so #18 0xb7e4b655 in createLoader () from /opt/feed/lib/libLoader.so #19 0x0804ab18 in ProbeD::start () #20 0x08049b87 in main () (gdb) info registers eax 0xcf63f90 217464720 ecx 0x4a0 1184 edx 0xbc64280 197542528 ebx 0x0 0 esp 0xbfffd598 0xbfffd598 ebp 0xbfffd5c8 0xbfffd5c8 esi 0x0 0 edi 0xc748fb0 208965552 eip 0xb7b237b3 0xb7b237b3 eflags 0x10283 66179 cs 0x73 115 ss 0x7b 123 ds 0x7b 123 es 0x7b 123 fs 0x0 0 gs 0x33 51 (gdb) disassemble handle_subagent_response 0xb7b237a3 <handle_subagent_response+1031>: mov DWORD PTR [edi+4],0x12 0xb7b237aa <handle_subagent_response+1038>: mov edx,DWORD PTR [ebp-4] 0xb7b237ad <handle_subagent_response+1041>: mov eax,DWORD PTR [edx+4] 0xb7b237b0 <handle_subagent_response+1044>: add esp,0xfffffff8 0xb7b237b3 <handle_subagent_response+1047>: mov eax,DWORD PTR [eax] 0xb7b237b5 <handle_subagent_response+1049>: mov DWORD PTR [edi],eax This corresponds to these lines in the function; pdu->command = AGENTX_MSG_RESPONSE; pdu->version = smagic->session->version; It looks like the value of session is invalid. (gdb) x /32w $eax 0xcf63f90: Cannot access memory at address 0xcf63f90 The calling function is _sess_process_packet(). handle_subagent_response() is called (as a callback) from here; if (callback == NULL || callback(NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE, sp, pdu->reqid, pdu, magic) == 1) { At that point, _sess_process_packet is iterating though the netsnmp_request_list requests in the snmp_internal_sessions structure isp. Looking further up the stack, agentx_check_session() calls agentx_reopen_session(), which indicates that a ping has failed. I suspected that the session_list isnt being updated correctly on a reopen, leaving an invalid entry, but I cant see anything wrong. Can anyone else spot what might be going wrong? Also, how does snmp_sync_response_cb() work, when called by agentx_send_ping()? I can't see now the timeout is set. Cheers, Derek ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders