[AGENT++] Problem using net-snmp as subagent (Error in packet)

Johnny Ljunggren johnny at navtek.no
Wed Feb 14 13:06:22 CET 2007



Hello Frank

Thanks for the info. I'll pass it on.

BTW: The subagent (at least net-snmp)does not disconnect. It will happily
answer the next snmpget.

Thanks a lot
Johnny

Frank Fock wrote:
> Hello Johnny,
>
> a 0.0 OID should be encoded like:
> 02 00 00 00
> 00 00 00 00
> 00 00 00 00
>
> and not
> 00 00 00 00
>
> which is actually a zero length OID which
> must not be returned by a SNMP agent.
> Consequently, it should not be allowed for
> an AgentX subagent to return a zero length
> OID. Nevertheless, the AgentX++ master agent
> should be able to handle this. At the moment,
> I think there is no workaround implemented
> to map a zero length OID to 0.0 for NET-SNMP
> subagents. Instead a AgentX protocol error
> is thrown, which could lead to a subagent
> disconnect (if not sure if it actually does).
>
> Hope this helps.
>
> Best regards,
> Frank
>
> Johnny Ljunggren wrote:
>>
>> Hello
>>
>> Thanks for the effort so far.
>>
>> I've been having a discussion with Dave Shield of net-snmp and it seems
>> that the problem might be in agentpp after all. At least it looks like
>> the
>> zeroDotZero packet are built correctly on the net-snmp side (RFC 2741,
>> section 5.1) but is not acknowledge on the agentpp AgentX side.
>>
>> This would be the correct response to IF-MIB::ifSpecific.1 according to
>> Dave:
>>
>> Sending 64 bytes to Local IPC: /var/agentx/master
>> 0000: 01 12 00 00  01 00 00 00  00 00 00 00  00 00 00 00
>> ................
>> 0016: 2C 00 00 00  00 00 00 00  00 00 00 00  06 00 00 00
>> ,...............
>> 0032: 06 02 00 00  01 00 00 00  02 00 00 00  02 00 00 00
>> ................
>> 0048: 01 00 00 00  16 00 00 00  01 00 00 00  00 00 00 00
>> ................
>>
>> looks correct for returning a response of
>>
>>    .1.3.6.1.2.1.2.2.1.22.1 (ifSpecific.1) = OID .0.0
>>
>> Could you have a look and give me your thoughts on this?
>>
>>> Are you sure that ifSpecific.1 causes the error?
>>> If you are using GETNEXT/GETBULK also the
>>> ifSpecific.x following objects could cause the
>>> error (this is my experience). Therefore I suggested
>>> to compile only those MIBs into the NET-SNMP
>>> agent that are absolutely needed.
>>>
>>> Hope this helps.
>>>
>>> Best regards,
>>> Frank
>>>
>>> Johnny Ljunggren wrote:
>>>> Hello
>>>>
>>>>> Sorry, my comments were mistakable. In addition to
>>>>> NET_SNMP_WORKAROUNDS you will need also
>>>>> to change MAX_AGENTX_REPETITIONS to 1
>>>> I tried that but it didn't seem to have any effect. Maybe I did it
>>>> wrong
>>>> but I changed the setting to 1 then compiled the agentx library, and
>>>> then
>>>> recompiled my agent.
>>>>
>>>> I did some more research and found that only the OIDs defined as OID:
>>>> SNMPv2-SMI::zeroDotZero will give this error.
>>>> ie. IF-MIB::ifSpecific.1 = OID: SNMPv2-SMI::zeroDotZero
>>>>
>>>> I did a snmpget on every single oid and only got the problem with the
>>>> above mentioned definition.
>>>>
>>>> I tried to look through the source code but I guess it will take me a
>>>> while to get my head around what is happening.
>>>>
>>>> Any idea what's so special about SNMPv2-SMI::zeroDotZero and what I
>>>> should
>>>> be looking for?
>>>>
>>>>>> It seems that NET_SNMP_WORKAROUNDS is enabled by default, so I have
>>>>>> it
>>>>>> activated. Luckily I'm not running on a 64bit system, but I'm a bit
>>>>>> worried anyway.
>>>>>> Do you think it would be possible to pay someone with a deeper
>>>>>> knowledge
>>>>>> about this to fix it?
>>>>>> Is net-snmp the only way to get mib-II on linux?
>>>>>> Where should I start to try to solve this? (apart from contacting
>>>>>> the
>>>>>> net-snmp ml, which I already did)
>>>>>>> Have you activated the NET-SNMP work-arounds in
>>>>>>> agent++_def.h? The NET-SNMP AgentX implementation
>>>>>>> has many bugs. For some of them, I had implemented
>>>>>>> work-arounds that can be activated in AGENT++.
>>>>>>>
>>>>>>> I have reported those bugs to NET-SNMP.org but they
>>>>>>> seem not to be able to fix them for about four years
>>>>>>> now. When you run the NET-SNMP subagent on a 64bit
>>>>>>> machine, things get even worse.
>>>>>>>
>>>>>>>> I've made a master AgentX that uses net-snmp as subagent to
>>>>>>>> provide
>>>>>>>> mib-II
>>>>>>>> information. I get a general failure if I try to get some of the
>>>>>>>> OIDs.
>>>>>>>> This only occurs when running net-snmp as subagent, because it
>>>>>>>> will
>>>>>>>> return
>>>>>>>> the whole tree if running standalone.
>>>>>>>>
>>>>>>>> # snmpwalk -v 2c -c public localhost
>>>>>>>> <snip some output>
>>>>>>>> IF-MIB::ifOutQLen.2 = Gauge32: 0
>>>>>>>> IF-MIB::ifOutQLen.3 = Gauge32: 0
>>>>>>>> Error in packet.
>>>>>>>> Reason: (genError) A general failure occured
>>>>>>>> Failed object: IF-MIB::ifOutQLen.3
>>>>>>>>
>>>>>>>> # snmpwalk -v 2c -c public localhost IF-MIB::ifOutQLen.3
>>>>>>>> Error in packet.
>>>>>>>> Reason: (genError) A general failure occured
>>>>>>>> Failed object: IF-MIB::ifOutQLen.3
>>>>>>>>
>>>>>>>> My agent outputs this:
>>>>>>>> 20070202.22:25:53: 567: (1)ERROR  : MasterAgentXMib: invalid
>>>>>>>> AgentX
>>>>>>>> response
>>>>>>>> (sd)(sid)(tid)(req-vbs)(resp-vbs): (15), (1), (96), (1), (0)
>>>>>>>>
>>>>>>>> I've tried using the plain master agent from the examples
>>>>>>>> directory,
>>>>>>>> and
>>>>>>>> net-snmp 5.3.1 and 5.4 but the results are the same.
>>> --
>>> AGENT++
>>> http://www.agentpp.com
>>> http://www.mibexplorer.com
>>> http://www.mibdesigner.com
>>>
>>>
>>
>>
>
> --
> AGENT++
> http://www.agentpp.com
> http://www.mibexplorer.com
> http://www.mibdesigner.com
>
>


-- 
Johnny Ljunggren, Navtek AS




More information about the AGENTPP mailing list