summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2015-09-03 16:42:02 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2015-09-03 16:42:02 +0000
commita13d2136e313f1d62ce8cbefadd943d40dffe6be (patch)
tree4f05648648c52787066489fde7f52a8cb4465e34 /sys
parent3ddd6f773b3d747e191065e36c1e375178c993ee (diff)
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.c22
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)