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


-------------------------------------------------------
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

Reply via email to