summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_carp.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/netinet/ip_carp.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/netinet/ip_carp.c')
-rw-r--r--sys/netinet/ip_carp.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index fe448304f4c..57752a846bf 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.119 2006/01/28 23:47:20 mpf Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.120 2006/03/22 14:37:44 henning Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -341,8 +341,7 @@ carp_setroute(struct carp_softc *sc, int cmd)
int count = 0;
struct sockaddr sa;
struct rtentry *rt;
- struct radix_node_head *rnh =
- rt_tables[ifa->ifa_addr->sa_family];
+ struct radix_node_head *rnh;
struct radix_node *rn;
int hr_otherif, nr_ourif;
@@ -367,6 +366,8 @@ carp_setroute(struct carp_softc *sc, int cmd)
RTF_HOST, NULL);
/* Check for our address on another interface */
+ /* XXX cries for proper API */
+ rnh = rt_gettable(ifa->ifa_addr->sa_family, 0);
rn = rnh->rnh_matchaddr(ifa->ifa_addr, rnh);
rt = (struct rtentry *)rn;
hr_otherif = (rt && rt->rt_ifp != &sc->sc_if &&
@@ -376,8 +377,8 @@ carp_setroute(struct carp_softc *sc, int cmd)
bcopy(ifa->ifa_addr, &sa, sizeof(sa));
satosin(&sa)->sin_addr.s_addr = satosin(ifa->ifa_netmask
)->sin_addr.s_addr & satosin(&sa)->sin_addr.s_addr;
- rn = rnh->rnh_lookup(&sa, ifa->ifa_netmask, rnh);
- rt = (struct rtentry *)rn;
+ rt = (struct rtentry *)rt_lookup(&sa,
+ ifa->ifa_netmask, 0);
nr_ourif = (rt && rt->rt_ifp == &sc->sc_if);
switch (cmd) {