Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 02 Jun 2005 13:33:32 +0200
From:      Andre Oppermann <andre@freebsd.org>
To:        "Li, Qing" <qing.li@bluecoat.com>
Cc:        freebsd-net@freebsd.org
Subject:   Re: issue with route
Message-ID:  <429EEE8C.86657ED1@freebsd.org>
References:  <48D44BB27BDE3840BDF18E59CB169A5C010AF780@bcs-mail3.internal.cacheflow.com>

next in thread | previous in thread | raw e-mail | index | archive | help
"Li, Qing" wrote:
> 
> 
>   When I issued the following command by accident today:
> 
>        route add default -inet6 fe80:20d:56ff:fe8d:d4b0%fxp0
> 
>   The netstat shows the following:
> 
> Internet:
> Destination        Gateway            Flags    Refs      Use  Netif
> Expire
> default            fe80:20d:56ff:fe8d:d4b0%fxp0          UGS         0
> 0   fxp0
> 10.9.44/24         link#1             U           1        0   fxp0
> 10.9.44.175        127.0.0.1          UGHS        0        0    lo0
> 127.0.0.1          link#4             UH          1        4    lo0
> 
>   So I went ahead and issued
> 
>       route add 10.1.1.1 -inet6 fe80::1%fxp0
> 
> Internet:
> Destination        Gateway            Flags    Refs      Use  Netif
> Expire
> default            fe80:20d:56ff:fe8d:d4b0%fxp0          UGS         0
> 0   fxp0
> 10.1.1.1           fe80::1%fxp0       UGHS        0        0   fxp0
> 10.9.44/24         link#1             U           1        0   fxp0
> 10.9.44.175        127.0.0.1          UGHS        0        0    lo0
> 127.0.0.1          link#4             UH          1        4    lo0
> 
>   I verified this behavior on both FreeBSD 5.4 Release and 6.0-CURRENT.

Looks very strange indeed.

>   I think this behavior is probably not intended and should be treated
>   as a bug. I did a quick patch in sys/net/route.c
>   (it's just as easy in sbin/route.c).

Unless this causes or supposed to cause some kind of automagic
IPv4 in IPv6 encapsulation?  Can you check out if this is not
the case (RFC references, KAME folks)?

> -------------
> heavygear# cvs diff route.c
> Index: route.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/net/route.c,v retrieving revision 1.108
> diff
> -r1.108 route.c
> 746c747,748
> <               if ((flags & RTF_GATEWAY) && !gateway)
> ---
> >                 if (flags & RTF_GATEWAY) {
> >                     if (!gateway)
> 747a750,752
> >                     if (dst && (dst->sa_family != gateway->sa_family))
> >                         senderr(EPERM);
> >                 }
> -------------

Please post unified diffs, they are far easier to read for humans.

>   After the patch,
> 
> -------------
> heavygear# route add 10.1.1.1 -inet6 fe80::1%fxp0
> route: writing to routing socket: Operation not permitted

EINVAL might be a more appropriate error code.

-- 
Andre



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?429EEE8C.86657ED1>