diff options
author | 2015-09-03 16:42:01 +0000 | |
---|---|---|
committer | 2015-09-03 16:42:01 +0000 | |
commit | d66a764f448bc971337a1f750e184cb03953372c (patch) | |
tree | 64ef67b432b306b1c87cf9a2b9b589330de4bebf /sys | |
parent | match amd64; bios_efi_info_t is required here as well, because acpidump (diff) | |
download | wireguard-openbsd-d66a764f448bc971337a1f750e184cb03953372c.tar.xz wireguard-openbsd-d66a764f448bc971337a1f750e184cb03953372c.zip |
Change the order of operations for loopback interfaces to have
::1 configured before fe80::1.
(lo0:0) in pf should resolve to 127.0.0.1 ::1.
reported by and ok mikeb@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet6/in6_ifattach.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index ce13fffda8a..9ab969bec81 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_ifattach.c,v 1.94 2015/08/31 08:33:01 mpi Exp $ */ +/* $OpenBSD: in6_ifattach.c,v 1.95 2015/09/03 16:42:01 mpi Exp $ */ /* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */ /* @@ -484,20 +484,24 @@ in6_ifattach(struct ifnet *ifp) if ((ifp->if_flags & IFF_MULTICAST) == 0) return (EINVAL); - /* Assign a link-local address, if there's none. */ - if (in6ifa_ifpforlinklocal(ifp, 0) == NULL) { - if (in6_ifattach_linklocal(ifp, NULL) != 0) { - /* failed to assign linklocal address. bark? */ - } - } - /* Assign loopback address, if there's none. */ if (ifp->if_flags & IFF_LOOPBACK) { struct in6_addr in6 = in6addr_loopback; + int error; + if (in6ifa_ifpwithaddr(ifp, &in6) != NULL) return (0); - return (in6_ifattach_loopback(ifp)); + error = in6_ifattach_loopback(ifp); + if (error) + return (error); + } + + /* Assign a link-local address, if there's none. */ + if (in6ifa_ifpforlinklocal(ifp, 0) == NULL) { + if (in6_ifattach_linklocal(ifp, NULL) != 0) { + /* failed to assign linklocal address. bark? */ + } } if (ifp->if_xflags & IFXF_AUTOCONF6) |