From: SourceForge.net <no...@so...> - 2011-01-06 12:46:52
|
Patches item #2941811, was opened at 2010-01-28 20:22 Message generated for change (Comment added) made by dts12 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312694&aid=2941811&group_id=12694 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed >Resolution: Accepted Priority: 5 Private: No Submitted By: Bill Fenner (fenner) Assigned to: Nobody/Anonymous (nobody) Summary: snmpd logs a non-error when sending response with req-id=0 Initial Comment: In net-snmp 5.5, the return value of snmp_send() says it's: * Return on success: * The request id of the pdu is returned, and the pdu is freed. * Return on failure: * Zero (0) is returned. * The caller must call snmp_free_pdu if 0 is returned. So, zero means failure. But zero is a valid request id: PDU ::= SEQUENCE { request-id INTEGER (-214783648..214783647), so when a caller (like snmp_agent.c::netsnmp_wrap_up_request() calls snmp_send(), it seems that it must not only check that snmp_send returned zero but also that netsnmp_errno != SUCCESS (and snmp_send should make sure to set netsnmp_errno to success before trying, to enable this type of oob error reporting). It may be simpler to change snmp_send's return value to simply return 1 if it succeeds or zero if it fails, and if needed find another way to return the request-id. I didn't see any code in agent/ that uses the request-id return value, only success/failure. Or, change the return value to only be the request-id, and make the error indication completely out of band with netsnmp_errno. ---------------------------------------------------------------------- >Comment By: Dave Shield (dts12) Date: 2011-01-06 12:46 Message: SVN revision 19806 ---------------------------------------------------------------------- Comment By: Dave Shield (dts12) Date: 2011-01-06 12:46 Message: Thanks for the patch! It has been applied to the 5.3.x and later code branches and the main development tree, and will appear in future releases of the Net-SNMP package. ---------------------------------------------------------------------- Comment By: Thomas Anders (tanders) Date: 2010-12-02 00:34 Message: moving to patches ---------------------------------------------------------------------- Comment By: Bill Fenner (fenner) Date: 2010-12-01 14:05 Message: I've uploaded a patch that leaves snmp_send alone, and just checks for s_snmp_errno != SNMP_SUCCESS in netsnmp_wrap_up_request(). snmp_send() already sets s_snmp_errno to 0 before doing much of anything, so if it is still zero at return it is fairly safe to assume success. (I am using the patch with 5.6.) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312694&aid=2941811&group_id=12694 |