diff options
author | 2014-09-27 12:26:16 +0000 | |
---|---|---|
committer | 2014-09-27 12:26:16 +0000 | |
commit | 0d0932bcad01f527409fbdad6fb4759b1a73fd2b (patch) | |
tree | 3b942c800a271c14708cffafb01759497e6006e2 | |
parent | add back inverted poison patterns. keep high bits, but twiddle low bits. (diff) | |
download | wireguard-openbsd-0d0932bcad01f527409fbdad6fb4759b1a73fd2b.tar.xz wireguard-openbsd-0d0932bcad01f527409fbdad6fb4759b1a73fd2b.zip |
Kill rtalloc() and update rtalloc1() and rtalloc_mpath() to no longer
rely on "struct route" that should die.
ok claudio@
-rw-r--r-- | sys/net/pf.c | 4 | ||||
-rw-r--r-- | sys/net/pfkeyv2.c | 5 | ||||
-rw-r--r-- | sys/net/radix_mpath.c | 52 | ||||
-rw-r--r-- | sys/net/radix_mpath.h | 4 | ||||
-rw-r--r-- | sys/net/route.c | 10 | ||||
-rw-r--r-- | sys/net/route.h | 5 | ||||
-rw-r--r-- | sys/netinet/in_pcb.c | 11 | ||||
-rw-r--r-- | sys/netinet/ip_input.c | 5 | ||||
-rw-r--r-- | sys/netinet/ip_output.c | 8 | ||||
-rw-r--r-- | sys/netinet/ip_spd.c | 5 | ||||
-rw-r--r-- | sys/netinet6/frag6.c | 5 | ||||
-rw-r--r-- | sys/netinet6/in6_src.c | 14 | ||||
-rw-r--r-- | sys/netinet6/ip6_forward.c | 15 | ||||
-rw-r--r-- | sys/netinet6/ip6_input.c | 8 | ||||
-rw-r--r-- | sys/netinet6/ip6_output.c | 8 |
15 files changed, 83 insertions, 76 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c index 2546586ae13..2a074b6048f 100644 --- a/sys/net/pf.c +++ b/sys/net/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.886 2014/08/12 15:29:33 mikeb Exp $ */ +/* $OpenBSD: pf.c,v 1.887 2014/09/27 12:26:16 mpi Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -5567,7 +5567,7 @@ pf_route(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp, ro->ro_tableid = m0->m_pkthdr.ph_rtableid; if (!r->rt) { - rtalloc(ro); + ro->ro_rt = rtalloc1(&ro->ro_dst, RT_REPORT, ro->ro_tableid); if (ro->ro_rt == 0) { ipstat.ips_noroute++; goto bad; diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c index 2eee83fe76e..7197bbcee2d 100644 --- a/sys/net/pfkeyv2.c +++ b/sys/net/pfkeyv2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkeyv2.c,v 1.133 2014/07/12 18:44:22 tedu Exp $ */ +/* $OpenBSD: pfkeyv2.c,v 1.134 2014/09/27 12:26:16 mpi Exp $ */ /* * @(#)COPYRIGHT 1.1 (NRL) 17 January 1995 @@ -1569,7 +1569,8 @@ pfkeyv2_send(struct socket *socket, void *message, int len) /* Set the rdomain that was obtained from the socket */ re.re_tableid = rdomain; - rtalloc((struct route *) &re); + re.re_rt = rtalloc1((struct sockaddr *)&re.re_dst, RT_REPORT, + re.re_tableid); if (re.re_rt != NULL) { ipo = ((struct sockaddr_encap *) re.re_rt->rt_gateway)->sen_ipsp; RTFREE(re.re_rt); diff --git a/sys/net/radix_mpath.c b/sys/net/radix_mpath.c index 3766ca598ca..c3d8672a883 100644 --- a/sys/net/radix_mpath.c +++ b/sys/net/radix_mpath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radix_mpath.c,v 1.23 2014/05/27 19:38:15 claudio Exp $ */ +/* $OpenBSD: radix_mpath.c,v 1.24 2014/09/27 12:26:16 mpi Exp $ */ /* $KAME: radix_mpath.c,v 1.13 2002/10/28 21:05:59 itojun Exp $ */ /* @@ -53,7 +53,7 @@ #include <netinet6/ip6_var.h> #endif -u_int32_t rn_mpath_hash(struct route *, u_int32_t *); +u_int32_t rn_mpath_hash(struct sockaddr *, u_int32_t *); /* * give some jitter to hash, to avoid synchronization between routers @@ -383,42 +383,37 @@ rn_mpath_reprio(struct radix_node *rn, int newprio) /* * allocate a route, potentially using multipath to select the peer. */ -void -rtalloc_mpath(struct route *ro, u_int32_t *srcaddrp) +struct rtentry * +rtalloc_mpath(struct sockaddr *dst, u_int32_t *srcaddrp, u_int rtableid) { + struct rtentry *rt; #if defined(INET) || defined(INET6) struct radix_node *rn; int hash, npaths, threshold; #endif - /* - * return a cached entry if it is still valid, otherwise we increase - * the risk of disrupting local flows. - */ - if (ro->ro_rt && ro->ro_rt->rt_ifp && (ro->ro_rt->rt_flags & RTF_UP)) - return; - ro->ro_rt = rtalloc1(&ro->ro_dst, RT_REPORT, ro->ro_tableid); + rt = rtalloc1(dst, RT_REPORT, rtableid); /* if the route does not exist or it is not multipath, don't care */ - if (!ro->ro_rt || !(ro->ro_rt->rt_flags & RTF_MPATH)) - return; + if (rt == NULL || !ISSET(rt->rt_flags, RTF_MPATH)) + return (rt); /* check if multipath routing is enabled for the specified protocol */ if (!(0 #ifdef INET - || (ipmultipath && ro->ro_dst.sa_family == AF_INET) + || (ipmultipath && dst->sa_family == AF_INET) #endif #ifdef INET6 - || (ip6_multipath && ro->ro_dst.sa_family == AF_INET6) + || (ip6_multipath && dst->sa_family == AF_INET6) #endif )) - return; + return (rt); #if defined(INET) || defined(INET6) /* gw selection by Hash-Threshold (RFC 2992) */ - rn = (struct radix_node *)ro->ro_rt; + rn = (struct radix_node *)rt; npaths = rn_mpath_active_count(rn); - hash = rn_mpath_hash(ro, srcaddrp) & 0xffff; + hash = rn_mpath_hash(dst, srcaddrp) & 0xffff; threshold = 1 + (0xffff / npaths); while (hash > threshold && rn) { /* stay within the multipath routes */ @@ -427,13 +422,14 @@ rtalloc_mpath(struct route *ro, u_int32_t *srcaddrp) } /* if gw selection fails, use the first match (default) */ - if (!rn) - return; - - rtfree(ro->ro_rt); - ro->ro_rt = (struct rtentry *)rn; - ro->ro_rt->rt_refcnt++; + if (rn != NULL) { + rtfree(rt); + rt = (struct rtentry *)rn; + rt->rt_refcnt++; + } #endif + + return (rt); } int @@ -468,20 +464,20 @@ rn_mpath_inithead(void **head, int off) } while (0) u_int32_t -rn_mpath_hash(struct route *ro, u_int32_t *srcaddrp) +rn_mpath_hash(struct sockaddr *dst, u_int32_t *srcaddrp) { u_int32_t a, b, c; a = b = 0x9e3779b9; c = hashjitter; - switch (ro->ro_dst.sa_family) { + switch (dst->sa_family) { #ifdef INET case AF_INET: { struct sockaddr_in *sin_dst; - sin_dst = (struct sockaddr_in *)&ro->ro_dst; + sin_dst = (struct sockaddr_in *)dst; a += sin_dst->sin_addr.s_addr; b += srcaddrp ? srcaddrp[0] : 0; mix(a, b, c); @@ -493,7 +489,7 @@ rn_mpath_hash(struct route *ro, u_int32_t *srcaddrp) { struct sockaddr_in6 *sin6_dst; - sin6_dst = (struct sockaddr_in6 *)&ro->ro_dst; + sin6_dst = (struct sockaddr_in6 *)dst; a += sin6_dst->sin6_addr.s6_addr32[0]; b += sin6_dst->sin6_addr.s6_addr32[2]; c += srcaddrp ? srcaddrp[0] : 0; diff --git a/sys/net/radix_mpath.h b/sys/net/radix_mpath.h index f8b642decf6..d4b317af1ab 100644 --- a/sys/net/radix_mpath.h +++ b/sys/net/radix_mpath.h @@ -1,4 +1,4 @@ -/* $OpenBSD: radix_mpath.h,v 1.12 2014/05/27 19:38:15 claudio Exp $ */ +/* $OpenBSD: radix_mpath.h,v 1.13 2014/09/27 12:26:16 mpi Exp $ */ /* $KAME: radix_mpath.h,v 1.9 2004/03/30 11:21:49 keiichi Exp $ */ /* @@ -57,7 +57,7 @@ struct rtentry *rt_mpath_matchgate(struct rtentry *, struct sockaddr *, u_int8_t); int rt_mpath_conflict(struct radix_node_head *, struct rtentry *, struct sockaddr *, int); -void rtalloc_mpath(struct route *, u_int32_t *); +struct rtentry *rtalloc_mpath(struct sockaddr *, u_int32_t *, u_int); int rn_mpath_inithead(void **, int); #endif /* _KERNEL */ diff --git a/sys/net/route.c b/sys/net/route.c index 1fdac6ae619..4ac1bd157d4 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.182 2014/09/03 08:51:01 mpi Exp $ */ +/* $OpenBSD: route.c,v 1.183 2014/09/27 12:26:16 mpi Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -322,14 +322,6 @@ rtalloc_noclone(struct route *ro) ro->ro_tableid); } -void -rtalloc(struct route *ro) -{ - if (ro->ro_rt && ro->ro_rt->rt_ifp && (ro->ro_rt->rt_flags & RTF_UP)) - return; /* cached route is still valid */ - ro->ro_rt = rtalloc1(&ro->ro_dst, RT_REPORT, ro->ro_tableid); -} - struct rtentry * rtalloc1(struct sockaddr *dst, int flags, u_int tableid) { diff --git a/sys/net/route.h b/sys/net/route.h index f610a1618da..20cc104b6a9 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -1,4 +1,4 @@ -/* $OpenBSD: route.h,v 1.96 2014/08/12 13:52:08 mpi Exp $ */ +/* $OpenBSD: route.h,v 1.97 2014/09/27 12:26:16 mpi Exp $ */ /* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */ /* @@ -381,9 +381,8 @@ unsigned long rt_timer_queue_count(struct rttimer_queue *); void rt_timer_timer(void *); void rtalloc_noclone(struct route *); -void rtalloc(struct route *); #ifdef SMALL_KERNEL -#define rtalloc_mpath(r, s) rtalloc(r) +#define rtalloc_mpath(dst, s, rtableid) rtalloc1((dst), RT_REPORT, (rtableid)) #endif struct rtentry * rtalloc1(struct sockaddr *, int, u_int); diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index ed3115e2b84..f799797cc73 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.158 2014/07/22 11:06:10 mpi Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.159 2014/09/27 12:26:16 mpi Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -612,6 +612,7 @@ in_losing(struct inpcb *inp) if ((rt = inp->inp_route.ro_rt)) { inp->inp_route.ro_rt = 0; + bzero((caddr_t)&info, sizeof(info)); info.rti_flags = rt->rt_flags; info.rti_info[RTAX_DST] = &inp->inp_route.ro_dst; @@ -764,7 +765,8 @@ in_pcbrtentry(struct inpcb *inp) ro->ro_dst.sa_len = sizeof(struct sockaddr_in6); satosin6(&ro->ro_dst)->sin6_addr = inp->inp_faddr6; ro->ro_tableid = inp->inp_rtableid; - rtalloc_mpath(ro, &inp->inp_laddr6.s6_addr32[0]); + ro->ro_rt = rtalloc_mpath(&ro->ro_dst, + &inp->inp_laddr6.s6_addr32[0], ro->ro_tableid); break; #endif /* INET6 */ case PF_INET: @@ -774,7 +776,8 @@ in_pcbrtentry(struct inpcb *inp) ro->ro_dst.sa_len = sizeof(struct sockaddr_in); satosin(&ro->ro_dst)->sin_addr = inp->inp_faddr; ro->ro_tableid = inp->inp_rtableid; - rtalloc_mpath(ro, &inp->inp_laddr.s_addr); + ro->ro_rt = rtalloc_mpath(&ro->ro_dst, + &inp->inp_laddr.s_addr, ro->ro_tableid); break; } } @@ -838,7 +841,7 @@ in_selectsrc(struct in_addr **insrc, struct sockaddr_in *sin, ro->ro_dst.sa_len = sizeof(struct sockaddr_in); satosin(&ro->ro_dst)->sin_addr = sin->sin_addr; ro->ro_tableid = rtableid; - rtalloc_mpath(ro, NULL); + ro->ro_rt = rtalloc_mpath(&ro->ro_dst, NULL, ro->ro_tableid); /* * It is important to bzero out the rest of the diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 3cc4897d792..46213926aa6 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.235 2014/07/13 13:57:56 mpi Exp $ */ +/* $OpenBSD: ip_input.c,v 1.236 2014/09/27 12:26:16 mpi Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -1424,7 +1424,8 @@ ip_forward(struct mbuf *m, struct ifnet *ifp, int srcrt) sin->sin_addr = ip->ip_dst; ipforward_rt.ro_tableid = rtableid; - rtalloc_mpath(&ipforward_rt, &ip->ip_src.s_addr); + ipforward_rt.ro_rt = rtalloc_mpath(&ipforward_rt.ro_dst, + &ip->ip_src.s_addr, ipforward_rt.ro_tableid); if (ipforward_rt.ro_rt == 0) { icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, dest, 0); return; diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index cfe4ef4ca15..2244cef7de8 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_output.c,v 1.266 2014/07/22 11:06:10 mpi Exp $ */ +/* $OpenBSD: ip_output.c,v 1.267 2014/09/27 12:26:16 mpi Exp $ */ /* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */ /* @@ -196,7 +196,8 @@ ip_output(struct mbuf *m0, struct mbuf *opt, struct route *ro, int flags, IFP_TO_IA(ifp, ia); } else { if (ro->ro_rt == 0) - rtalloc_mpath(ro, NULL); + ro->ro_rt = rtalloc_mpath(&ro->ro_dst, + NULL, ro->ro_tableid); if (ro->ro_rt == 0) { ipstat.ips_noroute++; @@ -346,7 +347,8 @@ reroute: IFP_TO_IA(ifp, ia); } else { if (ro->ro_rt == 0) - rtalloc_mpath(ro, &ip->ip_src.s_addr); + ro->ro_rt = rtalloc_mpath(&ro->ro_dst, + &ip->ip_src.s_addr, ro->ro_tableid); if (ro->ro_rt == 0) { ipstat.ips_noroute++; diff --git a/sys/netinet/ip_spd.c b/sys/netinet/ip_spd.c index dddb6dcead3..815a175924e 100644 --- a/sys/netinet/ip_spd.c +++ b/sys/netinet/ip_spd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_spd.c,v 1.72 2014/07/22 11:06:10 mpi Exp $ */ +/* $OpenBSD: ip_spd.c,v 1.73 2014/09/27 12:26:16 mpi Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) * @@ -244,7 +244,8 @@ ipsp_spd_lookup(struct mbuf *m, int af, int hlen, int *error, int direction, re->re_tableid = rdomain; /* Actual SPD lookup. */ - rtalloc((struct route *) re); + re->re_rt = rtalloc1((struct sockaddr *)&re->re_dst, RT_REPORT, + re->re_tableid); if (re->re_rt == NULL) { /* * Return whatever the socket requirements are, there are no diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c index dd8950aaa97..356b45ad66a 100644 --- a/sys/netinet6/frag6.c +++ b/sys/netinet6/frag6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: frag6.c,v 1.54 2014/07/22 11:06:10 mpi Exp $ */ +/* $OpenBSD: frag6.c,v 1.55 2014/09/27 12:26:16 mpi Exp $ */ /* $KAME: frag6.c,v 1.40 2002/05/27 21:40:31 itojun Exp $ */ /* @@ -194,7 +194,8 @@ frag6_input(struct mbuf **mp, int *offp, int proto) dst->sin6_len = sizeof(struct sockaddr_in6); dst->sin6_addr = ip6->ip6_dst; - rtalloc_mpath((struct route *)&ro, &ip6->ip6_src.s6_addr32[0]); + ro.ro_rt = rtalloc_mpath(sin6tosa(&ro.ro_dst), + &ip6->ip6_src.s6_addr32[0], ro.ro_tableid); if (ro.ro_rt != NULL && ro.ro_rt->rt_ifa != NULL) dstifp = ifatoia6(ro.ro_rt->rt_ifa)->ia_ifp; diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c index 6df0f49b5aa..85a1153d97a 100644 --- a/sys/netinet6/in6_src.c +++ b/sys/netinet6/in6_src.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_src.c,v 1.45 2014/07/22 11:06:10 mpi Exp $ */ +/* $OpenBSD: in6_src.c,v 1.46 2014/09/27 12:26:16 mpi Exp $ */ /* $KAME: in6_src.c,v 1.36 2001/02/06 04:08:17 itojun Exp $ */ /* @@ -264,9 +264,11 @@ in6_selectsrc(struct in6_addr **in6src, struct sockaddr_in6 *dstsock, sa6->sin6_addr = *dst; sa6->sin6_scope_id = dstsock->sin6_scope_id; if (IN6_IS_ADDR_MULTICAST(dst)) { - rtalloc((struct route *)ro); + ro->ro_rt = rtalloc1(sin6tosa(&ro->ro_dst), + RT_REPORT, ro->ro_tableid); } else { - rtalloc_mpath((struct route *)ro, NULL); + ro->ro_rt = rtalloc_mpath(sin6tosa(&ro->ro_dst), + NULL, ro->ro_tableid); } } @@ -380,7 +382,8 @@ selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, ron->ro_tableid = rtableid; } if (ron->ro_rt == NULL) { - rtalloc((struct route *)ron); /* multi path case? */ + ron->ro_rt = rtalloc1(sin6tosa(&ron->ro_dst), + RT_REPORT, ron->ro_tableid); /* multi path case? */ if (ron->ro_rt == NULL || (ron->ro_rt->rt_flags & RTF_GATEWAY)) { if (ron->ro_rt) { @@ -431,7 +434,8 @@ selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, *sa6 = *dstsock; sa6->sin6_scope_id = 0; ro->ro_tableid = rtableid; - rtalloc_mpath((struct route *)ro, NULL); + ro->ro_rt = rtalloc_mpath(sin6tosa(&ro->ro_dst), + NULL, ro->ro_tableid); } /* diff --git a/sys/netinet6/ip6_forward.c b/sys/netinet6/ip6_forward.c index cc66b458123..70513db5259 100644 --- a/sys/netinet6/ip6_forward.c +++ b/sys/netinet6/ip6_forward.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_forward.c,v 1.67 2014/06/03 13:32:24 mpi Exp $ */ +/* $OpenBSD: ip6_forward.c,v 1.68 2014/09/27 12:26:16 mpi Exp $ */ /* $KAME: ip6_forward.c,v 1.75 2001/06/29 12:42:13 jinmei Exp $ */ /* @@ -250,8 +250,10 @@ reroute: } /* this probably fails but give it a try again */ ip6_forward_rt.ro_tableid = rtableid; - rtalloc_mpath((struct route *)&ip6_forward_rt, - &ip6->ip6_src.s6_addr32[0]); + ip6_forward_rt.ro_rt = rtalloc_mpath( + sin6tosa(&ip6_forward_rt.ro_dst), + &ip6->ip6_src.s6_addr32[0], + ip6_forward_rt.ro_tableid); } if (ip6_forward_rt.ro_rt == 0) { @@ -277,9 +279,10 @@ reroute: dst->sin6_family = AF_INET6; dst->sin6_addr = ip6->ip6_dst; ip6_forward_rt.ro_tableid = rtableid; - - rtalloc_mpath((struct route *)&ip6_forward_rt, - &ip6->ip6_src.s6_addr32[0]); + ip6_forward_rt.ro_rt = rtalloc_mpath( + sin6tosa(&ip6_forward_rt.ro_dst), + &ip6->ip6_src.s6_addr32[0], + ip6_forward_rt.ro_tableid); if (ip6_forward_rt.ro_rt == 0) { ip6stat.ip6s_noroute++; diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 60e67fccd28..14c681791b9 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_input.c,v 1.128 2014/07/22 11:06:10 mpi Exp $ */ +/* $OpenBSD: ip6_input.c,v 1.129 2014/09/27 12:26:16 mpi Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -449,8 +449,10 @@ ip6_input(struct mbuf *m) ip6_forward_rt.ro_dst.sin6_addr = ip6->ip6_dst; ip6_forward_rt.ro_tableid = rtableid; - rtalloc_mpath((struct route *)&ip6_forward_rt, - &ip6->ip6_src.s6_addr32[0]); + ip6_forward_rt.ro_rt = rtalloc_mpath( + sin6tosa(&ip6_forward_rt.ro_dst), + &ip6->ip6_src.s6_addr32[0], + ip6_forward_rt.ro_tableid); } /* diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index ffa8be1278a..5b1dce4e0a2 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_output.c,v 1.158 2014/07/22 11:06:10 mpi Exp $ */ +/* $OpenBSD: ip6_output.c,v 1.159 2014/09/27 12:26:16 mpi Exp $ */ /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ /* @@ -1229,7 +1229,8 @@ ip6_getpmtu(struct route_in6 *ro_pmtu, struct route_in6 *ro, sa6_dst->sin6_len = sizeof(struct sockaddr_in6); sa6_dst->sin6_addr = *dst; - rtalloc((struct route *)ro_pmtu); + ro_pmtu->ro_rt = rtalloc1(sin6tosa(&ro_pmtu->ro_dst), + RT_REPORT, ro_pmtu->ro_tableid); } } if (ro_pmtu->ro_rt) { @@ -2482,7 +2483,8 @@ ip6_setmoptions(int optname, struct ip6_moptions **im6op, struct mbuf *m) dst->sin6_len = sizeof(struct sockaddr_in6); dst->sin6_family = AF_INET6; dst->sin6_addr = mreq->ipv6mr_multiaddr; - rtalloc((struct route *)&ro); + ro.ro_rt = rtalloc1(sin6tosa(&ro.ro_dst), + RT_REPORT, ro.ro_tableid); if (ro.ro_rt == NULL) { error = EADDRNOTAVAIL; break; |