From: bluhm Date: Wed, 19 Apr 2017 15:21:54 +0000 (+0000) Subject: Use the rt_rmx defines that hide the struct rt_kmetrics indirection. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=9b6a64127deb1b83dcff3be06f373dc1b5768659;p=openbsd Use the rt_rmx defines that hide the struct rt_kmetrics indirection. No binary change. OK mpi@ --- diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c index 90c5fd75c29..47f88306699 100644 --- a/sys/net/if_loop.c +++ b/sys/net/if_loop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_loop.c,v 1.80 2017/01/24 10:08:30 krw Exp $ */ +/* $OpenBSD: if_loop.c,v 1.81 2017/04/19 15:21:54 bluhm Exp $ */ /* $NetBSD: if_loop.c,v 1.15 1996/05/07 02:40:33 thorpej Exp $ */ /* @@ -225,8 +225,8 @@ looutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, void lortrequest(struct ifnet *ifp, int cmd, struct rtentry *rt) { - if (rt && rt->rt_rmx.rmx_mtu == 0) - rt->rt_rmx.rmx_mtu = LOMTU; + if (rt && rt->rt_mtu == 0) + rt->rt_mtu = LOMTU; } /* diff --git a/sys/net/route.c b/sys/net/route.c index d9d7b9292c3..ffa4baa21f1 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.354 2017/03/06 08:56:39 mpi Exp $ */ +/* $OpenBSD: route.c,v 1.355 2017/04/19 15:21:54 bluhm Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -1522,7 +1522,7 @@ rt_timer_add(struct rtentry *rt, void (*func)(struct rtentry *, long current_time; current_time = time_uptime; - rt->rt_rmx.rmx_expire = time_uptime + queue->rtq_timeout; + rt->rt_expire = time_uptime + queue->rtq_timeout; /* * If there's already a timer with this action, destroy it before diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 53778a5c06d..2fc8db5550c 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.236 2017/04/05 13:35:18 deraadt Exp $ */ +/* $OpenBSD: rtsock.c,v 1.237 2017/04/19 15:21:54 bluhm Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -980,8 +980,8 @@ change: info->rti_info[RTAX_NETMASK]); /* FALLTHROUGH */ case RTM_LOCK: - rt->rt_rmx.rmx_locks &= ~(rtm->rtm_inits); - rt->rt_rmx.rmx_locks |= + rt->rt_locks &= ~(rtm->rtm_inits); + rt->rt_locks |= (rtm->rtm_inits & rtm->rtm_rmx.rmx_locks); break; } diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index 9d2d85fec6e..7712058a152 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_icmp.c,v 1.165 2017/04/14 20:46:31 bluhm Exp $ */ +/* $OpenBSD: ip_icmp.c,v 1.166 2017/04/19 15:21:54 bluhm Exp $ */ /* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */ /* @@ -1021,12 +1021,12 @@ icmp_mtudisc(struct icmp *icp, u_int rtableid) mtu = ntohs(icp->icmp_ip.ip_len); /* Some 4.2BSD-based routers incorrectly adjust the ip_len */ - if (mtu > rt->rt_rmx.rmx_mtu && rt->rt_rmx.rmx_mtu != 0) + if (mtu > rt->rt_mtu && rt->rt_mtu != 0) mtu -= (icp->icmp_ip.ip_hl << 2); /* If we still can't guess a value, try the route */ if (mtu == 0) { - mtu = rt->rt_rmx.rmx_mtu; + mtu = rt->rt_mtu; /* If no route mtu, default to the interface mtu */ @@ -1048,11 +1048,11 @@ icmp_mtudisc(struct icmp *icp, u_int rtableid) * on a route. We should be using a separate flag * for the kernel to indicate this. */ - if ((rt->rt_rmx.rmx_locks & RTV_MTU) == 0) { + if ((rt->rt_locks & RTV_MTU) == 0) { if (mtu < 296 || mtu > ifp->if_mtu) - rt->rt_rmx.rmx_locks |= RTV_MTU; - else if (rt->rt_rmx.rmx_mtu > mtu || rt->rt_rmx.rmx_mtu == 0) - rt->rt_rmx.rmx_mtu = mtu; + rt->rt_locks |= RTV_MTU; + else if (rt->rt_mtu > mtu || rt->rt_mtu == 0) + rt->rt_mtu = mtu; } if_put(ifp); @@ -1084,8 +1084,8 @@ icmp_mtudisc_timeout(struct rtentry *rt, struct rttimer *r) (*ctlfunc)(PRC_MTUINC, sintosa(&sin), r->rtt_tableid, NULL); } else { - if ((rt->rt_rmx.rmx_locks & RTV_MTU) == 0) - rt->rt_rmx.rmx_mtu = 0; + if ((rt->rt_locks & RTV_MTU) == 0) + rt->rt_mtu = 0; } if_put(ifp); diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 1f0814e58d5..9c55f8ebf12 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.297 2017/04/14 20:46:31 bluhm Exp $ */ +/* $OpenBSD: ip_input.c,v 1.298 2017/04/19 15:21:54 bluhm Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -1512,8 +1512,8 @@ ip_forward(struct mbuf *m, struct ifnet *ifp, struct rtentry *rt, int srcrt) #ifdef IPSEC if (rt != NULL) { - if (rt->rt_rmx.rmx_mtu) - destmtu = rt->rt_rmx.rmx_mtu; + if (rt->rt_mtu) + destmtu = rt->rt_mtu; else { struct ifnet *destifp; diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index da223746a4e..aa2d3dd2380 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_output.c,v 1.338 2017/04/11 14:43:49 dhill Exp $ */ +/* $OpenBSD: ip_output.c,v 1.339 2017/04/19 15:21:54 bluhm Exp $ */ /* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */ /* @@ -220,7 +220,7 @@ reroute: error = EHOSTUNREACH; goto bad; } - if ((mtu = ro->ro_rt->rt_rmx.rmx_mtu) == 0) + if ((mtu = ro->ro_rt->rt_mtu) == 0) mtu = ifp->if_mtu; if (ro->ro_rt->rt_flags & RTF_GATEWAY) @@ -399,7 +399,7 @@ sendit: * the route's MTU is locked. */ if ((flags & IP_MTUDISC) && ro && ro->ro_rt && - (ro->ro_rt->rt_rmx.rmx_locks & RTV_MTU) == 0) + (ro->ro_rt->rt_locks & RTV_MTU) == 0) ip->ip_off |= htons(IP_DF); #ifdef IPSEC @@ -488,9 +488,9 @@ sendit: */ if (rtisvalid(ro->ro_rt) && ISSET(ro->ro_rt->rt_flags, RTF_HOST) && - !(ro->ro_rt->rt_rmx.rmx_locks & RTV_MTU) && - (ro->ro_rt->rt_rmx.rmx_mtu > ifp->if_mtu)) { - ro->ro_rt->rt_rmx.rmx_mtu = ifp->if_mtu; + !(ro->ro_rt->rt_locks & RTV_MTU) && + (ro->ro_rt->rt_mtu > ifp->if_mtu)) { + ro->ro_rt->rt_mtu = ifp->if_mtu; } ipstat_inc(ips_cantfrag); goto bad; @@ -611,7 +611,7 @@ ip_output_ipsec_send(struct tdb *tdb, struct mbuf *m, struct ifnet *ifp, DPRINTF(("%s: spi %08x mtu %d rt %p cloned %d\n", __func__, ntohl(tdb->tdb_spi), tdb->tdb_mtu, rt, rt_mtucloned)); if (rt != NULL) { - rt->rt_rmx.rmx_mtu = tdb->tdb_mtu; + rt->rt_mtu = tdb->tdb_mtu; if (ro && ro->ro_rt != NULL) { rtfree(ro->ro_rt); ro->ro_rt = rtalloc(&ro->ro_dst, RT_RESOLVE, diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 4fdfac19491..cc6c08609be 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.340 2017/04/17 20:59:35 bluhm Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.341 2017/04/19 15:21:54 bluhm Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -2950,12 +2950,12 @@ tcp_mss(struct tcpcb *tp, int offer) * if there's an mtu associated with the route and we support * path MTU discovery for the underlying protocol family, use it. */ - if (rt->rt_rmx.rmx_mtu) { + if (rt->rt_mtu) { /* * One may wish to lower MSS to take into account options, * especially security-related options. */ - if (tp->pf == AF_INET6 && rt->rt_rmx.rmx_mtu < IPV6_MMTU) { + if (tp->pf == AF_INET6 && rt->rt_mtu < IPV6_MMTU) { /* * RFC2460 section 5, last paragraph: if path MTU is * smaller than 1280, use 1280 as packet size and @@ -2964,7 +2964,7 @@ tcp_mss(struct tcpcb *tp, int offer) mss = IPV6_MMTU - iphlen - sizeof(struct ip6_frag) - sizeof(struct tcphdr); } else { - mss = rt->rt_rmx.rmx_mtu - iphlen - + mss = rt->rt_mtu - iphlen - sizeof(struct tcphdr); } } else if (ifp->if_flags & IFF_LOOPBACK) { diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index fac36f32b37..931b8ec3d59 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_subr.c,v 1.160 2017/02/09 15:19:32 jca Exp $ */ +/* $OpenBSD: tcp_subr.c,v 1.161 2017/04/19 15:21:54 bluhm Exp $ */ /* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */ /* @@ -884,7 +884,7 @@ tcp_mtudisc(struct inpcb *inp, int errno) return; } if (orig_maxseg != tp->t_maxseg || - (rt->rt_rmx.rmx_locks & RTV_MTU)) + (rt->rt_locks & RTV_MTU)) change = 1; } tcp_mss(tp, -1); diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c index 2d615437284..72854fa11bd 100644 --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_timer.c,v 1.54 2017/02/09 15:19:32 jca Exp $ */ +/* $OpenBSD: tcp_timer.c,v 1.55 2017/04/19 15:21:54 bluhm Exp $ */ /* $NetBSD: tcp_timer.c,v 1.14 1996/02/13 23:44:09 christos Exp $ */ /* @@ -261,7 +261,7 @@ tcp_timer_rexmt(void *arg) rt = in_pcbrtentry(inp); /* Check if path MTU discovery is disabled already */ if (rt && (rt->rt_flags & RTF_HOST) && - (rt->rt_rmx.rmx_locks & RTV_MTU)) + (rt->rt_locks & RTV_MTU)) goto leave; rt = NULL; @@ -282,8 +282,8 @@ tcp_timer_rexmt(void *arg) } if (rt != NULL) { /* Disable path MTU discovery */ - if ((rt->rt_rmx.rmx_locks & RTV_MTU) == 0) { - rt->rt_rmx.rmx_locks |= RTV_MTU; + if ((rt->rt_locks & RTV_MTU) == 0) { + rt->rt_locks |= RTV_MTU; in_rtchange(inp, 0); } diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index ae8bc54f9f6..a71156371f0 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: icmp6.c,v 1.205 2017/04/14 20:46:31 bluhm Exp $ */ +/* $OpenBSD: icmp6.c,v 1.206 2017/04/19 15:21:54 bluhm Exp $ */ /* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */ /* @@ -1020,14 +1020,14 @@ icmp6_mtudisc_update(struct ip6ctlparam *ip6cp, int validated) rt = icmp6_mtudisc_clone(sin6tosa(&sin6), m->m_pkthdr.ph_rtableid); if (rt != NULL && ISSET(rt->rt_flags, RTF_HOST) && - !(rt->rt_rmx.rmx_locks & RTV_MTU) && - (rt->rt_rmx.rmx_mtu > mtu || rt->rt_rmx.rmx_mtu == 0)) { + !(rt->rt_locks & RTV_MTU) && + (rt->rt_mtu > mtu || rt->rt_mtu == 0)) { struct ifnet *ifp; ifp = if_get(rt->rt_ifidx); if (ifp != NULL && mtu < ifp->if_mtu) { icmp6stat_inc(icp6s_pmtuchg); - rt->rt_rmx.rmx_mtu = mtu; + rt->rt_mtu = mtu; } if_put(ifp); } @@ -1963,8 +1963,8 @@ icmp6_mtudisc_timeout(struct rtentry *rt, struct rttimer *r) if ((rt->rt_flags & (RTF_DYNAMIC|RTF_HOST)) == (RTF_DYNAMIC|RTF_HOST)) { rtdeletemsg(rt, ifp, r->rtt_tableid); } else { - if (!(rt->rt_rmx.rmx_locks & RTV_MTU)) - rt->rt_rmx.rmx_mtu = 0; + if (!(rt->rt_locks & RTV_MTU)) + rt->rt_mtu = 0; } if_put(ifp); diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index bf705dd4eec..e0b4ddfddda 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_output.c,v 1.226 2017/02/21 15:33:52 dhill Exp $ */ +/* $OpenBSD: ip6_output.c,v 1.227 2017/04/19 15:21:54 bluhm Exp $ */ /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ /* @@ -143,9 +143,9 @@ struct idgen32_ctx ip6_id_ctx; * The mbuf chain containing the packet will be freed. * The mbuf opt, if present, will not be freed. * - * type of "mtu": rt_rmx.rmx_mtu is u_long, ifnet.ifr_mtu is int, and + * type of "mtu": rt_mtu is u_long, ifnet.ifr_mtu is int, and * nd_ifinfo.linkmtu is u_int32_t. so we use u_long to hold largest one, - * which is rt_rmx.rmx_mtu. + * which is rt_mtu. */ int ip6_output(struct mbuf *m0, struct ip6_pktopts *opt, struct route_in6 *ro, @@ -1016,7 +1016,7 @@ ip6_getpmtu(struct rtentry *rt, struct ifnet *ifp, u_long *mtup) int error = 0; if (rt != NULL) { - mtu = rt->rt_rmx.rmx_mtu; + mtu = rt->rt_mtu; if (mtu == 0) mtu = ifp->if_mtu; else if (mtu < IPV6_MMTU) { @@ -1032,8 +1032,8 @@ ip6_getpmtu(struct rtentry *rt, struct ifnet *ifp, u_long *mtup) * field isn't locked). */ mtu = ifp->if_mtu; - if (!(rt->rt_rmx.rmx_locks & RTV_MTU)) - rt->rt_rmx.rmx_mtu = mtu; + if (!(rt->rt_locks & RTV_MTU)) + rt->rt_mtu = mtu; } } else { mtu = ifp->if_mtu;