RE: Segmentation fault problem

Syed Mujtaba Ahmed Razvi <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
 
Miljen, I think your code snippet is trying to access a memory location that it is not allowed to access. For e.g. you might be writing some illegal location using some pointer (may be one of them my_test,my_test2). Try changing the HANDLER_CAN_RWRITE in the declaration portion to HANDLER_CAN_READ (in both). Your pointers might be trying to access eachothers location. 
 
Hope it helps!
Regards,
Syed Mujtaba

Date: Fri, 11 Jul 2008 15:52:31 +0200From: [email protected]: [email protected]: Segmentation fault problemHi everyone,I am trying to add SNMP support in the IKEv2 project (http://sourceforge.net/projects/ikev2) and I am using net-snmp, 5.4.1.Firstly, there is a great number of variables which I plan to register. I am wondering whether is possible (or harmful) to use one oid variable as:oid session_oid[] = {.., 13, 1};and then change last element of this array (to 2,3,..etc.) before registering different variables? The alternative is to declare and use different oid array for each variable that I want to register.More importantly, there is a problem which gives me a headache - a segmentation fault occasionally happens. Here is a backtrace:(gdb) bt#0  0x080fc3e1 in snmp_sess_timeout ()#1  0x080fc579 in snmp_timeout ()#2  0x080d8cb5 in snmp_synch_response_cb ()#3  0x080c9f57 in agentx_synch_response ()#4  0x080ca702 in agentx_register ()#5  0x080ba735 in agentx_registration_callback ()#6  0x0811c0c9 in snmp_call_callbacks ()#7  0x080ab5b2 in netsnmp_register_mib ()#8  0x080b04cd in netsnmp_register_handler ()#9  0x080793aa in sm_sessions_register () at sm.c:441#10 0x0807e93f in sm_main_thread (data=0xbfd33c28) at sm.c:7778#11 0x00c1a8ef in g_thread_create_full () from /usr/lib/libglib-2.0.so.0#12 0x001b53b6 in start_thread () from /lib/libpthread.so.0#13 0x00b2933e in clone () from /lib/libc.so.6Function sm_sessions_register() is defined as:void sm_sessions_register(){         netsnmp_handler_registration *my_test;        netsnmp_handler_registration *my_test2;        my_test =               netsnmp_create_handler_registration("example",
                                                sm_sess_handle,                                                session_oid,                                                OID_LENGTH(session_oid),                                                HANDLER_CAN_RWRITE);        netsnmp_register_instance(my_test); // --> THIS IS LINE 441!        my_test2 =                netsnmp_create_handler_registration("example2",                                                sm_sess_handle,                                                session_oid2,                                                OID_LENGTH(session_oid2),                                                HANDLER_CAN_RWRITE);        netsnmp_register_instance(my_test2);}session_oid and session_oid2 are defined as:oid session_oid[] = { 1, 3, 6, 1, 3, 411249, 13, 2, 1 };oid session_oid2[] = { 1, 3, 6, 1, 3, 411249, 13, 2, 2 };and they are globals. Sm_sess_handle is written by example in your tutorial (delayed_instance.c) and I can include this code also if necessary.I would be very grateful for any help or hint!Miljen
_________________________________________________________________
Connect to the next generation of MSN Messenger 
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08

_______________________________________________
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.