summaryrefslogtreecommitdiff
path: root/sys/net/if.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2006-03-22 14:37:46 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2006-03-22 14:37:46 +0000
commit022bdc963534de84cbd86cddbcec6e0fd47a580c (patch)
tree7222ab8ef3ce6f64341fd84aaf1864373526a67b /sys/net/if.c
parent88ee4683cf3d8d909148342a8c5cb5d380d6e7b7 (diff)
prevent anything outside rote.c from accessing the routing table heads
directly. rather provide a rt_lookup function for regular lookups, and a rt_gettable for those that need access to the head for some reason. the latter cases should be revisted later probably so that nothing outside the routing core code accesses the heads at all... tested claudio jolan me, ok claudio markus
Diffstat (limited to 'sys/net/if.c')
-rw-r--r--sys/net/if.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 7cd521cdb80..4b97d064b0c 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.145 2006/03/20 10:03:49 henning Exp $ */
+/* $OpenBSD: if.c,v 1.146 2006/03/22 14:37:44 henning Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -1761,7 +1761,6 @@ if_group_egress_build(void)
#ifdef INET6
struct sockaddr_in6 sa_in6;
#endif
- struct radix_node_head *rnh;
struct radix_node *rn;
struct rtentry *rt;
@@ -1775,42 +1774,34 @@ if_group_egress_build(void)
if_delgroup(ifgm->ifgm_ifp, IFG_EGRESS);
}
- if ((rnh = rt_tables[AF_INET]) == NULL)
- return (-1);
-
bzero(&sa_in, sizeof(sa_in));
sa_in.sin_len = sizeof(sa_in);
sa_in.sin_family = AF_INET;
- if ((rn = rnh->rnh_lookup(&sa_in, &sa_in, rnh))) {
+ if ((rn = rt_lookup(sintosa(&sa_in), sintosa(&sa_in), 0)) != NULL) {
do {
rt = (struct rtentry *)rn;
if (rt->rt_ifp)
if_addgroup(rt->rt_ifp, IFG_EGRESS);
#ifndef SMALL_KERNEL
- if (rn_mpath_capable(rnh))
- rn = rn_mpath_next(rn);
- else
+ rn = rn_mpath_next(rn);
+#else
+ rn = NULL;
#endif
- rn = NULL;
} while (rn != NULL);
}
#ifdef INET6
- if ((rnh = rt_tables[AF_INET6]) == NULL)
- return (-1);
-
bcopy(&sa6_any, &sa_in6, sizeof(sa_in6));
- if ((rn = rnh->rnh_lookup(&sa_in6, &sa_in6, rnh))) {
+ if ((rn = rt_lookup(sin6tosa(&sa_in6), sin6tosa(&sa_in6), 0)) != NULL) {
do {
rt = (struct rtentry *)rn;
if (rt->rt_ifp)
if_addgroup(rt->rt_ifp, IFG_EGRESS);
#ifndef SMALL_KERNEL
- if (rn_mpath_capable(rnh))
- rn = rn_mpath_next(rn);
- else
+ rn = rn_mpath_next(rn);
+#else
+ rn = NULL;
#endif
- rn = NULL;
} while (rn != NULL);
}
#endif