summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2016-07-05 10:17:14 +0000
committermpi <mpi@openbsd.org>2016-07-05 10:17:14 +0000
commitb2ea68e023bc715d6aea58ed6d1b6f4b07360e2a (patch)
tree1beec87bf20f030afa177c644d8d5161641479cd
parentsync (diff)
downloadwireguard-openbsd-b2ea68e023bc715d6aea58ed6d1b6f4b07360e2a.tar.xz
wireguard-openbsd-b2ea68e023bc715d6aea58ed6d1b6f4b07360e2a.zip
Expand IN6_IFF_NOTREADY, ok bluhm@
-rw-r--r--sys/netinet6/icmp6.c16
-rw-r--r--sys/netinet6/in6.c5
-rw-r--r--sys/netinet6/in6_pcb.c7
-rw-r--r--sys/netinet6/in6_src.c6
-rw-r--r--sys/netinet6/in6_var.h5
-rw-r--r--sys/netinet6/ip6_input.c12
-rw-r--r--sys/netinet6/mld6.c4
-rw-r--r--sys/netinet6/nd6_nbr.c6
-rw-r--r--sys/netinet6/nd6_rtr.c10
-rw-r--r--sys/netinet6/raw_ip6.c4
10 files changed, 32 insertions, 43 deletions
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index 5dcb434de68..98d1859b3e7 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: icmp6.c,v 1.185 2016/03/29 11:57:51 chl Exp $ */
+/* $OpenBSD: icmp6.c,v 1.186 2016/07/05 10:17:14 mpi Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@@ -1229,13 +1229,14 @@ icmp6_reflect(struct mbuf *m, size_t off)
/*
* If the incoming packet was addressed directly to us (i.e. unicast),
* use dst as the src for the reply.
- * The IN6_IFF_NOTREADY case would be VERY rare, but is possible
- * (for example) when we encounter an error while forwarding procedure
- * destined to a duplicated address of ours.
+ * The IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED case would be VERY rare,
+ * but is possible (for example) when we encounter an error while
+ * forwarding procedure destined to a duplicated address of ours.
*/
TAILQ_FOREACH(ia6, &in6_ifaddr, ia_list)
if (IN6_ARE_ADDR_EQUAL(&t, &ia6->ia_addr.sin6_addr) &&
- (ia6->ia6_flags & (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY)) == 0) {
+ (ia6->ia6_flags & (IN6_IFF_ANYCAST|IN6_IFF_TENTATIVE|
+ IN6_IFF_DUPLICATED)) == 0) {
src = &t;
break;
}
@@ -1621,9 +1622,8 @@ icmp6_redirect_output(struct mbuf *m0, struct rtentry *rt)
{
/* get ip6 linklocal address for ifp(my outgoing interface). */
struct in6_ifaddr *ia6;
- if ((ia6 = in6ifa_ifpforlinklocal(ifp,
- IN6_IFF_NOTREADY|
- IN6_IFF_ANYCAST)) == NULL)
+ if ((ia6 = in6ifa_ifpforlinklocal(ifp, IN6_IFF_TENTATIVE|
+ IN6_IFF_DUPLICATED|IN6_IFF_ANYCAST)) == NULL)
goto fail;
ifp_ll6 = &ia6->ia_addr.sin6_addr;
}
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index c775786b6f6..0de02a67d8d 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.c,v 1.187 2016/06/13 10:34:40 mpi Exp $ */
+/* $OpenBSD: in6.c,v 1.188 2016/07/05 10:17:14 mpi Exp $ */
/* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */
/*
@@ -1637,7 +1637,8 @@ in6_ifawithscope(struct ifnet *oifp, struct in6_addr *dst, u_int rdomain)
* Don't use an address before completing DAD
* nor a duplicated address.
*/
- if (ifatoia6(ifa)->ia6_flags & IN6_IFF_NOTREADY)
+ if (ifatoia6(ifa)->ia6_flags &
+ (IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED))
continue;
/* XXX: is there any case to allow anycasts? */
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
index 5a1ed86f081..41df3ee8d0f 100644
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_pcb.c,v 1.92 2016/04/11 21:24:29 vgross Exp $ */
+/* $OpenBSD: in6_pcb.c,v 1.93 2016/07/05 10:17:14 mpi Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -208,9 +208,8 @@ in6_pcbaddrisavail(struct inpcb *inp, struct sockaddr_in6 *sin6, int wild,
* flag to control the bind(2) behavior against
* deprecated addresses (default: forbid bind(2)).
*/
- if (ifa &&
- ifatoia6(ifa)->ia6_flags &
- (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY|IN6_IFF_DETACHED))
+ if (ifa && ifatoia6(ifa)->ia6_flags & (IN6_IFF_ANYCAST|
+ IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED|IN6_IFF_DETACHED))
return (EADDRNOTAVAIL);
}
if (lport) {
diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c
index 6cecd702199..fe46fd2da20 100644
--- a/sys/netinet6/in6_src.c
+++ b/sys/netinet6/in6_src.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_src.c,v 1.75 2016/07/05 09:17:10 mpi Exp $ */
+/* $OpenBSD: in6_src.c,v 1.76 2016/07/05 10:17:14 mpi Exp $ */
/* $KAME: in6_src.c,v 1.36 2001/02/06 04:08:17 itojun Exp $ */
/*
@@ -130,8 +130,8 @@ in6_selectsrc(struct in6_addr **in6src, struct sockaddr_in6 *dstsock,
if_put(ifp); /* put reference from in6_selectif */
ia6 = ifatoia6(ifa_ifwithaddr(sin6tosa(&sa6), rtableid));
- if (ia6 == NULL ||
- (ia6->ia6_flags & (IN6_IFF_ANYCAST | IN6_IFF_NOTREADY)))
+ if (ia6 == NULL || (ia6->ia6_flags &
+ (IN6_IFF_ANYCAST|IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED)))
return (EADDRNOTAVAIL);
pi->ipi6_addr = sa6.sin6_addr; /* XXX: this overrides pi */
diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h
index 9d9383d6007..3dc4d8c0310 100644
--- a/sys/netinet6/in6_var.h
+++ b/sys/netinet6/in6_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_var.h,v 1.63 2016/06/13 10:34:40 mpi Exp $ */
+/* $OpenBSD: in6_var.h,v 1.64 2016/07/05 10:17:14 mpi Exp $ */
/* $KAME: in6_var.h,v 1.55 2001/02/16 12:49:45 itojun Exp $ */
/*
@@ -328,9 +328,6 @@ struct in6_aliasreq {
#define IN6_IFF_AUTOCONF 0x40 /* autoconfigurable address. */
#define IN6_IFF_PRIVACY 0x80 /* RFC 4941 temporary address */
-/* do not input/output */
-#define IN6_IFF_NOTREADY (IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED)
-
#ifdef _KERNEL
#define IN6_ARE_SCOPE_CMP(a,b) ((a)-(b))
#define IN6_ARE_SCOPE_EQUAL(a,b) ((a)==(b))
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
index 83fd0fc2915..bbf9d4fb6dd 100644
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_input.c,v 1.160 2016/05/19 11:34:40 jca Exp $ */
+/* $OpenBSD: ip6_input.c,v 1.161 2016/07/05 10:17:14 mpi Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@@ -461,11 +461,7 @@ ip6_input(struct mbuf *m)
* packets to a tentative, duplicated, or somehow invalid
* address must not be accepted.
*/
- if (!(ia6->ia6_flags & IN6_IFF_NOTREADY)) {
- /* this address is ready */
- ours = 1;
- goto hbhcheck;
- } else {
+ if ((ia6->ia6_flags & (IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED))) {
char src[INET6_ADDRSTRLEN], dst[INET6_ADDRSTRLEN];
inet_ntop(AF_INET6, &ip6->ip6_src, src, sizeof(src));
@@ -476,6 +472,10 @@ ip6_input(struct mbuf *m)
src, dst));
goto bad;
+ } else {
+ /* this address is ready */
+ ours = 1;
+ goto hbhcheck;
}
}
diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c
index b41d086ceb6..8021cf7dc94 100644
--- a/sys/netinet6/mld6.c
+++ b/sys/netinet6/mld6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mld6.c,v 1.47 2016/03/07 18:44:00 naddy Exp $ */
+/* $OpenBSD: mld6.c,v 1.48 2016/07/05 10:17:14 mpi Exp $ */
/* $KAME: mld6.c,v 1.26 2001/02/16 14:50:35 itojun Exp $ */
/*
@@ -391,7 +391,7 @@ mld6_sendpkt(struct in6_multi *in6m, int type, const struct in6_addr *dst)
* We do not reject tentative addresses for MLD report to deal with
* the case where we first join a link-local address.
*/
- ignflags = (IN6_IFF_NOTREADY|IN6_IFF_ANYCAST) & ~IN6_IFF_TENTATIVE;
+ ignflags = IN6_IFF_DUPLICATED|IN6_IFF_ANYCAST;
if ((ia6 = in6ifa_ifpforlinklocal(ifp, ignflags)) == NULL) {
if_put(ifp);
return;
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
index 138e5eacc71..69e74a14a0e 100644
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6_nbr.c,v 1.104 2016/06/15 11:49:35 mpi Exp $ */
+/* $OpenBSD: nd6_nbr.c,v 1.105 2016/07/05 10:17:14 mpi Exp $ */
/* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */
/*
@@ -238,8 +238,8 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len)
/*
* proxy NDP for single entry
*/
- ifa = &in6ifa_ifpforlinklocal(ifp,
- IN6_IFF_NOTREADY | IN6_IFF_ANYCAST)->ia_ifa;
+ ifa = &in6ifa_ifpforlinklocal(ifp, IN6_IFF_TENTATIVE|
+ IN6_IFF_DUPLICATED|IN6_IFF_ANYCAST)->ia_ifa;
if (ifa) {
proxy = 1;
proxydl = satosdl(rt->rt_gateway);
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c
index 0058711a2cd..e5ffc328e6b 100644
--- a/sys/netinet6/nd6_rtr.c
+++ b/sys/netinet6/nd6_rtr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6_rtr.c,v 1.139 2016/05/02 22:15:49 jmatthew Exp $ */
+/* $OpenBSD: nd6_rtr.c,v 1.140 2016/07/05 10:17:14 mpi Exp $ */
/* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */
/*
@@ -1877,14 +1877,6 @@ in6_ifadd(struct nd_prefix *pr, int privacy)
else
return NULL;
-#if 0 /* don't care link local addr state, and always do DAD */
- /* if link-local address is not eligible, do not autoconfigure. */
- if (ifatoia6(ifa)->ia6_flags & IN6_IFF_NOTREADY) {
- printf("in6_ifadd: link-local address not ready\n");
- return NULL;
- }
-#endif
-
/* prefixlen + ifidlen must be equal to 128 */
plen0 = in6_mask2len(&ia6->ia_prefixmask.sin6_addr, NULL);
if (prefixlen != plen0) {
diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c
index b6b4966118d..724d502837e 100644
--- a/sys/netinet6/raw_ip6.c
+++ b/sys/netinet6/raw_ip6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ip6.c,v 1.90 2016/04/11 15:28:03 vgross Exp $ */
+/* $OpenBSD: raw_ip6.c,v 1.91 2016/07/05 10:17:14 mpi Exp $ */
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
/*
@@ -676,7 +676,7 @@ rip6_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
break;
}
if (ifa && ifatoia6(ifa)->ia6_flags &
- (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY|
+ (IN6_IFF_ANYCAST|IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED|
IN6_IFF_DETACHED|IN6_IFF_DEPRECATED)) {
error = EADDRNOTAVAIL;
break;