summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/net/if_ethersubr.c8
-rw-r--r--sys/net/if_mpe.c4
-rw-r--r--sys/net/pf.c20
-rw-r--r--sys/net/pfkeyv2.c6
-rw-r--r--sys/net/radix_mpath.c4
-rw-r--r--sys/net/route.c21
-rw-r--r--sys/net/route.h12
-rw-r--r--sys/netinet/if_ether.c9
-rw-r--r--sys/netinet/ip_icmp.c8
-rw-r--r--sys/netinet/ip_input.c8
-rw-r--r--sys/netinet/ip_output.c9
-rw-r--r--sys/netinet/ip_spd.c6
-rw-r--r--sys/netinet6/icmp6.c6
-rw-r--r--sys/netinet6/in6.c8
-rw-r--r--sys/netinet6/in6_ifattach.c6
-rw-r--r--sys/netinet6/in6_src.c11
-rw-r--r--sys/netinet6/ip6_output.c10
-rw-r--r--sys/netinet6/nd6.c20
-rw-r--r--sys/netinet6/nd6_nbr.c4
-rw-r--r--sys/netinet6/nd6_rtr.c4
-rw-r--r--sys/netmpls/mpls_input.c6
-rw-r--r--sys/netmpls/mpls_output.c4
22 files changed, 101 insertions, 93 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 *);
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index 31a02254fd0..74411813623 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ether.c,v 1.136 2014/09/03 08:53:54 mpi Exp $ */
+/* $OpenBSD: if_ether.c,v 1.137 2014/11/01 21:40:38 mpi Exp $ */
/* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */
/*
@@ -366,7 +366,7 @@ arpresolve(struct arpcom *ac, struct rtentry *rt, struct mbuf *m,
"local address\n", inet_ntop(AF_INET,
&satosin(dst)->sin_addr, addr, sizeof(addr)));
} else {
- if ((la = arplookup(satosin(dst)->sin_addr.s_addr, RT_REPORT, 0,
+ if ((la = arplookup(satosin(dst)->sin_addr.s_addr, 1, 0,
ac->ac_if.if_rdomain)) != NULL)
rt = la->la_rt;
else
@@ -801,13 +801,16 @@ arplookup(u_int32_t addr, int create, int proxy, u_int tableid)
{
struct rtentry *rt;
struct sockaddr_inarp sin;
+ int flags;
memset(&sin, 0, sizeof(sin));
sin.sin_len = sizeof(sin);
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = addr;
sin.sin_other = proxy ? SIN_PROXY : 0;
- rt = rtalloc1((struct sockaddr *)&sin, create, tableid);
+ flags = (create) ? (RT_REPORT|RT_RESOLVE) : 0;
+
+ rt = rtalloc((struct sockaddr *)&sin, flags, tableid);
if (rt == 0)
return (0);
rt->rt_refcnt--;
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index 797b6d6ca32..79b1a12ddb0 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_icmp.c,v 1.125 2014/09/30 08:26:15 mpi Exp $ */
+/* $OpenBSD: ip_icmp.c,v 1.126 2014/11/01 21:40:38 mpi Exp $ */
/* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */
/*
@@ -715,7 +715,7 @@ icmp_reflect(struct mbuf *m, struct mbuf **op, struct in_ifaddr *ia)
sin.sin_family = AF_INET;
sin.sin_addr = ip->ip_dst;
- rt = rtalloc1(sintosa(&sin), 0, rtableid);
+ rt = rtalloc(sintosa(&sin), 0, rtableid);
if (rt != NULL) {
if (rt->rt_flags & (RTF_LOCAL|RTF_BROADCAST))
ia = ifatoia(rt->rt_ifa);
@@ -735,7 +735,7 @@ icmp_reflect(struct mbuf *m, struct mbuf **op, struct in_ifaddr *ia)
sin.sin_addr = ip->ip_src;
/* keep packet in the original virtual instance */
- rt = rtalloc1(sintosa(&sin), RT_REPORT, rtableid);
+ rt = rtalloc(sintosa(&sin), RT_REPORT|RT_RESOLVE, rtableid);
if (rt == NULL) {
ipstat.ips_noroute++;
m_freem(m);
@@ -924,7 +924,7 @@ icmp_mtudisc_clone(struct in_addr dst, u_int rtableid)
sin->sin_len = sizeof(*sin);
sin->sin_addr = dst;
- rt = rtalloc1(&ro.ro_dst, RT_REPORT, rtableid);
+ rt = rtalloc(&ro.ro_dst, RT_REPORT|RT_RESOLVE, rtableid);
if (rt == NULL)
return (NULL);
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 3324b736687..63496171a1b 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_input.c,v 1.238 2014/10/14 09:52:26 mpi Exp $ */
+/* $OpenBSD: ip_input.c,v 1.239 2014/11/01 21:40:38 mpi Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/*
@@ -667,7 +667,7 @@ in_ouraddr(struct mbuf *m, struct ifnet *ifp, struct in_addr ina)
sin.sin_len = sizeof(sin);
sin.sin_family = AF_INET;
sin.sin_addr = ina;
- rt = rtalloc1(sintosa(&sin), 0, m->m_pkthdr.ph_rtableid);
+ rt = rtalloc(sintosa(&sin), 0, m->m_pkthdr.ph_rtableid);
if (rt != NULL) {
if (rt->rt_flags & (RTF_LOCAL|RTF_BROADCAST))
ia = ifatoia(rt->rt_ifa);
@@ -1251,8 +1251,8 @@ ip_rtaddr(struct in_addr dst, u_int rtableid)
sin->sin_len = sizeof(*sin);
sin->sin_addr = dst;
- ipforward_rt.ro_rt = rtalloc1(&ipforward_rt.ro_dst, RT_REPORT,
- rtableid);
+ ipforward_rt.ro_rt = rtalloc(&ipforward_rt.ro_dst,
+ RT_REPORT|RT_RESOLVE, rtableid);
}
if (ipforward_rt.ro_rt == 0)
return (NULL);
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 8fd2a91f27a..9e36e6a8743 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_output.c,v 1.269 2014/10/14 09:52:26 mpi Exp $ */
+/* $OpenBSD: ip_output.c,v 1.270 2014/11/01 21:40:38 mpi Exp $ */
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
/*
@@ -583,7 +583,8 @@ sendit:
rt->rt_rmx.rmx_mtu = icmp_mtu;
if (ro && ro->ro_rt != NULL) {
rtfree(ro->ro_rt);
- ro->ro_rt = rtalloc1(&ro->ro_dst, RT_REPORT,
+ ro->ro_rt = rtalloc(&ro->ro_dst,
+ RT_REPORT|RT_RESOLVE,
m->m_pkthdr.ph_rtableid);
}
if (rt_mtucloned)
@@ -1771,8 +1772,8 @@ ip_setmoptions(int optname, struct ip_moptions **imop, struct mbuf *m,
dst->sin_addr = mreq->imr_multiaddr;
if (!(ro.ro_rt && ro.ro_rt->rt_ifp &&
(ro.ro_rt->rt_flags & RTF_UP)))
- ro.ro_rt = rtalloc1(&ro.ro_dst, RT_REPORT,
- rtableid);
+ ro.ro_rt = rtalloc(&ro.ro_dst,
+ RT_REPORT|RT_RESOLVE, rtableid);
if (ro.ro_rt == NULL) {
error = EADDRNOTAVAIL;
break;
diff --git a/sys/netinet/ip_spd.c b/sys/netinet/ip_spd.c
index b35a20350d1..455895cfb07 100644
--- a/sys/netinet/ip_spd.c
+++ b/sys/netinet/ip_spd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_spd.c,v 1.74 2014/10/14 09:52:26 mpi Exp $ */
+/* $OpenBSD: ip_spd.c,v 1.75 2014/11/01 21:40:39 mpi Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
*
@@ -244,8 +244,8 @@ ipsp_spd_lookup(struct mbuf *m, int af, int hlen, int *error, int direction,
re->re_tableid = rdomain;
/* Actual SPD lookup. */
- 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) {
/*
* Return whatever the socket requirements are, there are no
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index 6aa29fa05bc..4334e1480bd 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: icmp6.c,v 1.149 2014/10/14 09:52:26 mpi Exp $ */
+/* $OpenBSD: icmp6.c,v 1.150 2014/11/01 21:40:39 mpi Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@@ -1432,7 +1432,7 @@ icmp6_redirect_input(struct mbuf *m, int off)
sin6.sin6_family = AF_INET6;
sin6.sin6_len = sizeof(struct sockaddr_in6);
bcopy(&reddst6, &sin6.sin6_addr, sizeof(reddst6));
- rt = rtalloc1(sin6tosa(&sin6), 0, m->m_pkthdr.ph_rtableid);
+ rt = rtalloc(sin6tosa(&sin6), 0, m->m_pkthdr.ph_rtableid);
if (rt) {
if (rt->rt_gateway == NULL ||
rt->rt_gateway->sa_family != AF_INET6) {
@@ -1939,7 +1939,7 @@ icmp6_mtudisc_clone(struct sockaddr *dst, u_int rdomain)
struct rtentry *rt;
int error;
- rt = rtalloc1(dst, RT_REPORT, rdomain);
+ rt = rtalloc(dst, RT_REPORT|RT_RESOLVE, rdomain);
if (rt == 0)
return NULL;
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index 2a33e6848b0..c0402138bbc 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.c,v 1.143 2014/10/22 09:48:19 stsp Exp $ */
+/* $OpenBSD: in6.c,v 1.144 2014/11/01 21:40:39 mpi Exp $ */
/* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */
/*
@@ -870,7 +870,7 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra,
* actually do not need the routes, since they usually specify
* the outgoing interface.
*/
- rt = rtalloc1(sin6tosa(&mltaddr), 0, ifp->if_rdomain);
+ rt = rtalloc(sin6tosa(&mltaddr), 0, ifp->if_rdomain);
if (rt) {
/*
* 32bit came from "mltmask"
@@ -941,7 +941,7 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra,
mltaddr.sin6_scope_id = 0;
/* XXX: again, do we really need the route? */
- rt = rtalloc1(sin6tosa(&mltaddr), 0, ifp->if_rdomain);
+ rt = rtalloc(sin6tosa(&mltaddr), 0, ifp->if_rdomain);
if (rt) {
/* 32bit came from "mltmask" */
if (memcmp(&mltaddr.sin6_addr,
@@ -1604,7 +1604,7 @@ in6_ifpprefix(const struct ifnet *ifp, const struct in6_addr *addr)
dst.sin6_len = sizeof(struct sockaddr_in6);
dst.sin6_family = AF_INET6;
dst.sin6_addr = *addr;
- rt = rtalloc1(sin6tosa(&dst), RT_NOCLONING, tableid);
+ rt = rtalloc(sin6tosa(&dst), 0, tableid);
if (rt == NULL)
return (0);
diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c
index 7f812902a6b..9faae1dc100 100644
--- a/sys/netinet6/in6_ifattach.c
+++ b/sys/netinet6/in6_ifattach.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_ifattach.c,v 1.73 2014/08/25 14:00:34 florian Exp $ */
+/* $OpenBSD: in6_ifattach.c,v 1.74 2014/11/01 21:40:39 mpi Exp $ */
/* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */
/*
@@ -656,7 +656,7 @@ in6_ifdetach(struct ifnet *ifp)
sin6.sin6_family = AF_INET6;
sin6.sin6_addr = in6addr_intfacelocal_allnodes;
sin6.sin6_addr.s6_addr16[1] = htons(ifp->if_index);
- rt = rtalloc1(sin6tosa(&sin6), 0, ifp->if_rdomain);
+ rt = rtalloc(sin6tosa(&sin6), 0, ifp->if_rdomain);
if (rt && rt->rt_ifp == ifp) {
struct rt_addrinfo info;
@@ -676,7 +676,7 @@ in6_ifdetach(struct ifnet *ifp)
sin6.sin6_family = AF_INET6;
sin6.sin6_addr = in6addr_linklocal_allnodes;
sin6.sin6_addr.s6_addr16[1] = htons(ifp->if_index);
- rt = rtalloc1(sin6tosa(&sin6), 0, ifp->if_rdomain);
+ rt = rtalloc(sin6tosa(&sin6), 0, ifp->if_rdomain);
if (rt && rt->rt_ifp == ifp) {
struct rt_addrinfo info;
diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c
index 5fc56b90951..e8d9bf2f8a5 100644
--- a/sys/netinet6/in6_src.c
+++ b/sys/netinet6/in6_src.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_src.c,v 1.47 2014/10/14 09:52:26 mpi Exp $ */
+/* $OpenBSD: in6_src.c,v 1.48 2014/11/01 21:40:39 mpi Exp $ */
/* $KAME: in6_src.c,v 1.36 2001/02/06 04:08:17 itojun Exp $ */
/*
@@ -264,8 +264,8 @@ 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)) {
- ro->ro_rt = rtalloc1(sin6tosa(&ro->ro_dst),
- RT_REPORT, ro->ro_tableid);
+ ro->ro_rt = rtalloc(sin6tosa(&ro->ro_dst),
+ RT_REPORT|RT_RESOLVE, ro->ro_tableid);
} else {
ro->ro_rt = rtalloc_mpath(sin6tosa(&ro->ro_dst),
NULL, ro->ro_tableid);
@@ -382,8 +382,9 @@ selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts,
ron->ro_tableid = rtableid;
}
if (ron->ro_rt == NULL) {
- ron->ro_rt = rtalloc1(sin6tosa(&ron->ro_dst),
- RT_REPORT, ron->ro_tableid); /* multi path case? */
+ /* multi path case? */
+ ron->ro_rt = rtalloc(sin6tosa(&ron->ro_dst),
+ RT_REPORT|RT_RESOLVE, ron->ro_tableid);
if (ron->ro_rt == NULL ||
(ron->ro_rt->rt_flags & RTF_GATEWAY)) {
if (ron->ro_rt) {
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
index 357b9b3ddcb..d690bbf1fd3 100644
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_output.c,v 1.160 2014/10/14 09:52:26 mpi Exp $ */
+/* $OpenBSD: ip6_output.c,v 1.161 2014/11/01 21:40:39 mpi Exp $ */
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
/*
@@ -1229,8 +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;
- ro_pmtu->ro_rt = rtalloc1(sin6tosa(&ro_pmtu->ro_dst),
- RT_REPORT, ro_pmtu->ro_tableid);
+ ro_pmtu->ro_rt = rtalloc(sin6tosa(&ro_pmtu->ro_dst),
+ RT_REPORT|RT_RESOLVE, ro_pmtu->ro_tableid);
}
}
if (ro_pmtu->ro_rt) {
@@ -2483,8 +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;
- ro.ro_rt = rtalloc1(sin6tosa(&ro.ro_dst),
- RT_REPORT, ro.ro_tableid);
+ ro.ro_rt = rtalloc(sin6tosa(&ro.ro_dst),
+ RT_REPORT|RT_RESOLVE, ro.ro_tableid);
if (ro.ro_rt == NULL) {
error = EADDRNOTAVAIL;
break;
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index 4fb5ebd2a25..d7a6e8c6dc2 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6.c,v 1.123 2014/10/14 09:52:26 mpi Exp $ */
+/* $OpenBSD: nd6.c,v 1.124 2014/11/01 21:40:39 mpi Exp $ */
/* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */
/*
@@ -649,13 +649,15 @@ nd6_lookup(struct in6_addr *addr6, int create, struct ifnet *ifp,
{
struct rtentry *rt;
struct sockaddr_in6 sin6;
+ int flags;
bzero(&sin6, sizeof(sin6));
sin6.sin6_len = sizeof(struct sockaddr_in6);
sin6.sin6_family = AF_INET6;
sin6.sin6_addr = *addr6;
+ flags = (create) ? (RT_REPORT|RT_RESOLVE) : 0;
- rt = rtalloc1(sin6tosa(&sin6), create, rtableid);
+ rt = rtalloc(sin6tosa(&sin6), flags, rtableid);
if (rt && (rt->rt_flags & RTF_LLINFO) == 0) {
/*
* This is the case for the default route.
@@ -1390,7 +1392,7 @@ nd6_cache_lladdr(struct ifnet *ifp, struct in6_addr *from, char *lladdr,
return NULL;
#endif
- rt = nd6_lookup(from, RT_REPORT, ifp, ifp->if_rdomain);
+ rt = nd6_lookup(from, 1, ifp, ifp->if_rdomain);
is_newentry = 1;
} else {
/* do nothing if static ndp is set */
@@ -1672,8 +1674,9 @@ nd6_output(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *m0,
*/
if (rt) {
if ((rt->rt_flags & RTF_UP) == 0) {
- if ((rt0 = rt = rtalloc1(sin6tosa(dst),
- RT_REPORT, m->m_pkthdr.ph_rtableid)) != NULL)
+ if ((rt0 = rt = rtalloc(sin6tosa(dst),
+ RT_REPORT|RT_RESOLVE,
+ m->m_pkthdr.ph_rtableid)) != NULL)
{
rt->rt_refcnt--;
if (rt->rt_ifp != ifp)
@@ -1711,8 +1714,9 @@ nd6_output(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *m0,
if (((rt = rt->rt_gwroute)->rt_flags & RTF_UP) == 0) {
rtfree(rt); rt = rt0;
lookup:
- rt->rt_gwroute = rtalloc1(rt->rt_gateway,
- RT_REPORT, m->m_pkthdr.ph_rtableid);
+ rt->rt_gwroute = rtalloc(rt->rt_gateway,
+ RT_REPORT|RT_RESOLVE,
+ m->m_pkthdr.ph_rtableid);
if ((rt = rt->rt_gwroute) == 0)
senderr(EHOSTUNREACH);
}
@@ -1736,7 +1740,7 @@ nd6_output(struct ifnet *ifp, struct ifnet *origifp, struct mbuf *m0,
* it is tolerable, because this should be a rare case.
*/
if (nd6_is_addr_neighbor(dst, ifp) &&
- (rt = nd6_lookup(&dst->sin6_addr, RT_REPORT, ifp,
+ (rt = nd6_lookup(&dst->sin6_addr, 1, ifp,
ifp->if_rdomain)) != NULL)
ln = (struct llinfo_nd6 *)rt->rt_llinfo;
}
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
index 555509dbc16..68fe2ce3943 100644
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6_nbr.c,v 1.81 2014/10/14 09:52:26 mpi Exp $ */
+/* $OpenBSD: nd6_nbr.c,v 1.82 2014/11/01 21:40:39 mpi Exp $ */
/* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */
/*
@@ -219,7 +219,7 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len)
tsin6.sin6_family = AF_INET6;
tsin6.sin6_addr = taddr6;
- rt = rtalloc1(sin6tosa(&tsin6), 0, m->m_pkthdr.ph_rtableid);
+ rt = rtalloc(sin6tosa(&tsin6), 0, m->m_pkthdr.ph_rtableid);
if (rt && (rt->rt_flags & RTF_ANNOUNCE) != 0 &&
rt->rt_gateway->sa_family == AF_LINK) {
/*
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c
index 4ef50837cb6..331885d82b0 100644
--- a/sys/netinet6/nd6_rtr.c
+++ b/sys/netinet6/nd6_rtr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6_rtr.c,v 1.88 2014/10/07 08:47:28 mpi Exp $ */
+/* $OpenBSD: nd6_rtr.c,v 1.89 2014/11/01 21:40:39 mpi Exp $ */
/* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */
/*
@@ -685,7 +685,7 @@ defrouter_reset(void)
/*
* XXX should we also nuke any default routers in the kernel, by
- * going through them by rtalloc1()?
+ * going through them by rtalloc()?
*/
}
diff --git a/sys/netmpls/mpls_input.c b/sys/netmpls/mpls_input.c
index 4a5aba55f3c..0bdce93a28c 100644
--- a/sys/netmpls/mpls_input.c
+++ b/sys/netmpls/mpls_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpls_input.c,v 1.39 2014/10/14 09:52:26 mpi Exp $ */
+/* $OpenBSD: mpls_input.c,v 1.40 2014/11/01 21:40:39 mpi Exp $ */
/*
* Copyright (c) 2008 Claudio Jeker <claudio@openbsd.org>
@@ -205,7 +205,7 @@ do_v6:
}
}
- rt = rtalloc1(smplstosa(smpls), RT_REPORT, 0);
+ rt = rtalloc(smplstosa(smpls), RT_REPORT|RT_RESOLVE, 0);
if (rt == NULL) {
/* no entry for this label */
#ifdef MPLS_DEBUG
@@ -455,7 +455,7 @@ mpls_do_error(struct mbuf *m, int type, int code, int destmtu)
smpls->smpls_len = sizeof(*smpls);
smpls->smpls_label = shim->shim_label & MPLS_LABEL_MASK;
- rt = rtalloc1(smplstosa(smpls), RT_REPORT, 0);
+ rt = rtalloc(smplstosa(smpls), RT_REPORT|RT_RESOLVE, 0);
if (rt == NULL) {
/* no entry for this label */
m_freem(m);
diff --git a/sys/netmpls/mpls_output.c b/sys/netmpls/mpls_output.c
index ec8504969de..e25ee92f356 100644
--- a/sys/netmpls/mpls_output.c
+++ b/sys/netmpls/mpls_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpls_output.c,v 1.17 2014/07/22 11:06:10 mpi Exp $ */
+/* $OpenBSD: mpls_output.c,v 1.18 2014/11/01 21:40:39 mpi Exp $ */
/*
* Copyright (c) 2008 Claudio Jeker <claudio@openbsd.org>
@@ -121,7 +121,7 @@ mpls_output(struct ifnet *ifp0, struct mbuf *m, struct sockaddr *dst,
break;
smpls->smpls_label = shim->shim_label & MPLS_LABEL_MASK;
- rt = rtalloc1(smplstosa(smpls), RT_REPORT, 0);
+ rt = rtalloc(smplstosa(smpls), RT_REPORT|RT_RESOLVE, 0);
if (rt == NULL) {
/* no entry for this label */
#ifdef MPLS_DEBUG