summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorBret Lambert <blambert@cvs.openbsd.org>2012-09-19 16:14:02 +0000
committerBret Lambert <blambert@cvs.openbsd.org>2012-09-19 16:14:02 +0000
commit946940f045090e841444b8c249cbd1e57c6b7f52 (patch)
treeca6548bd755726da23faee1439de01a9a33a04b0 /sys/net
parent469f7c2cf97e7fa45f29a81b0ccbf4d3436722d5 (diff)
Make rt_lookup return a pointer to an rtentry struct instead of
to a radix_node struct. The radix tree pushdown continues. ok claudio@
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if.c8
-rw-r--r--sys/net/route.c6
-rw-r--r--sys/net/route.h4
-rw-r--r--sys/net/rtsock.c6
4 files changed, 11 insertions, 13 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index ff32a18ca74..c2132ab5c8b 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.243 2012/09/19 12:35:07 blambert Exp $ */
+/* $OpenBSD: if.c,v 1.244 2012/09/19 16:14:01 blambert Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -2080,8 +2080,7 @@ if_group_egress_build(void)
bzero(&sa_in, sizeof(sa_in));
sa_in.sin_len = sizeof(sa_in);
sa_in.sin_family = AF_INET;
- rt = (struct rtentry *)rt_lookup(sintosa(&sa_in), sintosa(&sa_in), 0);
- if (rt) {
+ if ((rt = rt_lookup(sintosa(&sa_in), sintosa(&sa_in), 0)) != NULL) {
do {
if (rt->rt_ifp)
if_addgroup(rt->rt_ifp, IFG_EGRESS);
@@ -2095,8 +2094,7 @@ if_group_egress_build(void)
#ifdef INET6
bcopy(&sa6_any, &sa_in6, sizeof(sa_in6));
- rt = (struct rtentry *)rt_lookup(sin6tosa(&sa_in6), sin6tosa(&sa_in6), 0);
- if (rt) {
+ if ((rt = rt_lookup(sin6tosa(&sa_in6), sin6tosa(&sa_in6), 0)) != NULL) {
do {
if (rt->rt_ifp)
if_addgroup(rt->rt_ifp, IFG_EGRESS);
diff --git a/sys/net/route.c b/sys/net/route.c
index 5ff8ca33e36..cfe5b908d5b 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.139 2012/09/19 12:35:07 blambert Exp $ */
+/* $OpenBSD: route.c,v 1.140 2012/09/19 16:14:01 blambert Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -1319,7 +1319,7 @@ rt_gettable(sa_family_t af, u_int id)
return (rt_tables[id] ? rt_tables[id][af2rtafidx[af]] : NULL);
}
-struct radix_node *
+struct rtentry *
rt_lookup(struct sockaddr *dst, struct sockaddr *mask, u_int tableid)
{
struct radix_node_head *rnh;
@@ -1327,7 +1327,7 @@ rt_lookup(struct sockaddr *dst, struct sockaddr *mask, u_int tableid)
if ((rnh = rt_gettable(dst->sa_family, tableid)) == NULL)
return (NULL);
- return (rnh->rnh_lookup(dst, mask, rnh));
+ return ((struct rtentry *)rnh->rnh_lookup(dst, mask, rnh));
}
/* ARGSUSED */
diff --git a/sys/net/route.h b/sys/net/route.h
index a85b495b829..960362ebd67 100644
--- a/sys/net/route.h
+++ b/sys/net/route.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.h,v 1.77 2012/09/19 12:35:07 blambert Exp $ */
+/* $OpenBSD: route.h,v 1.78 2012/09/19 16:14:01 blambert Exp $ */
/* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */
/*
@@ -411,7 +411,7 @@ int rt_if_linkstate_change(struct radix_node *, void *, u_int);
int rtdeletemsg(struct rtentry *, u_int);
struct radix_node_head *rt_gettable(sa_family_t, u_int);
-struct radix_node *rt_lookup(struct sockaddr *, struct sockaddr *, u_int);
+struct rtentry *rt_lookup(struct sockaddr *, struct sockaddr *, u_int);
struct rtentry *rt_mpath_next(struct rtentry *, int);
#endif /* _KERNEL */
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 2ecfc0f6874..dd324a8b28b 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtsock.c,v 1.121 2012/09/19 12:35:07 blambert Exp $ */
+/* $OpenBSD: rtsock.c,v 1.122 2012/09/19 16:14:01 blambert Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
@@ -617,12 +617,12 @@ route_output(struct mbuf *m, ...)
error = EAFNOSUPPORT;
goto flush;
}
- rn = rt_lookup(dst, netmask, tableid);
+ rt = rt_lookup(dst, netmask, tableid);
+ rn = (struct radix_node *)rt;
if (rn == NULL || (rn->rn_flags & RNF_ROOT) != 0) {
error = ESRCH;
goto flush;
}
- rt = (struct rtentry *)rn;
#ifndef SMALL_KERNEL
/*
* for RTM_CHANGE/LOCK, if we got multipath routes,