summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2006-06-16 16:49:41 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2006-06-16 16:49:41 +0000
commit9812d2fe804b7eef6fe9c72ce9b46280bb295ed0 (patch)
treec41b8d76dde5b62775e228da888bf9b06187c66f
parent0130c9137cea61e3309279b1ce04b5018ad92e83 (diff)
adjust functions dealing with the routing table to take a table ID as
parameter so they can work on alternate tables. table 0 hardcoded for many callers yet, that will be adapted step by step. input + ok claudio norby hshoexer
-rw-r--r--sys/net/if_ethersubr.c6
-rw-r--r--sys/net/if_fddisubr.c6
-rw-r--r--sys/net/pfkeyv2.c4
-rw-r--r--sys/net/radix_mpath.c6
-rw-r--r--sys/net/radix_mpath.h4
-rw-r--r--sys/net/route.c85
-rw-r--r--sys/net/route.h21
-rw-r--r--sys/net/rtsock.c17
-rw-r--r--sys/netinet/if_ether.c10
-rw-r--r--sys/netinet/in_pcb.c6
-rw-r--r--sys/netinet/ip_carp.c11
-rw-r--r--sys/netinet/ip_icmp.c14
-rw-r--r--sys/netinet/ip_input.c4
-rw-r--r--sys/netinet/ip_spd.c4
-rw-r--r--sys/netinet6/icmp6.c12
-rw-r--r--sys/netinet6/in6.c17
-rw-r--r--sys/netinet6/in6_ifattach.c10
-rw-r--r--sys/netinet6/in6_src.c4
-rw-r--r--sys/netinet6/ip6_output.c4
-rw-r--r--sys/netinet6/nd6.c14
-rw-r--r--sys/netinet6/nd6_nbr.c4
-rw-r--r--sys/netinet6/nd6_rtr.c14
22 files changed, 153 insertions, 124 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index d9f54680d0c..83bc9a43cd5 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ethersubr.c,v 1.102 2006/05/26 20:50:41 deraadt Exp $ */
+/* $OpenBSD: if_ethersubr.c,v 1.103 2006/06/16 16:49:39 henning Exp $ */
/* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */
/*
@@ -253,7 +253,7 @@ ether_output(ifp0, m0, dst, rt0)
senderr(ENETDOWN);
if ((rt = rt0) != NULL) {
if ((rt->rt_flags & RTF_UP) == 0) {
- if ((rt0 = rt = rtalloc1(dst, 1)) != NULL)
+ if ((rt0 = rt = rtalloc1(dst, 1, 0)) != NULL)
rt->rt_refcnt--;
else
senderr(EHOSTUNREACH);
@@ -263,7 +263,7 @@ ether_output(ifp0, m0, dst, rt0)
goto lookup;
if (((rt = rt->rt_gwroute)->rt_flags & RTF_UP) == 0) {
rtfree(rt); rt = rt0;
- lookup: rt->rt_gwroute = rtalloc1(rt->rt_gateway, 1);
+ lookup: rt->rt_gwroute = rtalloc1(rt->rt_gateway, 1, 0);
if ((rt = rt->rt_gwroute) == 0)
senderr(EHOSTUNREACH);
}
diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c
index d44036e0582..a15fb7bde22 100644
--- a/sys/net/if_fddisubr.c
+++ b/sys/net/if_fddisubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_fddisubr.c,v 1.48 2006/03/04 22:40:15 brad Exp $ */
+/* $OpenBSD: if_fddisubr.c,v 1.49 2006/06/16 16:49:39 henning Exp $ */
/* $NetBSD: if_fddisubr.c,v 1.5 1996/05/07 23:20:21 christos Exp $ */
/*
@@ -175,7 +175,7 @@ fddi_output(ifp0, m0, dst, rt0)
senderr(ENETDOWN);
if ((rt = rt0) != NULL) {
if ((rt->rt_flags & RTF_UP) == 0) {
- if ((rt0 = rt = rtalloc1(dst, 1)) != NULL)
+ if ((rt0 = rt = rtalloc1(dst, 1, 0)) != NULL)
rt->rt_refcnt--;
else
senderr(EHOSTUNREACH);
@@ -185,7 +185,7 @@ fddi_output(ifp0, m0, dst, rt0)
goto lookup;
if (((rt = rt->rt_gwroute)->rt_flags & RTF_UP) == 0) {
rtfree(rt); rt = rt0;
- lookup: rt->rt_gwroute = rtalloc1(rt->rt_gateway, 1);
+ lookup: rt->rt_gwroute = rtalloc1(rt->rt_gateway, 1, 0);
if ((rt = rt->rt_gwroute) == 0)
senderr(EHOSTUNREACH);
}
diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c
index ff9252293b2..418d72cf351 100644
--- a/sys/net/pfkeyv2.c
+++ b/sys/net/pfkeyv2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfkeyv2.c,v 1.110 2006/05/06 17:43:47 mcbride Exp $ */
+/* $OpenBSD: pfkeyv2.c,v 1.111 2006/06/16 16:49:39 henning Exp $ */
/*
* @(#)COPYRIGHT 1.1 (NRL) 17 January 1995
@@ -1678,7 +1678,7 @@ pfkeyv2_send(struct socket *socket, void *message, int len)
(struct sockaddr *) &encapgw,
(struct sockaddr *) &encapnetmask,
RTF_UP | RTF_GATEWAY | RTF_STATIC,
- (struct rtentry **) 0)) != 0) {
+ (struct rtentry **) 0, 0)) != 0) {
/* Remove from linked list of policies on TDB */
if (ipo->ipo_tdb)
TAILQ_REMOVE(&ipo->ipo_tdb->tdb_policy_head,
diff --git a/sys/net/radix_mpath.c b/sys/net/radix_mpath.c
index 3d0652a536a..a44d2adc8c8 100644
--- a/sys/net/radix_mpath.c
+++ b/sys/net/radix_mpath.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radix_mpath.c,v 1.4 2005/05/15 19:03:04 henning Exp $ */
+/* $OpenBSD: radix_mpath.c,v 1.5 2006/06/16 16:49:39 henning Exp $ */
/* $KAME: radix_mpath.c,v 1.13 2002/10/28 21:05:59 itojun Exp $ */
/*
@@ -209,7 +209,7 @@ rt_mpath_conflict(struct radix_node_head *rnh, struct rtentry *rt,
}
void
-rtalloc_mpath(struct route *ro, int hash)
+rtalloc_mpath(struct route *ro, int hash, u_int tableid)
{
struct radix_node *rn0, *rn;
int n;
@@ -220,7 +220,7 @@ rtalloc_mpath(struct route *ro, int hash)
*/
if (ro->ro_rt && ro->ro_rt->rt_ifp && (ro->ro_rt->rt_flags & RTF_UP))
return; /* XXX */
- ro->ro_rt = rtalloc1(&ro->ro_dst, 1);
+ ro->ro_rt = rtalloc1(&ro->ro_dst, 1, tableid);
/* if the route does not exist or it is not multipath, don't care */
if (!ro->ro_rt || !rn_mpath_next((struct radix_node *)ro->ro_rt))
return;
diff --git a/sys/net/radix_mpath.h b/sys/net/radix_mpath.h
index 8ee88ee34a8..0aea740f556 100644
--- a/sys/net/radix_mpath.h
+++ b/sys/net/radix_mpath.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: radix_mpath.h,v 1.3 2004/06/19 19:55:53 cedric Exp $ */
+/* $OpenBSD: radix_mpath.h,v 1.4 2006/06/16 16:49:39 henning Exp $ */
/* $KAME: radix_mpath.h,v 1.9 2004/03/30 11:21:49 keiichi Exp $ */
/*
@@ -50,7 +50,7 @@ int rn_mpath_count(struct radix_node *);
struct rtentry *rt_mpath_matchgate(struct rtentry *, struct sockaddr *);
int rt_mpath_conflict(struct radix_node_head *, struct rtentry *,
struct sockaddr *, int);
-void rtalloc_mpath(struct route *, int);
+void rtalloc_mpath(struct route *, int, u_int tableid);
int rn_mpath_inithead(void **, int);
#endif
diff --git a/sys/net/route.c b/sys/net/route.c
index c9ac3840b5a..34eb9142e59 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.78 2006/06/15 16:33:02 henning Exp $ */
+/* $OpenBSD: route.c,v 1.79 2006/06/16 16:49:39 henning Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -144,9 +144,8 @@ struct pool rtentry_pool; /* pool for rtentry structures */
struct pool rttimer_pool; /* pool for rttimer structures */
int rtable_init(struct radix_node_head ***);
-int rtable_add(u_int);
int okaytoclone(u_int, int);
-int rtdeletemsg(struct rtentry *);
+int rtdeletemsg(struct rtentry *, u_int);
int rtflushclone1(struct radix_node *, void *);
void rtflushclone(struct radix_node_head *, struct rtentry *);
int rt_if_remove_rtdelete(struct radix_node *, void *);
@@ -240,6 +239,21 @@ rtable_add(u_int id) /* must be called at splsoftnet */
return (rtable_init(&rt_tables[id]));
}
+int
+rtable_exists(u_int id) /* verify table with that ID exists */
+{
+ if (id > RT_TABLEID_MAX)
+ return (0);
+
+ if (id > rtbl_id_max)
+ return (0);
+
+ if (rt_tables[id] == NULL) /* should not happen */
+ return (0);
+
+ return (1);
+}
+
void
rtalloc_noclone(struct route *ro, int howstrict)
{
@@ -275,7 +289,7 @@ rtalloc2(struct sockaddr *dst, int report, int howstrict)
if (report && (rt->rt_flags & RTF_CLONING) &&
okaytoclone(rt->rt_flags, howstrict)) {
err = rtrequest(RTM_RESOLVE, dst, SA(0), SA(0), 0,
- &newrt);
+ &newrt, 0);
if (err) {
newrt = rt;
rt->rt_refcnt++;
@@ -293,7 +307,7 @@ miss:
if (report) {
bzero((caddr_t)&info, sizeof(info));
info.rti_info[RTAX_DST] = dst;
- rt_missmsg(msgtype, &info, 0, NULL, err);
+ rt_missmsg(msgtype, &info, 0, NULL, err, 0);
}
}
splx(s);
@@ -308,11 +322,11 @@ rtalloc(struct route *ro)
{
if (ro->ro_rt && ro->ro_rt->rt_ifp && (ro->ro_rt->rt_flags & RTF_UP))
return; /* XXX */
- ro->ro_rt = rtalloc1(&ro->ro_dst, 1);
+ ro->ro_rt = rtalloc1(&ro->ro_dst, 1, 0);
}
struct rtentry *
-rtalloc1(struct sockaddr *dst, int report)
+rtalloc1(struct sockaddr *dst, int report, u_int tableid)
{
struct radix_node_head *rnh;
struct rtentry *rt;
@@ -321,13 +335,13 @@ rtalloc1(struct sockaddr *dst, int report)
struct rt_addrinfo info;
int s = splsoftnet(), err = 0, msgtype = RTM_MISS;
- rnh = rt_gettable(dst->sa_family, 0);
+ rnh = rt_gettable(dst->sa_family, tableid);
if (rnh && (rn = rnh->rnh_matchaddr((caddr_t)dst, rnh)) &&
((rn->rn_flags & RNF_ROOT) == 0)) {
newrt = rt = (struct rtentry *)rn;
if (report && (rt->rt_flags & RTF_CLONING)) {
err = rtrequest(RTM_RESOLVE, dst, SA(NULL),
- SA(NULL), 0, &newrt);
+ SA(NULL), 0, &newrt, tableid);
if (err) {
newrt = rt;
rt->rt_refcnt++;
@@ -347,7 +361,8 @@ rtalloc1(struct sockaddr *dst, int report)
TAILQ_FIRST(&rt->rt_ifp->if_addrlist)->ifa_addr;
info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
}
- rt_missmsg(RTM_ADD, &info, rt->rt_flags, rt->rt_ifp, 0);
+ rt_missmsg(RTM_ADD, &info, rt->rt_flags,
+ rt->rt_ifp, 0, tableid);
} else
rt->rt_refcnt++;
} else {
@@ -362,7 +377,7 @@ miss:
if (report && dst->sa_family != PF_KEY) {
bzero((caddr_t)&info, sizeof(info));
info.rti_info[RTAX_DST] = dst;
- rt_missmsg(msgtype, &info, 0, NULL, err);
+ rt_missmsg(msgtype, &info, 0, NULL, err, tableid);
}
}
splx(s);
@@ -436,7 +451,7 @@ rtredirect(struct sockaddr *dst, struct sockaddr *gateway,
goto out;
}
ifp = ifa->ifa_ifp;
- rt = rtalloc1(dst, 0);
+ rt = rtalloc1(dst, 0, 0);
/*
* If the redirect isn't from our current router for this dst,
* it's either old or wrong. If it redirects us to ourselves,
@@ -482,7 +497,7 @@ create:
info.rti_ifa = ifa;
info.rti_flags = flags;
rt = NULL;
- error = rtrequest1(RTM_ADD, &info, &rt);
+ error = rtrequest1(RTM_ADD, &info, &rt, 0);
if (rt != NULL)
flags = rt->rt_flags;
stat = &rtstat.rts_dynamic;
@@ -494,7 +509,7 @@ create:
rt->rt_flags |= RTF_MODIFIED;
flags |= RTF_MODIFIED;
stat = &rtstat.rts_newgateway;
- rt_setgate(rt, rt_key(rt), gateway);
+ rt_setgate(rt, rt_key(rt), gateway, 0);
}
} else
error = EHOSTUNREACH;
@@ -515,14 +530,14 @@ out:
info.rti_info[RTAX_GATEWAY] = gateway;
info.rti_info[RTAX_NETMASK] = netmask;
info.rti_info[RTAX_AUTHOR] = src;
- rt_missmsg(RTM_REDIRECT, &info, flags, ifp, error);
+ rt_missmsg(RTM_REDIRECT, &info, flags, ifp, error, 0);
}
/*
* Delete a route and generate a message
*/
int
-rtdeletemsg(struct rtentry *rt)
+rtdeletemsg(struct rtentry *rt, u_int tableid)
{
int error;
struct rt_addrinfo info;
@@ -539,9 +554,9 @@ rtdeletemsg(struct rtentry *rt)
info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
info.rti_flags = rt->rt_flags;
ifp = rt->rt_ifp;
- error = rtrequest1(RTM_DELETE, &info, &rt);
+ error = rtrequest1(RTM_DELETE, &info, &rt, tableid);
- rt_missmsg(RTM_DELETE, &info, info.rti_flags, ifp, error);
+ rt_missmsg(RTM_DELETE, &info, info.rti_flags, ifp, error, tableid);
/* Adjust the refcount */
if (error == 0 && rt->rt_refcnt <= 0) {
@@ -559,7 +574,7 @@ rtflushclone1(struct radix_node *rn, void *arg)
rt = (struct rtentry *)rn;
parent = (struct rtentry *)arg;
if ((rt->rt_flags & RTF_CLONED) != 0 && rt->rt_parent == parent)
- rtdeletemsg(rt);
+ rtdeletemsg(rt, 0);
return 0;
}
@@ -622,7 +637,7 @@ ifa_ifwithroute(int flags, struct sockaddr *dst, struct sockaddr *gateway)
if (ifa == NULL)
ifa = ifa_ifwithnet(gateway);
if (ifa == NULL) {
- struct rtentry *rt = rtalloc1(gateway, 0);
+ struct rtentry *rt = rtalloc1(gateway, 0, 0);
if (rt == NULL)
return (NULL);
rt->rt_refcnt--;
@@ -646,7 +661,8 @@ ifa_ifwithroute(int flags, struct sockaddr *dst, struct sockaddr *gateway)
int
rtrequest(int req, struct sockaddr *dst, struct sockaddr *gateway,
- struct sockaddr *netmask, int flags, struct rtentry **ret_nrt)
+ struct sockaddr *netmask, int flags, struct rtentry **ret_nrt,
+ u_int tableid)
{
struct rt_addrinfo info;
@@ -655,7 +671,7 @@ rtrequest(int req, struct sockaddr *dst, struct sockaddr *gateway,
info.rti_info[RTAX_DST] = dst;
info.rti_info[RTAX_GATEWAY] = gateway;
info.rti_info[RTAX_NETMASK] = netmask;
- return (rtrequest1(req, &info, ret_nrt));
+ return (rtrequest1(req, &info, ret_nrt, tableid));
}
int
@@ -704,7 +720,8 @@ rt_getifa(struct rt_addrinfo *info)
}
int
-rtrequest1(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt)
+rtrequest1(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
+ u_int tableid)
{
int s = splsoftnet(); int error = 0;
struct rtentry *rt, *crt;
@@ -715,7 +732,8 @@ rtrequest1(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt)
struct sockaddr_rtlabel *sa_rl;
#define senderr(x) { error = x ; goto bad; }
- if ((rnh = rt_gettable(info->rti_info[RTAX_DST]->sa_family, 0)) == NULL)
+ if ((rnh = rt_gettable(info->rti_info[RTAX_DST]->sa_family, tableid)) ==
+ NULL)
senderr(EAFNOSUPPORT);
if (info->rti_flags & RTF_HOST)
info->rti_info[RTAX_NETMASK] = NULL;
@@ -798,7 +816,7 @@ makeroute:
rt->rt_flags = RTF_UP | info->rti_flags;
LIST_INIT(&rt->rt_timer);
if (rt_setgate(rt, info->rti_info[RTAX_DST],
- info->rti_info[RTAX_GATEWAY])) {
+ info->rti_info[RTAX_GATEWAY], tableid)) {
pool_put(&rtentry_pool, rt);
senderr(ENOBUFS);
}
@@ -842,10 +860,10 @@ makeroute:
}
rn = rnh->rnh_addaddr((caddr_t)ndst,
(caddr_t)info->rti_info[RTAX_NETMASK], rnh, rt->rt_nodes);
- if (rn == NULL && (crt = rtalloc1(ndst, 0)) != NULL) {
+ if (rn == NULL && (crt = rtalloc1(ndst, 0, tableid)) != NULL) {
/* overwrite cloned route */
if ((crt->rt_flags & RTF_CLONED) != 0) {
- rtdeletemsg(crt);
+ rtdeletemsg(crt, tableid);
rn = rnh->rnh_addaddr((caddr_t)ndst,
(caddr_t)info->rti_info[RTAX_NETMASK],
rnh, rt->rt_nodes);
@@ -883,7 +901,8 @@ bad:
}
int
-rt_setgate(struct rtentry *rt0, struct sockaddr *dst, struct sockaddr *gate)
+rt_setgate(struct rtentry *rt0, struct sockaddr *dst, struct sockaddr *gate,
+ u_int tableid)
{
caddr_t new, old;
int dlen = ROUNDUP(dst->sa_len), glen = ROUNDUP(gate->sa_len);
@@ -911,7 +930,7 @@ rt_setgate(struct rtentry *rt0, struct sockaddr *dst, struct sockaddr *gate)
rt->rt_gwroute = NULL;
}
if (rt->rt_flags & RTF_GATEWAY) {
- rt->rt_gwroute = rtalloc1(gate, 1);
+ rt->rt_gwroute = rtalloc1(gate, 1, tableid);
/*
* If we switched gateways, grab the MTU from the new
* gateway route if the current MTU is 0 or greater
@@ -972,7 +991,7 @@ rtinit(struct ifaddr *ifa, int cmd, int flags)
rt_maskedcopy(dst, deldst, ifa->ifa_netmask);
dst = deldst;
}
- if ((rt = rtalloc1(dst, 0)) != NULL) {
+ if ((rt = rtalloc1(dst, 0, 0)) != NULL) {
rt->rt_refcnt--;
if (rt->rt_ifa != ifa) {
if (m != NULL)
@@ -994,7 +1013,7 @@ rtinit(struct ifaddr *ifa, int cmd, int flags)
* change it to meet bsdi4 behavior.
*/
info.rti_info[RTAX_NETMASK] = ifa->ifa_netmask;
- error = rtrequest1(cmd, &info, &nrt);
+ error = rtrequest1(cmd, &info, &nrt, 0);
if (cmd == RTM_DELETE && error == 0 && (rt = nrt) != NULL) {
rt_newaddrmsg(cmd, ifa, error, nrt);
if (rt->rt_refcnt <= 0) {
@@ -1039,7 +1058,7 @@ static int rt_init_done = 0;
} else { \
rtrequest((int) RTM_DELETE, \
(struct sockaddr *)rt_key(r->rtt_rt), \
- 0, 0, 0, 0); \
+ 0, 0, 0, 0, 0); \
} \
}
@@ -1340,7 +1359,7 @@ rt_if_remove_rtdelete(struct radix_node *rn, void *vifp)
int cloning = (rt->rt_flags & RTF_CLONING);
if (rtrequest(RTM_DELETE, rt_key(rt), rt->rt_gateway,
- rt_mask(rt), 0, NULL) == 0 && cloning)
+ rt_mask(rt), 0, NULL, 0) == 0 && cloning)
return (EAGAIN);
}
diff --git a/sys/net/route.h b/sys/net/route.h
index 6534ddf1057..ae338488b6f 100644
--- a/sys/net/route.h
+++ b/sys/net/route.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.h,v 1.43 2006/06/15 16:33:02 henning Exp $ */
+/* $OpenBSD: route.h,v 1.44 2006/06/16 16:49:39 henning Exp $ */
/* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */
/*
@@ -80,7 +80,7 @@ struct rt_metrics {
u_long rmx_rttvar; /* estimated rtt variance (deprecated) */
u_long rmx_pksent; /* packets sent using this route */
};
-/* XXX overloading rttvar as that value is no longer used. */
+/* XXX overloading some values that are no longer used. */
#define rmx_refcnt rmx_rttvar /* # held references only used by sysctl */
/*
@@ -285,6 +285,8 @@ struct sockaddr_rtlabel {
char sr_label[RTLABEL_LEN];
};
+#define RT_TABLEID_MAX 255
+
#ifdef _KERNEL
const char *rtlabel_id2name(u_int16_t);
u_int16_t rtlabel_name2id(char *);
@@ -304,14 +306,14 @@ void rtlabel_unref(u_int16_t);
#define ONNET_CLONING 1
#define NO_CLONING 2
-#define RT_TABLEID_MAX 255
-
extern struct route_cb route_cb;
extern struct rtstat rtstat;
extern const struct sockaddr_rtin rt_defmask4;
struct socket;
void route_init(void);
+int rtable_add(u_int);
+int rtable_exists(u_int);
int route_output(struct mbuf *, ...);
int route_usrreq(struct socket *, int, struct mbuf *,
struct mbuf *, struct mbuf *);
@@ -319,10 +321,11 @@ void rt_ifmsg(struct ifnet *);
void rt_ifannouncemsg(struct ifnet *, int);
void rt_maskedcopy(struct sockaddr *,
struct sockaddr *, struct sockaddr *);
-void rt_missmsg(int, struct rt_addrinfo *, int, struct ifnet *, int);
+void rt_missmsg(int, struct rt_addrinfo *, int, struct ifnet *, int,
+ u_int);
void rt_newaddrmsg(int, struct ifaddr *, int, struct rtentry *);
int rt_setgate(struct rtentry *, struct sockaddr *,
- struct sockaddr *);
+ struct sockaddr *, u_int);
void rt_setmetrics(u_long, struct rt_metrics *, struct rt_kmetrics *);
void rt_getmetrics(struct rt_kmetrics *, struct rt_metrics *);
int rt_timer_add(struct rtentry *,
@@ -338,7 +341,7 @@ unsigned long rt_timer_count(struct rttimer_queue *);
void rt_timer_timer(void *);
void rtalloc(struct route *);
struct rtentry *
- rtalloc1(struct sockaddr *, int);
+ rtalloc1(struct sockaddr *, int, u_int);
void rtalloc_noclone(struct route *, int);
struct rtentry *
rtalloc2(struct sockaddr *, int, int);
@@ -351,8 +354,8 @@ void rtredirect(struct sockaddr *, struct sockaddr *,
struct rtentry **);
int rtrequest(int, struct sockaddr *,
struct sockaddr *, struct sockaddr *, int,
- struct rtentry **);
-int rtrequest1(int, struct rt_addrinfo *, struct rtentry **);
+ struct rtentry **, u_int);
+int rtrequest1(int, struct rt_addrinfo *, struct rtentry **, u_int);
void rt_if_remove(struct ifnet *);
struct radix_node_head *rt_gettable(sa_family_t, u_int);
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index f0fcdf3f9af..943fe0e553c 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtsock.c,v 1.59 2006/05/30 21:58:28 claudio Exp $ */
+/* $OpenBSD: rtsock.c,v 1.60 2006/06/16 16:49:39 henning Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
@@ -175,6 +175,7 @@ route_output(struct mbuf *m, ...)
struct sockaddr_rtlabel sa_rt;
const char *label;
va_list ap;
+ u_int tableid = 0;
va_start(ap, m);
so = va_arg(ap, struct socket *);
@@ -244,7 +245,7 @@ route_output(struct mbuf *m, ...)
error = EINVAL;
goto flush;
}
- error = rtrequest1(rtm->rtm_type, &info, &saved_nrt);
+ error = rtrequest1(rtm->rtm_type, &info, &saved_nrt, tableid);
if (error == 0 && saved_nrt) {
rt_setmetrics(rtm->rtm_inits, &rtm->rtm_rmx,
&saved_nrt->rt_rmx);
@@ -254,7 +255,7 @@ route_output(struct mbuf *m, ...)
}
break;
case RTM_DELETE:
- error = rtrequest1(rtm->rtm_type, &info, &saved_nrt);
+ error = rtrequest1(rtm->rtm_type, &info, &saved_nrt, tableid);
if (error == 0) {
(rt = saved_nrt)->rt_refcnt++;
goto report;
@@ -263,11 +264,11 @@ route_output(struct mbuf *m, ...)
case RTM_GET:
case RTM_CHANGE:
case RTM_LOCK:
- if ((rnh = rt_gettable(dst->sa_family, 0)) == NULL) {
+ if ((rnh = rt_gettable(dst->sa_family, tableid)) == NULL) {
error = EAFNOSUPPORT;
goto flush;
}
- rn = rt_lookup(dst, netmask, 0);
+ rn = rt_lookup(dst, netmask, tableid);
if (rn == NULL || (rn->rn_flags & RNF_ROOT) != 0) {
error = ESRCH;
goto flush;
@@ -366,7 +367,7 @@ report:
*/
if ((error = rt_getifa(&info)) != 0)
goto flush;
- if (gate && rt_setgate(rt, rt_key(rt), gate)) {
+ if (gate && rt_setgate(rt, rt_key(rt), gate, tableid)) {
error = EDQUOT;
goto flush;
}
@@ -639,8 +640,8 @@ again:
* destination.
*/
void
-rt_missmsg(int type, struct rt_addrinfo *rtinfo, int flags, struct ifnet *ifp,
- int error)
+rt_missmsg(int type, struct rt_addrinfo *rtinfo, int flags,
+ struct ifnet *ifp, int error, u_int tableid)
{
struct rt_msghdr *rtm;
struct mbuf *m;
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index 8036fd2d0a1..585c3e02e9d 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ether.c,v 1.63 2006/03/22 14:37:44 henning Exp $ */
+/* $OpenBSD: if_ether.c,v 1.64 2006/06/16 16:49:40 henning Exp $ */
/* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */
/*
@@ -198,7 +198,7 @@ arp_rtrequest(req, rt, info)
* Case 1: This route should come from a route to iface.
*/
rt_setgate(rt, rt_key(rt),
- (struct sockaddr *)&null_sdl);
+ (struct sockaddr *)&null_sdl, 0);
gate = rt->rt_gateway;
SDL(gate)->sdl_type = rt->rt_ifp->if_type;
SDL(gate)->sdl_index = rt->rt_ifp->if_index;
@@ -738,7 +738,7 @@ arptfree(la)
return;
}
rtrequest(RTM_DELETE, rt_key(rt), (struct sockaddr *)0, rt_mask(rt),
- 0, (struct rtentry **)0);
+ 0, (struct rtentry **)0, 0);
}
/*
@@ -756,7 +756,7 @@ arplookup(addr, create, proxy)
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = addr;
sin.sin_other = proxy ? SIN_PROXY : 0;
- rt = rtalloc1(sintosa(&sin), create);
+ rt = rtalloc1(sintosa(&sin), create, 0);
if (rt == 0)
return (0);
rt->rt_refcnt--;
@@ -771,7 +771,7 @@ arplookup(addr, create, proxy)
rtrequest(RTM_DELETE,
(struct sockaddr *)rt_key(rt),
rt->rt_gateway, rt_mask(rt), rt->rt_flags,
- 0);
+ 0, 0);
}
}
return (0);
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 842e2c6f192..a131aa4fa59 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.c,v 1.86 2006/04/22 19:43:07 claudio Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.87 2006/06/16 16:49:40 henning Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
@@ -630,11 +630,11 @@ in_losing(inp)
info.rti_info[RTAX_DST] = &inp->inp_route.ro_dst;
info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
info.rti_info[RTAX_NETMASK] = rt_mask(rt);
- rt_missmsg(RTM_LOSING, &info, rt->rt_flags, rt->rt_ifp, 0);
+ rt_missmsg(RTM_LOSING, &info, rt->rt_flags, rt->rt_ifp, 0, 0);
if (rt->rt_flags & RTF_DYNAMIC)
(void) rtrequest(RTM_DELETE, rt_key(rt),
rt->rt_gateway, rt_mask(rt), rt->rt_flags,
- (struct rtentry **)0);
+ (struct rtentry **)0, 0);
/*
* A new route can be allocated
* the next time output is attempted.
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 91949c77db5..defa6af28e4 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.126 2006/06/02 19:53:12 mpf Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.127 2006/06/16 16:49:40 henning Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -364,7 +364,7 @@ carp_setroute(struct carp_softc *sc, int cmd)
/* Remove the existing host route, if any */
rtrequest(RTM_DELETE, ifa->ifa_addr,
ifa->ifa_addr, ifa->ifa_netmask,
- RTF_HOST, NULL);
+ RTF_HOST, NULL, 0);
/* Check for our address on another interface */
/* XXX cries for proper API */
@@ -390,21 +390,22 @@ carp_setroute(struct carp_softc *sc, int cmd)
rtrequest(RTM_ADD, ifa->ifa_addr,
ifa->ifa_addr, ifa->ifa_netmask,
- RTF_UP | RTF_HOST, NULL);
+ RTF_UP | RTF_HOST, NULL, 0);
}
if (!hr_otherif || nr_ourif || !rt) {
if (nr_ourif && !(rt->rt_flags &
RTF_CLONING))
rtrequest(RTM_DELETE, &sa,
ifa->ifa_addr,
- ifa->ifa_netmask, 0, NULL);
+ ifa->ifa_netmask, 0, NULL,
+ 0);
ifa->ifa_rtrequest = arp_rtrequest;
ifa->ifa_flags |= RTF_CLONING;
if (rtrequest(RTM_ADD, ifa->ifa_addr,
ifa->ifa_addr, ifa->ifa_netmask, 0,
- NULL) == 0)
+ NULL, 0) == 0)
ifa->ifa_flags |= IFA_ROUTE;
}
break;
diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c
index b40fa9adeba..f32d3cf5e22 100644
--- a/sys/netinet/ip_icmp.c
+++ b/sys/netinet/ip_icmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_icmp.c,v 1.70 2006/03/05 21:48:56 miod Exp $ */
+/* $OpenBSD: ip_icmp.c,v 1.71 2006/06/16 16:49:40 henning Exp $ */
/* $NetBSD: ip_icmp.c,v 1.19 1996/02/13 23:42:22 christos Exp $ */
/*
@@ -830,13 +830,15 @@ icmp_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
/* NOTREACHED */
}
+
+/* XXX only handles table 0 right now */
struct rtentry *
icmp_mtudisc_clone(struct sockaddr *dst)
{
struct rtentry *rt;
int error;
- rt = rtalloc1(dst, 1);
+ rt = rtalloc1(dst, 1, 0);
if (rt == 0)
return (NULL);
@@ -848,7 +850,7 @@ icmp_mtudisc_clone(struct sockaddr *dst)
error = rtrequest((int) RTM_ADD, dst,
(struct sockaddr *) rt->rt_gateway,
(struct sockaddr *) 0,
- RTF_GATEWAY | RTF_HOST | RTF_DYNAMIC, &nrt);
+ RTF_GATEWAY | RTF_HOST | RTF_DYNAMIC, &nrt, 0);
if (error) {
rtfree(rt);
return (NULL);
@@ -929,6 +931,7 @@ icmp_mtudisc(struct icmp *icp)
rtfree(rt);
}
+/* XXX only handles table 0 right now */
void
icmp_mtudisc_timeout(struct rtentry *rt, struct rttimer *r)
{
@@ -942,7 +945,7 @@ icmp_mtudisc_timeout(struct rtentry *rt, struct rttimer *r)
sa = *(struct sockaddr_in *)rt_key(rt);
rtrequest((int) RTM_DELETE, (struct sockaddr *)rt_key(rt),
- rt->rt_gateway, rt_mask(rt), rt->rt_flags, 0);
+ rt->rt_gateway, rt_mask(rt), rt->rt_flags, 0, 0);
/* Notify TCP layer of increased Path MTU estimate */
ctlfunc = inetsw[ip_protox[IPPROTO_TCP]].pr_ctlinput;
@@ -974,6 +977,7 @@ icmp_ratelimit(const struct in_addr *dst, const int type, const int code)
return 0;
}
+/* XXX only handles table 0 right now */
static void
icmp_redirect_timeout(struct rtentry *rt, struct rttimer *r)
{
@@ -982,6 +986,6 @@ icmp_redirect_timeout(struct rtentry *rt, struct rttimer *r)
if ((rt->rt_flags & (RTF_DYNAMIC | RTF_HOST)) ==
(RTF_DYNAMIC | RTF_HOST)) {
rtrequest((int) RTM_DELETE, (struct sockaddr *)rt_key(rt),
- rt->rt_gateway, rt_mask(rt), rt->rt_flags, 0);
+ rt->rt_gateway, rt_mask(rt), rt->rt_flags, 0, 0);
}
}
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index abaef2d5bf6..d069a75b358 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_input.c,v 1.140 2006/06/15 10:08:34 pascoe Exp $ */
+/* $OpenBSD: ip_input.c,v 1.141 2006/06/16 16:49:40 henning Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/*
@@ -1252,7 +1252,7 @@ ip_weadvertise(addr)
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = addr;
sin.sin_other = SIN_PROXY;
- rt = rtalloc1(sintosa(&sin), 0);
+ rt = rtalloc1(sintosa(&sin), 0, 0); /* XXX other tables? */
if (rt == 0)
return 0;
diff --git a/sys/netinet/ip_spd.c b/sys/netinet/ip_spd.c
index d5fb0d5f58f..32e06a9ec95 100644
--- a/sys/netinet/ip_spd.c
+++ b/sys/netinet/ip_spd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_spd.c,v 1.51 2005/02/17 18:07:36 jfb Exp $ */
+/* $OpenBSD: ip_spd.c,v 1.52 2006/06/16 16:49:40 henning Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
*
@@ -575,7 +575,7 @@ ipsec_delete_policy(struct ipsec_policy *ipo)
err = rtrequest(RTM_DELETE, (struct sockaddr *) &ipo->ipo_addr,
(struct sockaddr *) 0,
(struct sockaddr *) &ipo->ipo_mask,
- 0, (struct rtentry **) 0);
+ 0, (struct rtentry **) 0, 0); /* XXX other tables? */
if (ipo->ipo_tdb != NULL)
TAILQ_REMOVE(&ipo->ipo_tdb->tdb_policy_head, ipo,
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index a997f4ea354..6aa117eff9a 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: icmp6.c,v 1.86 2006/03/05 21:48:57 miod Exp $ */
+/* $OpenBSD: icmp6.c,v 1.87 2006/06/16 16:49:40 henning Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@@ -2222,7 +2222,7 @@ icmp6_redirect_input(m, off)
sin6.sin6_family = AF_INET6;
sin6.sin6_len = sizeof(struct sockaddr_in6);
bcopy(&reddst6, &sin6.sin6_addr, sizeof(reddst6));
- rt = rtalloc1((struct sockaddr *)&sin6, 0);
+ rt = rtalloc1((struct sockaddr *)&sin6, 0, 0);
if (rt) {
if (rt->rt_gateway == NULL ||
rt->rt_gateway->sa_family != AF_INET6) {
@@ -2767,7 +2767,7 @@ icmp6_mtudisc_clone(dst)
struct rtentry *rt;
int error;
- rt = rtalloc1(dst, 1);
+ rt = rtalloc1(dst, 1, 0);
if (rt == 0)
return NULL;
@@ -2778,7 +2778,7 @@ icmp6_mtudisc_clone(dst)
error = rtrequest((int) RTM_ADD, dst,
(struct sockaddr *) rt->rt_gateway,
(struct sockaddr *) 0,
- RTF_GATEWAY | RTF_HOST | RTF_DYNAMIC, &nrt);
+ RTF_GATEWAY | RTF_HOST | RTF_DYNAMIC, &nrt, 0);
if (error) {
rtfree(rt);
return NULL;
@@ -2807,7 +2807,7 @@ icmp6_mtudisc_timeout(rt, r)
if ((rt->rt_flags & (RTF_DYNAMIC | RTF_HOST)) ==
(RTF_DYNAMIC | RTF_HOST)) {
rtrequest((int) RTM_DELETE, (struct sockaddr *)rt_key(rt),
- rt->rt_gateway, rt_mask(rt), rt->rt_flags, 0);
+ rt->rt_gateway, rt_mask(rt), rt->rt_flags, 0, 0);
} else {
if (!(rt->rt_rmx.rmx_locks & RTV_MTU))
rt->rt_rmx.rmx_mtu = 0;
@@ -2824,7 +2824,7 @@ icmp6_redirect_timeout(rt, r)
if ((rt->rt_flags & (RTF_GATEWAY | RTF_DYNAMIC | RTF_HOST)) ==
(RTF_GATEWAY | RTF_DYNAMIC | RTF_HOST)) {
rtrequest((int) RTM_DELETE, (struct sockaddr *)rt_key(rt),
- rt->rt_gateway, rt_mask(rt), rt->rt_flags, 0);
+ rt->rt_gateway, rt_mask(rt), rt->rt_flags, 0, 0);
}
}
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index f576d02319a..71e92c475e7 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.c,v 1.66 2006/05/27 23:40:27 claudio Exp $ */
+/* $OpenBSD: in6.c,v 1.67 2006/06/16 16:49:40 henning Exp $ */
/* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */
/*
@@ -160,9 +160,10 @@ in6_ifloop_request(int cmd, struct ifaddr *ifa)
* would be happy. Note that we assume the caller of the function
* (probably implicitly) set nd6_rtrequest() to ifa->ifa_rtrequest,
* which changes the outgoing interface to the loopback interface.
+ * XXX only table 0 for now
*/
e = rtrequest(cmd, ifa->ifa_addr, ifa->ifa_addr,
- (struct sockaddr *)&all1_sa, RTF_UP|RTF_HOST|RTF_LLINFO, &nrt);
+ (struct sockaddr *)&all1_sa, RTF_UP|RTF_HOST|RTF_LLINFO, &nrt, 0);
if (e != 0) {
log(LOG_ERR, "in6_ifloop_request: "
"%s operation failed for %s (errno=%d)\n",
@@ -218,7 +219,7 @@ in6_ifaddloop(struct ifaddr *ifa)
struct rtentry *rt;
/* If there is no loopback entry, allocate one. */
- rt = rtalloc1(ifa->ifa_addr, 0);
+ rt = rtalloc1(ifa->ifa_addr, 0, 0);
if (rt == NULL || (rt->rt_flags & RTF_HOST) == 0 ||
(rt->rt_ifp->if_flags & IFF_LOOPBACK) == 0)
in6_ifloop_request(RTM_ADD, ifa);
@@ -269,7 +270,7 @@ in6_ifremloop(struct ifaddr *ifa)
* a subnet-router anycast address on an interface attahced
* to a shared medium.
*/
- rt = rtalloc1(ifa->ifa_addr, 0);
+ rt = rtalloc1(ifa->ifa_addr, 0, 0);
if (rt != NULL && (rt->rt_flags & RTF_HOST) != 0 &&
(rt->rt_ifp->if_flags & IFF_LOOPBACK) != 0) {
rt->rt_refcnt--;
@@ -1082,7 +1083,7 @@ in6_update_ifa(ifp, ifra, ia)
* actually do not need the routes, since they usually specify
* the outgoing interface.
*/
- rt = rtalloc1((struct sockaddr *)&mltaddr, 0);
+ rt = rtalloc1((struct sockaddr *)&mltaddr, 0, 0);
if (rt) {
/*
* 32bit came from "mltmask"
@@ -1108,7 +1109,7 @@ in6_update_ifa(ifp, ifra, ia)
(struct sockaddr *)&ia->ia_addr;
/* XXX: we need RTF_CLONING to fake nd6_rtrequest */
info.rti_flags = RTF_UP | RTF_CLONING;
- error = rtrequest1(RTM_ADD, &info, NULL);
+ error = rtrequest1(RTM_ADD, &info, NULL, 0);
if (error)
goto cleanup;
} else {
@@ -1153,7 +1154,7 @@ in6_update_ifa(ifp, ifra, ia)
mltaddr.sin6_addr = in6addr_nodelocal_allnodes;
/* XXX: again, do we really need the route? */
- rt = rtalloc1((struct sockaddr *)&mltaddr, 0);
+ rt = rtalloc1((struct sockaddr *)&mltaddr, 0, 0);
if (rt) {
/* 32bit came from "mltmask" */
if (memcmp(&mltaddr.sin6_addr,
@@ -1175,7 +1176,7 @@ in6_update_ifa(ifp, ifra, ia)
info.rti_info[RTAX_IFA] =
(struct sockaddr *)&ia->ia_addr;
info.rti_flags = RTF_UP | RTF_CLONING;
- error = rtrequest1(RTM_ADD, &info, NULL);
+ error = rtrequest1(RTM_ADD, &info, NULL, 0);
if (error)
goto cleanup;
} else {
diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c
index f101dd1f36c..9a3bf06c8f6 100644
--- a/sys/netinet6/in6_ifattach.c
+++ b/sys/netinet6/in6_ifattach.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_ifattach.c,v 1.41 2006/05/27 23:40:27 claudio Exp $ */
+/* $OpenBSD: in6_ifattach.c,v 1.42 2006/06/16 16:49:40 henning Exp $ */
/* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */
/*
@@ -694,13 +694,13 @@ in6_ifdetach(ifp)
/* remove from the routing table */
if ((ia->ia_flags & IFA_ROUTE) &&
- (rt = rtalloc1((struct sockaddr *)&ia->ia_addr, 0))) {
+ (rt = rtalloc1((struct sockaddr *)&ia->ia_addr, 0, 0))) {
rtflags = rt->rt_flags;
rtfree(rt);
rtrequest(RTM_DELETE, (struct sockaddr *)&ia->ia_addr,
(struct sockaddr *)&ia->ia_addr,
(struct sockaddr *)&ia->ia_prefixmask,
- rtflags, (struct rtentry **)0);
+ rtflags, (struct rtentry **)0, 0);
}
/* remove from the linked list */
@@ -745,10 +745,10 @@ in6_ifdetach(ifp)
sin6.sin6_family = AF_INET6;
sin6.sin6_addr = in6addr_linklocal_allnodes;
sin6.sin6_addr.s6_addr16[1] = htons(ifp->if_index);
- rt = rtalloc1((struct sockaddr *)&sin6, 0);
+ rt = rtalloc1((struct sockaddr *)&sin6, 0, 0);
if (rt && rt->rt_ifp == ifp) {
rtrequest(RTM_DELETE, (struct sockaddr *)rt_key(rt),
- rt->rt_gateway, rt_mask(rt), rt->rt_flags, 0);
+ rt->rt_gateway, rt_mask(rt), rt->rt_flags, 0, 0);
rtfree(rt);
}
}
diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c
index 74dc0b72491..967bd374ce9 100644
--- a/sys/netinet6/in6_src.c
+++ b/sys/netinet6/in6_src.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_src.c,v 1.17 2005/09/19 19:38:34 brad Exp $ */
+/* $OpenBSD: in6_src.c,v 1.18 2006/06/16 16:49:40 henning Exp $ */
/* $KAME: in6_src.c,v 1.36 2001/02/06 04:08:17 itojun Exp $ */
/*
@@ -243,7 +243,7 @@ in6_selectsrc(dstsock, opts, mopts, ro, laddr, errorp)
sa6->sin6_scope_id = dstsock->sin6_scope_id;
if (IN6_IS_ADDR_MULTICAST(dst)) {
ro->ro_rt = rtalloc1(&((struct route *)ro)
- ->ro_dst, 0);
+ ->ro_dst, 0, 0);
} else {
rtalloc((struct route *)ro);
}
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
index c9546e0a863..1515a2d9006 100644
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_output.c,v 1.91 2006/06/16 15:31:08 pascoe Exp $ */
+/* $OpenBSD: ip6_output.c,v 1.92 2006/06/16 16:49:40 henning Exp $ */
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
/*
@@ -625,7 +625,7 @@ ip6_output(m0, opt, ro, flags, im6o, ifpp)
if (ifp == NULL) {
if (ro->ro_rt == 0) {
ro->ro_rt = rtalloc1((struct sockaddr *)
- &ro->ro_dst, 0);
+ &ro->ro_dst, 0, 0);
}
if (ro->ro_rt == 0) {
ip6stat.ip6s_noroute++;
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index ddc5fc1ea7f..db9a812e9ff 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6.c,v 1.71 2006/06/16 15:41:19 pascoe Exp $ */
+/* $OpenBSD: nd6.c,v 1.72 2006/06/16 16:49:40 henning Exp $ */
/* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */
/*
@@ -686,7 +686,7 @@ nd6_lookup(addr6, create, ifp)
sin6.sin6_family = AF_INET6;
sin6.sin6_addr = *addr6;
- rt = rtalloc1((struct sockaddr *)&sin6, create);
+ rt = rtalloc1((struct sockaddr *)&sin6, create, 0);
if (rt && (rt->rt_flags & RTF_LLINFO) == 0) {
/*
* This is the case for the default route.
@@ -724,7 +724,7 @@ nd6_lookup(addr6, create, ifp)
if ((e = rtrequest(RTM_ADD, (struct sockaddr *)&sin6,
ifa->ifa_addr, (struct sockaddr *)&all1_sa,
(ifa->ifa_flags | RTF_HOST | RTF_LLINFO) &
- ~RTF_CLONING, &rt)) != 0) {
+ ~RTF_CLONING, &rt, 0)) != 0) {
#if 0
log(LOG_ERR,
"nd6_lookup: failed to add route for a "
@@ -933,7 +933,7 @@ nd6_free(rt, gc)
* cached routes.
*/
rtrequest(RTM_DELETE, rt_key(rt), (struct sockaddr *)0,
- rt_mask(rt), 0, (struct rtentry **)0);
+ rt_mask(rt), 0, (struct rtentry **)0, 0);
return (next);
}
@@ -1057,7 +1057,7 @@ nd6_rtrequest(req, rt, info)
* (RTF_LLINFO && !ln case).
*/
rt_setgate(rt, rt_key(rt),
- (struct sockaddr *)&null_sdl);
+ (struct sockaddr *)&null_sdl, 0);
gate = rt->rt_gateway;
SDL(gate)->sdl_type = ifp->if_type;
SDL(gate)->sdl_index = ifp->if_index;
@@ -1745,7 +1745,7 @@ nd6_output(ifp, origifp, m0, dst, rt0)
if (rt) {
if ((rt->rt_flags & RTF_UP) == 0) {
if ((rt0 = rt = rtalloc1((struct sockaddr *)dst,
- 1)) != NULL)
+ 1, 0)) != NULL)
{
rt->rt_refcnt--;
if (rt->rt_ifp != ifp)
@@ -1783,7 +1783,7 @@ nd6_output(ifp, origifp, m0, dst, rt0)
if (((rt = rt->rt_gwroute)->rt_flags & RTF_UP) == 0) {
rtfree(rt); rt = rt0;
lookup:
- rt->rt_gwroute = rtalloc1(rt->rt_gateway, 1);
+ rt->rt_gwroute = rtalloc1(rt->rt_gateway, 1, 0);
if ((rt = rt->rt_gwroute) == 0)
senderr(EHOSTUNREACH);
}
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
index 9cfc5c9290d..3ad7136bcef 100644
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6_nbr.c,v 1.40 2006/06/16 15:41:19 pascoe Exp $ */
+/* $OpenBSD: nd6_nbr.c,v 1.41 2006/06/16 16:49:40 henning Exp $ */
/* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */
/*
@@ -211,7 +211,7 @@ nd6_ns_input(m, off, icmp6len)
tsin6.sin6_family = AF_INET6;
tsin6.sin6_addr = taddr6;
- rt = rtalloc1((struct sockaddr *)&tsin6, 0);
+ rt = rtalloc1((struct sockaddr *)&tsin6, 0, 0);
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 7c41977d47b..5dd82b89a87 100644
--- a/sys/netinet6/nd6_rtr.c
+++ b/sys/netinet6/nd6_rtr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6_rtr.c,v 1.39 2006/06/16 15:41:19 pascoe Exp $ */
+/* $OpenBSD: nd6_rtr.c,v 1.40 2006/06/16 16:49:40 henning Exp $ */
/* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */
/*
@@ -431,7 +431,7 @@ nd6_rtmsg(cmd, rt)
info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
}
- rt_missmsg(cmd, &info, rt->rt_flags, rt->rt_ifp, 0);
+ rt_missmsg(cmd, &info, rt->rt_flags, rt->rt_ifp, 0, 0);
}
void
@@ -458,7 +458,7 @@ defrouter_addreq(new)
s = splsoftnet();
error = rtrequest(RTM_ADD, (struct sockaddr *)&def,
(struct sockaddr *)&gate, (struct sockaddr *)&mask,
- RTF_GATEWAY, &newrt);
+ RTF_GATEWAY, &newrt, 0);
if (newrt) {
nd6_rtmsg(RTM_ADD, newrt); /* tell user process */
newrt->rt_refcnt--;
@@ -558,7 +558,7 @@ defrouter_delreq(dr)
rtrequest(RTM_DELETE, (struct sockaddr *)&def,
(struct sockaddr *)&gw,
- (struct sockaddr *)&mask, RTF_GATEWAY, &oldrt);
+ (struct sockaddr *)&mask, RTF_GATEWAY, &oldrt, 0);
if (oldrt) {
nd6_rtmsg(RTM_DELETE, oldrt);
if (oldrt->rt_refcnt <= 0) {
@@ -1499,7 +1499,7 @@ nd6_prefix_onlink(pr)
rtflags &= ~RTF_CLONING;
}
error = rtrequest(RTM_ADD, (struct sockaddr *)&pr->ndpr_prefix,
- ifa->ifa_addr, (struct sockaddr *)&mask6, rtflags, &rt);
+ ifa->ifa_addr, (struct sockaddr *)&mask6, rtflags, &rt, 0);
if (error == 0) {
if (rt != NULL) /* this should be non NULL, though */
nd6_rtmsg(RTM_ADD, rt);
@@ -1548,7 +1548,7 @@ nd6_prefix_offlink(pr)
mask6.sin6_len = sizeof(sa6);
bcopy(&pr->ndpr_mask, &mask6.sin6_addr, sizeof(struct in6_addr));
error = rtrequest(RTM_DELETE, (struct sockaddr *)&sa6, NULL,
- (struct sockaddr *)&mask6, 0, &rt);
+ (struct sockaddr *)&mask6, 0, &rt, 0);
if (error == 0) {
pr->ndpr_stateflags &= ~NDPRF_ONLINK;
@@ -1831,7 +1831,7 @@ rt6_deleteroute(rn, arg)
return (0);
return (rtrequest(RTM_DELETE, rt_key(rt), rt->rt_gateway,
- rt_mask(rt), rt->rt_flags, 0));
+ rt_mask(rt), rt->rt_flags, 0, 0));
#undef SIN6
}