Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Handling SNMP V1 traps with IPV6 address in agent-addr field

94 views
Skip to first unread message

Spandana Kadiri

unread,
Aug 5, 2015, 5:02:25 AM8/5/15
to
Hi,

I used Net-SNMP 5.7.3 source and created an application that receives traps.
But when a V1 trap with IPV6 address in agent-addr field arrives, sess_snmp_read() is dropping the packet due to parse error.
The following error is given:

Bad parse of ASN.1 type (parse string length 16 too large: exceeds 4)


I went through the code of net-snmp and figured out that agent address is expected to be of size 4.

Below is the code snippet from snmp_api.c

        /*

         * agent-addr 

         */

        four = 4;

        data = asn_parse_string(data, length, &type,

                                (u_char *) pdu->agent_addr, &four);

        if (data == NULL)

            return -1;


I want to know, how do we handle IPV6 address in agent-addr field, if length is hard coded not to exceed 4?
Please let me know if this is a known issue and if we have any alternative approach to solve this.

Thanking You,
Spandana Kadiri


Niels Baggesen

unread,
Aug 5, 2015, 3:18:26 PM8/5/15
to
Den 05-08-2015 kl. 11:01 skrev Spandana Kadiri:
> I used Net-SNMP 5.7.3 source and created an application that receives traps.
> But when a V1 trap with IPV6 address in agent-addr field arrives,
> sess_snmp_read() is dropping the packet due to parse error.
> The following error is given:

SNMPv1 is showing its age, it only knows about IPv4.

Your trap sender should never have tried to encode an IPv6 address in
the agent-addr field which is defined as an 4 octet IPv4 address.

Use a TRAP2 or INFORM messages and, if coding your own application, look
in the tranport_data field of the PDU.

/Niels

--
Niels Baggesen - @home - Århus - Denmark - n...@users.sourceforge.net
The purpose of computing is insight, not numbers --- R W Hamming

------------------------------------------------------------------------------
_______________________________________________
Net-snmp-coders mailing list
Net-snm...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

0 new messages