diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2006-03-22 14:37:46 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2006-03-22 14:37:46 +0000 |
commit | 022bdc963534de84cbd86cddbcec6e0fd47a580c (patch) | |
tree | 7222ab8ef3ce6f64341fd84aaf1864373526a67b /sys/net/rtsock.c | |
parent | 88ee4683cf3d8d909148342a8c5cb5d380d6e7b7 (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/rtsock.c')
-rw-r--r-- | sys/net/rtsock.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 1286e9be466..4fb25752f71 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.53 2006/02/23 14:15:53 claudio Exp $ */ +/* $OpenBSD: rtsock.c,v 1.54 2006/03/22 14:37:44 henning Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -263,11 +263,11 @@ route_output(struct mbuf *m, ...) case RTM_GET: case RTM_CHANGE: case RTM_LOCK: - if ((rnh = rt_tables[dst->sa_family]) == 0) { + if ((rnh = rt_gettable(dst->sa_family, 0)) == NULL) { error = EAFNOSUPPORT; goto flush; } - rn = rnh->rnh_lookup(dst, netmask, rnh); + rn = rt_lookup(dst, netmask, 0); if (rn == NULL || (rn->rn_flags & RNF_ROOT) != 0) { error = ESRCH; goto flush; @@ -907,7 +907,7 @@ sysctl_rtable(int *name, u_int namelen, void *where, size_t *given, void *new, case NET_RT_DUMP: case NET_RT_FLAGS: for (i = 1; i <= AF_MAX; i++) - if ((rnh = rt_tables[i]) && (af == 0 || af == i) && + if ((rnh = rt_gettable(i, 0)) && (af == 0 || af == i) && (error = (*rnh->rnh_walktree)(rnh, sysctl_dumpentry, &w))) break; |