While here add two missing ``rtableid'' checks in in6_selectsrc().
ok bluhm@
-/* $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 $ */
/*
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:
-/* $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.
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);
-/* $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 $ */
/*
* 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;
* 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) {
-/* $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 $ */
/*
/*
* 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);
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) {
-/* $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 $ */
/*
/*
* 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)
-/* $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 $ */
/*
/* 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;
}
-/* $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 $ */
/*
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;
}
-/* $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 $ */
/*
#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;