summaryrefslogtreecommitdiff
path: root/sys/netinet6
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/icmp6.c5
-rw-r--r--sys/netinet6/in6_pcb.c4
-rw-r--r--sys/netinet6/in6_src.c9
-rw-r--r--sys/netinet6/ip6_forward.c8
-rw-r--r--sys/netinet6/ip6_input.c5
-rw-r--r--sys/netinet6/ip6_output.c8
-rw-r--r--sys/netinet6/raw_ip6.c5
-rw-r--r--sys/netinet6/udp6_output.c5
8 files changed, 22 insertions, 27 deletions
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index 9d3f1c5453a..42dc651222d 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: icmp6.c,v 1.172 2015/09/18 14:26:22 mpi Exp $ */
+/* $OpenBSD: icmp6.c,v 1.173 2015/10/19 12:11:28 mpi Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@@ -1568,8 +1568,9 @@ icmp6_redirect_output(struct mbuf *m0, struct rtentry *rt)
goto fail;
/* sanity check */
- if (!m0 || !rt || !(rt->rt_flags & RTF_UP) || !(ifp = rt->rt_ifp))
+ if (m0 == NULL || !rtisvalid(rt))
goto fail;
+ ifp = rt->rt_ifp;
/*
* Address check:
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
index ad203234c1c..2f6d4c0fdf4 100644
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_pcb.c,v 1.79 2015/10/19 08:49:14 vgross Exp $ */
+/* $OpenBSD: in6_pcb.c,v 1.80 2015/10/19 12:11:28 mpi Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -416,7 +416,7 @@ in6_pcbconnect(struct inpcb *inp, struct mbuf *nam)
if (error)
return (error);
- if (inp->inp_route6.ro_rt && inp->inp_route6.ro_rt->rt_flags & RTF_UP)
+ if (rtisvalid(inp->inp_route6.ro_rt))
ifp = inp->inp_route6.ro_rt->rt_ifp;
inp->inp_ipv6.ip6_hlim = (u_int8_t)in6_selecthlim(inp, ifp);
diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c
index bbb916efece..ab1330e6aad 100644
--- a/sys/netinet6/in6_src.c
+++ b/sys/netinet6/in6_src.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_src.c,v 1.63 2015/10/13 10:16:17 mpi Exp $ */
+/* $OpenBSD: in6_src.c,v 1.64 2015/10/19 12:11:28 mpi Exp $ */
/* $KAME: in6_src.c,v 1.36 2001/02/06 04:08:17 itojun Exp $ */
/*
@@ -252,7 +252,7 @@ in6_selectsrc(struct in6_addr **in6src, struct sockaddr_in6 *dstsock,
* our src addr is taken from the i/f, else punt.
*/
if (ro) {
- if (!rtisvalid(ro->ro_rt) ||
+ if (!rtisvalid(ro->ro_rt) || (ro->ro_tableid != rtableid) ||
!IN6_ARE_ADDR_EQUAL(&ro->ro_dst.sin6_addr, dst)) {
rtfree(ro->ro_rt);
ro->ro_rt = NULL;
@@ -327,9 +327,8 @@ in6_selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts,
* by that address must be a neighbor of the sending host.
*/
ron = &opts->ip6po_nextroute;
- if ((ron->ro_rt &&
- (ron->ro_rt->rt_flags & (RTF_UP | RTF_GATEWAY)) !=
- RTF_UP) ||
+ if (!rtisvalid(ron->ro_rt) ||
+ ISSET(ron->ro_rt->rt_flags, RTF_GATEWAY) ||
!IN6_ARE_ADDR_EQUAL(&ron->ro_dst.sin6_addr,
&sin6_next->sin6_addr)) {
if (ron->ro_rt) {
diff --git a/sys/netinet6/ip6_forward.c b/sys/netinet6/ip6_forward.c
index 73d83a443f1..d152d42c235 100644
--- a/sys/netinet6/ip6_forward.c
+++ b/sys/netinet6/ip6_forward.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_forward.c,v 1.82 2015/09/10 09:14:59 mpi Exp $ */
+/* $OpenBSD: ip6_forward.c,v 1.83 2015/10/19 12:11:28 mpi Exp $ */
/* $KAME: ip6_forward.c,v 1.75 2001/06/29 12:42:13 jinmei Exp $ */
/*
@@ -223,8 +223,7 @@ reroute:
/*
* ip6_forward_rt.ro_dst.sin6_addr is equal to ip6->ip6_dst
*/
- if (ip6_forward_rt.ro_rt == NULL ||
- (ip6_forward_rt.ro_rt->rt_flags & RTF_UP) == 0 ||
+ if (!rtisvalid(ip6_forward_rt.ro_rt) ||
ip6_forward_rt.ro_tableid != rtableid) {
if (ip6_forward_rt.ro_rt) {
rtfree(ip6_forward_rt.ro_rt);
@@ -247,8 +246,7 @@ reroute:
m_freem(m);
return;
}
- } else if (ip6_forward_rt.ro_rt == NULL ||
- (ip6_forward_rt.ro_rt->rt_flags & RTF_UP) == 0 ||
+ } else if (!rtisvalid(ip6_forward_rt.ro_rt) ||
!IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, &dst->sin6_addr) ||
ip6_forward_rt.ro_tableid != rtableid) {
if (ip6_forward_rt.ro_rt) {
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
index e1d5ea58707..4cfcba24ac3 100644
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_input.c,v 1.147 2015/10/13 10:29:16 mpi Exp $ */
+/* $OpenBSD: ip6_input.c,v 1.148 2015/10/19 12:11:28 mpi Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@@ -415,8 +415,7 @@ ip6_input(struct mbuf *m)
/*
* Unicast check
*/
- if (ip6_forward_rt.ro_rt != NULL &&
- (ip6_forward_rt.ro_rt->rt_flags & RTF_UP) != 0 &&
+ if (rtisvalid(ip6_forward_rt.ro_rt) &&
IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst,
&ip6_forward_rt.ro_dst.sin6_addr) &&
rtableid == ip6_forward_rt.ro_tableid)
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
index efa01519c11..a3cae036bc1 100644
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_output.c,v 1.189 2015/09/23 08:49:46 mpi Exp $ */
+/* $OpenBSD: ip6_output.c,v 1.190 2015/10/19 12:11:28 mpi Exp $ */
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
/*
@@ -1151,9 +1151,9 @@ ip6_getpmtu(struct route_in6 *ro_pmtu, struct route_in6 *ro,
/* The first hop and the final destination may differ. */
struct sockaddr_in6 *sa6_dst = &ro_pmtu->ro_dst;
- if (ro_pmtu->ro_rt &&
- ((ro_pmtu->ro_rt->rt_flags & RTF_UP) == 0 ||
- !IN6_ARE_ADDR_EQUAL(&sa6_dst->sin6_addr, dst))) {
+ if (!rtisvalid(ro_pmtu->ro_rt) ||
+ (ro_pmtu->ro_tableid != ifp->if_rdomain) ||
+ !IN6_ARE_ADDR_EQUAL(&sa6_dst->sin6_addr, dst)) {
rtfree(ro_pmtu->ro_rt);
ro_pmtu->ro_rt = NULL;
}
diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c
index 875eb3c7b7c..9727c64aa6e 100644
--- a/sys/netinet6/raw_ip6.c
+++ b/sys/netinet6/raw_ip6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ip6.c,v 1.84 2015/09/11 08:17:06 claudio Exp $ */
+/* $OpenBSD: raw_ip6.c,v 1.85 2015/10/19 12:11:28 mpi Exp $ */
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
/*
@@ -421,8 +421,7 @@ rip6_output(struct mbuf *m, ...)
goto bad;
ip6->ip6_src = *in6a;
- if (in6p->inp_route6.ro_rt &&
- in6p->inp_route6.ro_rt->rt_flags & RTF_UP)
+ if (rtisvalid(in6p->inp_route6.ro_rt))
oifp = in6p->inp_route6.ro_rt->rt_ifp;
}
diff --git a/sys/netinet6/udp6_output.c b/sys/netinet6/udp6_output.c
index 13e7f2249da..61144b81bfc 100644
--- a/sys/netinet6/udp6_output.c
+++ b/sys/netinet6/udp6_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udp6_output.c,v 1.37 2015/09/11 08:17:06 claudio Exp $ */
+/* $OpenBSD: udp6_output.c,v 1.38 2015/10/19 12:11:28 mpi Exp $ */
/* $KAME: udp6_output.c,v 1.21 2001/02/07 11:51:54 itojun Exp $ */
/*
@@ -208,8 +208,7 @@ udp6_output(struct inpcb *in6p, struct mbuf *m, struct mbuf *addr6,
#endif
ip6->ip6_nxt = IPPROTO_UDP;
ifp = NULL;
- if (in6p->inp_route6.ro_rt &&
- in6p->inp_route6.ro_rt->rt_flags & RTF_UP)
+ if (rtisvalid(in6p->inp_route6.ro_rt))
ifp = in6p->inp_route6.ro_rt->rt_ifp;
ip6->ip6_hlim = in6_selecthlim(in6p, ifp);
ip6->ip6_src = *laddr;