This is a discussion on Re: Getting Too Long Error within the SNMP Users forums, part of the Networking and Network Related category; 2008/6/19 Rucha <rucha_mahajan@persistent.co.in>: > I checked the size of pdu which I am ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
2008/6/19 Rucha <rucha_mahajan@persistent.co.in>:
> I checked the size of pdu which I am sending, its size of just 4bytes. An SNMP PDU of just 4 bytes!!? Can you please post a packet dump of this request. > Any other reason for getting this error ? Given that a GET PDU will typically be at *least* 30 bytes in size, and the absolute minimum size of a completely empty GET request is (I think) 18 bytes - if your GET request is just 4 bytes, then it's almost certainly invalid. If it's malformed, then the parsing code might well be reading the length as over-size, and returning a tooLong error. Dave ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/...net-snmp-users |
|
|||
|
Hi Dave,
Here is the dump of pdu. (gdb) p pdu $1 = (netsnmp_pdu *) 0x951b398 (gdb) p *$1 $2 = {version = -1, command = 160, reqid = 713309340, msgid = 1415423209, transid = 0, sessid = 0, errstat = -1, errindex = -1, time = 0, flags = 0, securityModel = -1, securityLevel = 0, msgParseModel = 0, transport_data = 0x0, transport_data_length = 0, tDomain = 0x0, tDomainLen = 0, variables = 0x0, community = 0x0, community_len = 0, enterprise = 0x0, enterprise_length = 0, trap_type = 0, specific_type = 0, agent_addr = "\000\000\000", contextEngineID = 0x0, contextEngineIDLen = 0, contextName = 0x0, contextNameLen = 0, securityEngineID = 0x0, securityEngineIDLen = 0, securityName = 0x0, securityNameLen = 0, priority = 0, range_subid = 0, securityStateRef = 0x0} 135 int length = sizeof(pdu); (gdb) n 137 printf("PDU Length = %d\n", length); (gdb) n PDU Length = 4 139 status = snmp_synch_response(ss, pdu, &response); (gdb) p length $4 = 4 Regards, Rucha -----Original Message----- From: dave.shield@googlemail.com [mailto:dave.shield@googlemail.com] On Behalf Of Dave Shield Sent: Thursday, June 19, 2008 8:18 PM To: Rucha Cc: Pranesh Kulkarni; Net-snmp-users@lists.sourceforge.net Subject: Re: Getting Too Long Error 2008/6/19 Rucha <rucha_mahajan@persistent.co.in>: > I checked the size of pdu which I am sending, its size of just 4bytes. An SNMP PDU of just 4 bytes!!? Can you please post a packet dump of this request. > Any other reason for getting this error ? Given that a GET PDU will typically be at *least* 30 bytes in size, and the absolute minimum size of a completely empty GET request is (I think) 18 bytes - if your GET request is just 4 bytes, then it's almost certainly invalid. If it's malformed, then the parsing code might well be reading the length as over-size, and returning a tooLong error. Dave ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/...net-snmp-users |
|
|||
|
2008/6/20 Rucha <rucha_mahajan@persistent.co.in>:
> Here is the dump of pdu. > > (gdb) p pdu > $1 = (netsnmp_pdu *) 0x951b398 > (gdb) p *$1 No - we're not interested in the internal data structure. What it relevant here is the size of the PDU that's put out over the wire. Try running the application with the '-d' option, to dump the raw incoming/outgoing packets. *That* is the dump that I was talking about. > 135 int length = sizeof(pdu); > (gdb) n > 137 printf("PDU Length = %d\n", length); > (gdb) n > PDU Length = 4 The variable 'pdu' is a pointer. So yes - the size of it is almost certainly going to be 4. (assuming a 32-bit O/S). That's not useful information. What does the traffic on the wire look like. Also - how are you setting up the administrative settings for this request? (Community string, or SNMPv3 user) It also looks as if you are sending a GET request with an empty varbind list. I.e. you are asking for nothing? Dave ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/...net-snmp-users |
|
|||
|
2008/6/21 xiao ren <reign99@21cn.com>:
> I'm learning to use net-snmp lib to write client program just like snmpget, > but sourceforge only provide one demo app example on this > (http://net-snmp.sourceforge.net/tuto...oolkit/demoapp) . > Could anybody give some other examples on how to write client side > code to fetch information from agent, Especially for snmp v2c? Remember that you've also got the source code for the command-line applications (snmpget, etc), in the 'apps' directory of the source tree. They should illustrate all the basic techniques you'll need. Dave ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/...net-snmp-users |