From: florian Date: Tue, 10 Jul 2018 20:43:26 +0000 (+0000) Subject: When an interface doesn't have a layer 2 address in6_get_ifid() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ee4d7c36d09abda7c46a7e657523a8b515f579fb;p=openbsd When an interface doesn't have a layer 2 address in6_get_ifid() tries to "borrow" one from another interface. But then it checks if the U bit is set int the generated EUI64 address and rejects it. On the other hand for interfaces that do have a layer 2 address this check is skipped, so relax it for the "borrowing" case, too. With this one gets stable link local addresses on e.g. gre(4) interfaces on certain virtualisation environments depending which mac addresses get picked for the vio(4) interfaces while previously we would end up with a random IP on every reboot. Reported by Aaron A. Glenn via phessler. OK phessler, benno --- diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index 41410046d18..9aea2260ad3 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_ifattach.c,v 1.107 2018/03/27 15:03:52 dhill Exp $ */ +/* $OpenBSD: in6_ifattach.c,v 1.108 2018/07/10 20:43:26 florian Exp $ */ /* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */ /* @@ -277,19 +277,8 @@ in6_get_ifid(struct ifnet *ifp0, struct in6_addr *in6) TAILQ_FOREACH(ifp, &ifnet, if_list) { if (ifp == ifp0) continue; - if (in6_get_hw_ifid(ifp, in6) != 0) - continue; - - /* - * to borrow ifid from other interface, ifid needs to be - * globally unique - */ - if (IFID_UNIVERSAL(in6)) { - nd6log((LOG_DEBUG, - "%s: borrow interface identifier from %s\n", - ifp0->if_xname, ifp->if_xname)); + if (in6_get_hw_ifid(ifp, in6) == 0) goto success; - } } /* last resort: get from random number source */