Hey Paul,

On 20/05/14(Tue) 11:33, Paul de Weerd wrote:
> Hi all, Martin,
> 
> There seems to be an issue with generating eui64 addresses.

Indeed, thanks for reporting the problem.

> [weerd@pom] $ ifconfig em0
> em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
>         lladdr b8:ca:3a:93:03:e8
>         inet6 fe80::3c16:979e:9360:ec89%em0 prefixlen 64 scopeid 0x1
> [weerd@pom] $ sysctl kern.version
> kern.version=OpenBSD 5.5-current (GENERIC.MP) #136: Mon May 19 09:40:42 MDT 
> 2014
>     t...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
> 
> [weerd@twix] $ ifconfig vr0
> vr0: flags=48843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
>         lladdr 00:0d:b9:14:6f:08
>         inet6 fe80::cc08:36fd:9a4a:b30%vr0 prefixlen 64 scopeid 0x1
> [weerd@twix] $ sysctl kern.version
> kern.version=OpenBSD 5.5-current (GENERIC) #115: Mon May 19 08:39:42 MDT 2014
>     t...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
> 
> [weerd@drop] $ ifconfig iwn0
> iwn0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
>         lladdr 88:53:2e:d9:dd:9d
>         inet6 fe80::c0d9:7d41:5229:b6f3%iwn0 prefixlen 64 scopeid 0x1
> [weerd@drop] $ sysctl kern.version
> kern.version=OpenBSD 5.5-current (GENERIC.MP) #6: Sat May 17 11:23:06 CEST 
> 2014
>     we...@drop.weirdnet.nl:/usr/src/sys/arch/amd64/compile/GENERIC.MP
> 
> (ifconfig output redacted for brevity)
> 
> As can be seen, the host part of the link-local address doesn't
> resemble the lladdr at all.  This isn't a problem for outgoing
> connections, but when using SLAAC the global unicast address that is
> assigned is now suddenly different from what it used to be (so from
> what is in DNS), so I can't easily connect to my machines over IPv6
> anymore.
> 
> I'm not sure when this started, the last kernel that still worked with
> the 'regular' eui64 link-local address on machine 'pom' was:

This is regression introduced the 16/05 when I removed the link-layer
addresses from the RB-tree *and* the local list.  The problem is that
I forgot a custom look in inet6 generating eui64 addreses.  Diff below
fixes that for me, does it works for you?

Index: netinet6/in6_ifattach.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet6/in6_ifattach.c,v
retrieving revision 1.68
diff -u -p -r1.68 in6_ifattach.c
--- netinet6/in6_ifattach.c     21 Jan 2014 10:18:26 -0000      1.68
+++ netinet6/in6_ifattach.c     20 May 2014 09:53:42 -0000
@@ -141,14 +141,12 @@ in6_get_rand_ifid(struct ifnet *ifp, str
 
 /*
  * Get interface identifier for the specified interface.
- * XXX assumes single sockaddr_dl (AF_LINK address) per an interface
  *
  * in6 - upper 64bits are preserved
  */
 int
 get_hw_ifid(struct ifnet *ifp, struct in6_addr *in6)
 {
-       struct ifaddr *ifa;
        struct sockaddr_dl *sdl;
        char *addr;
        size_t addrlen;
@@ -156,21 +154,10 @@ get_hw_ifid(struct ifnet *ifp, struct in
        static u_int8_t allone[8] =
                { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 
-       TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
-               if (ifa->ifa_addr->sa_family != AF_LINK)
-                       continue;
-               sdl = (struct sockaddr_dl *)ifa->ifa_addr;
-               if (sdl == NULL)
-                       continue;
-               if (sdl->sdl_alen == 0)
-                       continue;
+       sdl = (struct sockaddr_dl *)ifp->if_sadl;
+       if (sdl == NULL || sdl->sdl_alen == 0)
+               return -1;
 
-               goto found;
-       }
-
-       return -1;
-
-found:
        addr = LLADDR(sdl);
        addrlen = sdl->sdl_alen;
 

Reply via email to