On Fri, 15 Jun 2007 19:10:21 -0600 Don wrote: TD> I have a trap callback function that checks the trap name against a list TD> of predefined names and resend the traps to other hosts if the trap name TD> matches a name in the list. This seems to work properly and I receive TD> the forwarded traps on the received hosts with the correct trap names TD> and values. In my test, I generate a trap every 5 seconds or so, after TD> about 40 traps are forwarded, the agent seems to exit without a core TD> dump. TD> TD> This is the gist of my code: TD> TD> TD> snmp_sess_init( &session ); TD> session.peername = "172.30.250.211:162"; TD> session.version = SNMP_VERSION_2c; TD> TD> ss = snmp_sess_open( &session ); TD> snmp_sess_send( ss, pdu ); // pdu is passed in the callback TD> snmp_sess_close( ss );
Sending a pdu will release it (unless and error occurs), so if you are trying to send a trap to multiple destinations, you should dup the pdu before sending it. You may even need to dup for the first destination, if the callere doesn't expect you to release the pdu. (Then there is the obvious issue of you not checking the send return code, and releasing the pdu in case of an error.) ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Net-snmp-coders mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
