Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Nov 2009 13:15:01 +0100
From:      <Hartmut.Brandt@dlr.de>
To:        <freebsd-net@freebsd.org>
Subject:   Need help on IPv6 prefixes and interface addresses
Message-ID:  <E086A96846579E4F932C168218DB1E55024128@exbe5.intra.dlr.de>

next in thread | raw e-mail | index | archive | help

Hi all,

I try to make bsnmpd IPv6 aware and need some help here. I've set up a =
small IPv6 network for testing between a couple of VMs.

For IPv6 interface addresses there are two tables: ipAddressPrefix table =
and ipAddressTable (containing pointers to the prefix table). Now I see =
something on my system I cannot grasp. ndp -pn gives me:

2001:638:101:ff::/64 if=3Dle0
flags=3DLO vltime=3Dinfinity, pltime=3Dinfinity, expire=3DNever, ref=3D1
  No advertising router
fe80::%le0/64 if=3Dle0
flags=3DLAO vltime=3Dinfinity, pltime=3Dinfinity, expire=3DNever, =
ref=3D0
  No advertising router
fe80::%lo0/64 if=3Dlo0
flags=3DLAO vltime=3Dinfinity, pltime=3Dinfinity, expire=3DNever, =
ref=3D0
  No advertising router

ifconfig -a inet6 gives:

le0: flags=3D8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu =
1500
        options=3D8<VLAN_MTU>
        inet6 fe80::20c:29ff:fe90:dd1b%le0 prefixlen 64 scopeid 0x1=20
        inet6 2001:638:101:ff::8:ffff prefixlen 64=20
lo0: flags=3D8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=3D3<RXCSUM,TXCSUM>
        inet6 ::1 prefixlen 128=20
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2=20

So far, so nice.

When I ask for the interface addresses via sysctl([0, NET_RT_IFLIST, 0], =
...) I get strange RTM_NEWADDR messages:

msglen=3D76 version=3D5 type=3DRTM_NEWADDR
    flags=3D0
    index=3D1 metric=3D0
    netmask=3DINET6,28,{0,0,ffff:ffff:ffff:ffff::,0}
    ifa=3DINET6,28,{0,0,fe80:1::20c:29ff:fe90:dd1b,0}

Which means a prefix of fe80:1::/64 instead of fe80::%le0/64. Note, the =
:1: there and note the zero missing scope_id
(the last 0 inside the {}). Same for lo0:

msglen=3D80 version=3D5 type=3DRTM_NEWADDR
    flags=3D0
    index=3D2 metric=3D0
    netmask=3DINET6,28,{0,0,ffff:ffff:ffff:ffff::,0}
    ifa=3DINET6,28,{0,0,fe80:2::1,0}
    brd=3DUNSPEC,0,{}

So my questions:
  - are the routing message really that inconsistent and broken? Or do I =
read them somehow incorrect?
  - is it possible to rely on the prefix table? In other words: Does =
*each* prefix used
    in a INET6 interface address appear in the prefix list?

harti



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