diff options
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if_ethersubr.c | 8 | ||||
-rw-r--r-- | sys/net/if_mpe.c | 4 | ||||
-rw-r--r-- | sys/net/pf.c | 20 | ||||
-rw-r--r-- | sys/net/pfkeyv2.c | 6 | ||||
-rw-r--r-- | sys/net/radix_mpath.c | 4 | ||||
-rw-r--r-- | sys/net/route.c | 21 | ||||
-rw-r--r-- | sys/net/route.h | 12 |
7 files changed, 37 insertions, 38 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 9682aca3484..c596ee8f053 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ethersubr.c,v 1.175 2014/10/07 20:23:32 tedu Exp $ */ +/* $OpenBSD: if_ethersubr.c,v 1.176 2014/11/01 21:40:38 mpi Exp $ */ /* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */ /* @@ -285,7 +285,7 @@ ether_output(struct ifnet *ifp0, struct mbuf *m0, struct sockaddr *dst, senderr(ENETDOWN); if ((rt = rt0) != NULL) { if ((rt->rt_flags & RTF_UP) == 0) { - if ((rt0 = rt = rtalloc1(dst, RT_REPORT, + if ((rt0 = rt = rtalloc(dst, RT_REPORT|RT_RESOLVE, m->m_pkthdr.ph_rtableid)) != NULL) rt->rt_refcnt--; else @@ -299,8 +299,8 @@ ether_output(struct ifnet *ifp0, struct mbuf *m0, struct sockaddr *dst, rtfree(rt); rt = rt0; lookup: - rt->rt_gwroute = rtalloc1(rt->rt_gateway, - RT_REPORT, ifp->if_rdomain); + rt->rt_gwroute = rtalloc(rt->rt_gateway, + RT_REPORT|RT_RESOLVE, ifp->if_rdomain); if ((rt = rt->rt_gwroute) == NULL) senderr(EHOSTUNREACH); } diff --git a/sys/net/if_mpe.c b/sys/net/if_mpe.c index 0c0dedbd528..090264c7f28 100644 --- a/sys/net/if_mpe.c +++ b/sys/net/if_mpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mpe.c,v 1.37 2014/10/14 09:52:25 mpi Exp $ */ +/* $OpenBSD: if_mpe.c,v 1.38 2014/11/01 21:40:38 mpi Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@spootnik.org> @@ -163,7 +163,7 @@ mpestart(struct ifnet *ifp) continue; } - rt = rtalloc1(sa, RT_REPORT, 0); + rt = rtalloc(sa, RT_REPORT|RT_RESOLVE, 0); if (rt == NULL) { /* no route give up */ m_freem(m); diff --git a/sys/net/pf.c b/sys/net/pf.c index c9c8c8c4d72..923d20aac15 100644 --- a/sys/net/pf.c +++ b/sys/net/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.889 2014/10/14 09:52:25 mpi Exp $ */ +/* $OpenBSD: pf.c,v 1.890 2014/11/01 21:40:38 mpi Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -2968,8 +2968,7 @@ pf_calc_mss(struct pf_addr *addr, sa_family_t af, int rtableid, u_int16_t offer) dst->sin_len = sizeof(*dst); dst->sin_addr = addr->v4; ro.ro_tableid = rtableid; - ro.ro_rt = rtalloc1(&ro.ro_dst, RT_REPORT | RT_NOCLONING, - ro.ro_tableid); + ro.ro_rt = rtalloc(&ro.ro_dst, RT_REPORT, ro.ro_tableid); rt = ro.ro_rt; break; #endif /* INET */ @@ -2982,8 +2981,8 @@ pf_calc_mss(struct pf_addr *addr, sa_family_t af, int rtableid, u_int16_t offer) dst6->sin6_len = sizeof(*dst6); dst6->sin6_addr = addr->v6; ro6.ro_tableid = rtableid; - ro6.ro_rt = rtalloc1(sin6tosa(&ro6.ro_dst), - RT_REPORT | RT_NOCLONING, ro6.ro_tableid); + ro6.ro_rt = rtalloc(sin6tosa(&ro6.ro_dst), RT_REPORT, + ro6.ro_tableid); rt = ro6.ro_rt; break; #endif /* INET6 */ @@ -5437,8 +5436,8 @@ pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *kif, if (kif != NULL && kif->pfik_ifp->if_type == IFT_ENC) goto out; - ro.ro_rt = rtalloc1((struct sockaddr *)&ro.ro_dst, - RT_REPORT | RT_NOCLONING, ro.ro_tableid); + ro.ro_rt = rtalloc((struct sockaddr *)&ro.ro_dst, RT_REPORT, + ro.ro_tableid); if (ro.ro_rt != NULL) { /* No interface given, this is a no-route check */ @@ -5505,8 +5504,8 @@ pf_rtlabel_match(struct pf_addr *addr, sa_family_t af, struct pf_addr_wrap *aw, #endif /* INET6 */ } - ro.ro_rt = rtalloc1((struct sockaddr *)&ro.ro_dst, - RT_REPORT | RT_NOCLONING, ro.ro_tableid); + ro.ro_rt = rtalloc((struct sockaddr *)&ro.ro_dst, RT_REPORT, + ro.ro_tableid); if (ro.ro_rt != NULL) { if (ro.ro_rt->rt_labelid == aw->v.rtlabel) @@ -5571,7 +5570,8 @@ 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) { - ro->ro_rt = rtalloc1(&ro->ro_dst, RT_REPORT, ro->ro_tableid); + ro->ro_rt = rtalloc(&ro->ro_dst, RT_REPORT|RT_RESOLVE, + 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 f3c1154e715..c4f67fc37d1 100644 --- a/sys/net/pfkeyv2.c +++ b/sys/net/pfkeyv2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkeyv2.c,v 1.135 2014/10/14 09:52:26 mpi Exp $ */ +/* $OpenBSD: pfkeyv2.c,v 1.136 2014/11/01 21:40:38 mpi Exp $ */ /* * @(#)COPYRIGHT 1.1 (NRL) 17 January 1995 @@ -1569,8 +1569,8 @@ pfkeyv2_send(struct socket *socket, void *message, int len) /* Set the rdomain that was obtained from the socket */ re.re_tableid = rdomain; - re.re_rt = rtalloc1((struct sockaddr *)&re.re_dst, RT_REPORT, - re.re_tableid); + re.re_rt = rtalloc((struct sockaddr *)&re.re_dst, + RT_REPORT|RT_RESOLVE, 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 c3d8672a883..2bda40c2043 100644 --- a/sys/net/radix_mpath.c +++ b/sys/net/radix_mpath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radix_mpath.c,v 1.24 2014/09/27 12:26:16 mpi Exp $ */ +/* $OpenBSD: radix_mpath.c,v 1.25 2014/11/01 21:40:38 mpi Exp $ */ /* $KAME: radix_mpath.c,v 1.13 2002/10/28 21:05:59 itojun Exp $ */ /* @@ -392,7 +392,7 @@ rtalloc_mpath(struct sockaddr *dst, u_int32_t *srcaddrp, u_int rtableid) int hash, npaths, threshold; #endif - rt = rtalloc1(dst, RT_REPORT, rtableid); + rt = rtalloc(dst, RT_REPORT|RT_RESOLVE, rtableid); /* if the route does not exist or it is not multipath, don't care */ if (rt == NULL || !ISSET(rt->rt_flags, RTF_MPATH)) diff --git a/sys/net/route.c b/sys/net/route.c index 227dd53810a..33083a5a7fd 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.187 2014/10/14 09:52:26 mpi Exp $ */ +/* $OpenBSD: route.c,v 1.188 2014/11/01 21:40:38 mpi Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -311,7 +311,7 @@ rtable_exists(u_int id) /* verify table with that ID exists */ } struct rtentry * -rtalloc1(struct sockaddr *dst, int flags, u_int tableid) +rtalloc(struct sockaddr *dst, int flags, unsigned int tableid) { struct radix_node_head *rnh; struct rtentry *rt; @@ -327,8 +327,7 @@ rtalloc1(struct sockaddr *dst, int flags, u_int tableid) if (rnh && (rn = rnh->rnh_matchaddr((caddr_t)dst, rnh)) && ((rn->rn_flags & RNF_ROOT) == 0)) { newrt = rt = (struct rtentry *)rn; - if ((rt->rt_flags & RTF_CLONING) && - ISSET(flags, RT_REPORT | RT_NOCLONING) == RT_REPORT) { + if ((rt->rt_flags & RTF_CLONING) && ISSET(flags, RT_RESOLVE)) { err = rtrequest1(RTM_RESOLVE, &info, RTP_DEFAULT, &newrt, tableid); if (err) { @@ -452,7 +451,7 @@ rtredirect(struct sockaddr *dst, struct sockaddr *gateway, goto out; } ifp = ifa->ifa_ifp; - rt = rtalloc1(dst, 0, rdomain); + rt = rtalloc(dst, 0, rdomain); /* * If the redirect isn't from our current router for this dst, * it's either old or wrong. If it redirects us to ourselves, @@ -651,7 +650,7 @@ ifa_ifwithroute(int flags, struct sockaddr *dst, struct sockaddr *gateway, } } if (ifa == NULL) { - struct rtentry *rt = rtalloc1(gateway, 0, rtable_l2(rtableid)); + struct rtentry *rt = rtalloc(gateway, 0, rtableid); if (rt == NULL) return (NULL); rt->rt_refcnt--; @@ -962,7 +961,7 @@ rtrequest1(int req, struct rt_addrinfo *info, u_int8_t prio, rn = rnh->rnh_addaddr((caddr_t)ndst, (caddr_t)info->rti_info[RTAX_NETMASK], rnh, rt->rt_nodes, rt->rt_priority); - if (rn == NULL && (crt = rtalloc1(ndst, 0, tableid)) != NULL) { + if (rn == NULL && (crt = rtalloc(ndst, 0, tableid)) != NULL) { /* overwrite cloned route */ if ((crt->rt_flags & RTF_CLONED) != 0) { rtdeletemsg(crt, tableid); @@ -1032,7 +1031,7 @@ rt_setgate(struct rtentry *rt, struct sockaddr *dst, struct sockaddr *gate, } if (rt->rt_flags & RTF_GATEWAY) { /* XXX is this actually valid to cross tables here? */ - rt->rt_gwroute = rtalloc1(gate, RT_REPORT, rtable_l2(tableid)); + rt->rt_gwroute = rtalloc(gate, RT_REPORT|RT_RESOLVE, tableid); /* * If we switched gateways, grab the MTU from the new * gateway route if the current MTU is 0 or greater @@ -1140,7 +1139,7 @@ rt_ifa_del(struct ifaddr *ifa, int flags, struct sockaddr *dst) rt_maskedcopy(dst, deldst, ifa->ifa_netmask); dst = deldst; } - if ((rt = rtalloc1(dst, 0, rtableid)) != NULL) { + if ((rt = rtalloc(dst, 0, rtableid)) != NULL) { rt->rt_refcnt--; /* try to find the right route */ while (rt && rt->rt_ifa != ifa) @@ -1217,7 +1216,7 @@ rt_ifa_addloop(struct ifaddr *ifa) flags |= RTF_LLINFO; /* If there is no loopback entry, allocate one. */ - rt = rtalloc1(ifa->ifa_addr, 0, ifa->ifa_ifp->if_rdomain); + rt = rtalloc(ifa->ifa_addr, 0, ifa->ifa_ifp->if_rdomain); if (rt == NULL || !ISSET(rt->rt_flags, flags)); rt_ifa_add(ifa, RTF_UP | flags, ifa->ifa_addr); if (rt) @@ -1264,7 +1263,7 @@ rt_ifa_delloop(struct ifaddr *ifa) * a subnet-router anycast address on an interface attached * to a shared medium. */ - rt = rtalloc1(ifa->ifa_addr, 0, ifa->ifa_ifp->if_rdomain); + rt = rtalloc(ifa->ifa_addr, 0, ifa->ifa_ifp->if_rdomain); if (rt != NULL && ISSET(rt->rt_flags, flags)) rt_ifa_del(ifa, flags, ifa->ifa_addr); if (rt) diff --git a/sys/net/route.h b/sys/net/route.h index 041cfcf37a9..eedf19613d1 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -1,4 +1,4 @@ -/* $OpenBSD: route.h,v 1.99 2014/10/14 09:52:26 mpi Exp $ */ +/* $OpenBSD: route.h,v 1.100 2014/11/01 21:40:38 mpi Exp $ */ /* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */ /* @@ -331,10 +331,10 @@ struct sockaddr *rtlabel_id2sa(u_int16_t, struct sockaddr_rtlabel *); void rtlabel_unref(u_int16_t); /* - * Values for additional argument to rtalloc1() + * Values for additional argument to rtalloc() */ #define RT_REPORT 0x1 -#define RT_NOCLONING 0x2 +#define RT_RESOLVE 0x2 extern struct rtstat rtstat; extern const struct sockaddr_rtin rt_defmask4; @@ -374,11 +374,11 @@ unsigned long rt_timer_queue_count(struct rttimer_queue *); void rt_timer_timer(void *); #ifdef SMALL_KERNEL -#define rtalloc_mpath(dst, s, rtableid) rtalloc1((dst), RT_REPORT, (rtableid)) +#define rtalloc_mpath(dst, s, rid) rtalloc((dst), RT_REPORT|RT_RESOLVE, (rid)) #endif -struct rtentry * - rtalloc1(struct sockaddr *, int, u_int); +struct rtentry *rtalloc(struct sockaddr *, int, unsigned int); void rtfree(struct rtentry *); + int rt_getifa(struct rt_addrinfo *, u_int); int rt_ifa_add(struct ifaddr *, int, struct sockaddr *); int rt_ifa_del(struct ifaddr *, int, struct sockaddr *); |