Hi Magnus & David, I am here to warn you from a potential bug with the agent
when using informsink with IPv6.
As listed in the Email below I have incorporated the below fix to a 5.2.1
agent. The informsink works flawlessly for the cold start trap.
However for the following scenario:

snmpbulkwalk -ro -v 2c -c notavalidcomm <ip address>

notavalidcomm is not a valid community string so the agent tries to send an
authentication trap to the configured manager. I don't have snmptrapd
running on the manager side. During this scenario the session list is
getting corrupted ( a garbage transport appears)  and the agent crashes.
It works flawlessly for IPv4.  
This crash will not occur if a snmpwalk is used.
I tried to use a debugger to figure out where the memory corruption occurs
but gave up after 2 days of trying chasing it...

Magnus, I'll appreciate if you can test this scenario to see if you see the
same bug or this bug is specific to my platform...

Last time we "talked" it was mentioned that an official support for IPv6
traps will be supplied in 5.3 is this still the case?

Thanks for your help!

Shuki


-----Original Message-----
From: sasson, shuki 
Sent: Tuesday, September 20, 2005 11:07 AM
To: Magnus Fromreide; sasson, shuki
Cc: Thomas Anders; net-snmp-coders@lists.sourceforge.net
Subject: RE: informsink trapsink and trap2sink support for IPv6.

Hi Magnus, I have retrieved the 5.24 version of agent_trap.c and observed
the fix:

int
create_trap_session(char *sink, u_short sinkport,
                    char *com, int version, int pdutype)
{
    netsnmp_session session, *sesp;
    char           *peername = NULL;
    int             len;

    len = strlen(sink) + 4 + 32;
    if ((peername = malloc(len)) == NULL) {
        return 0;
    } else if (NULL != strchr(sink,':')) {     <----- The fix for IPv6
        snprintf(peername, len, "%s", sink);   <----- The fix for IPv6
    } else {
        snprintf(peername, len, "udp:%s:%hu", sink, sinkport);
    }

This will only work for IPv6 when the address is given in a format:

udp6:[3ffe::1]:161

Usulally with IPv6 users will tend to use names and not addresses. When a
name is introduced the above current code will create a transport string of:

udp:name:161 which will result with an IPv4 transport where gethostbyname is
likely to fail.


A comprehensive fix should try to resolve the name in create_trap_session
and open the adequate transport. 
Another minor comment is that introducing the address with:
3ffe::1 only will also likely to fail. The code should automatically add
udp6: prefix and :port number suffix.

Your response will be appreciated.

Shuki


-----Original Message-----
From: Magnus Fromreide [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 19, 2005 1:42 AM
To: sasson, shuki
Cc: Thomas Anders; net-snmp-coders@lists.sourceforge.net
Subject: Re: informsink trapsink and trap2sink support for IPv6.

On Sun, Sep 18, 2005 at 07:14:33PM -0400, sasson, shuki wrote:
> I actually done some digging into 5.2.1 code and I saw that everything is
> going through udp and not udp6 as it should be. I wander when and if this
> problem was fixed in later official versions and if not when will it be
> fixed.

CVS revision 5.23 of agent/agent_trap.c as per 30-Aug-05, it will appear in
the 5.3 release.

/MF

> Thanks for the help!
> 
> Shuki 
> 
> -----Original Message-----
> From: Magnus Fromreide [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, September 18, 2005 5:19 PM
> To: sasson, shuki
> Cc: Thomas Anders; net-snmp-coders@lists.sourceforge.net
> Subject: Re: informsink trapsink and trap2sink support for IPv6.
> 
> On Fri, Sep 16, 2005 at 10:51:02AM -0400, sasson, shuki wrote:
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of
sasson,
> > shuki
> > Sent: Friday, September 16, 2005 9:25 AM
> > To: Thomas Anders; net-snmp-coders@lists.sourceforge.net
> > Subject: RE: informsink trapsink and trap2sink support for IPv6.
> > 
> > I am using 5.2.1.2. It seems like the configuration handler for that
> command
> > will not even recognize an IPv6 address:
> > 
> > [EMAIL PROTECTED] .libs]$ ./snmpd -L -d -f
> > snmpd: create_trap_session: Unknown host (No such file or directory)
> > /usr/local/share/snmp/snmpd.conf: line 73: Error: cannot create
> informsink:
> > 3ffe:80c0:22c:cafe:3::4
> 
> I just have to ask, exactly how do you type your configuration specifier,
> and
> does it help if you type it as:
> 
> informsink udp6:[3ffe:80c0:22c:cafe:3::4]:162
> 
> When I try to send or receive IPv6 messages using snmptrap and snmptrapd
> 5.1.2-debian it just tells me that my kernel doesn't support IPv6 (which
is
> correct)
> 
> (Yes, that :162 is needed is a bug, but that doesn't change the general
>  principle)
> 
> /MF
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App Server. 
> Download it for free - -and be entered to win a 42" plasma tv or your very
> own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
> _______________________________________________
> Net-snmp-coders mailing list
> Net-snmp-coders@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

-- 
Magnus Fromreide                                        +46-13 17 68 48
Mårdtorpsgatan 21, 2tr                                  [EMAIL PROTECTED]
SE-584 34  LINKÖPING


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28&alloc_id845&op=click
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to