summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_carp.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2005-11-27 16:22:46 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2005-11-27 16:22:46 +0000
commit878b85bab54504f0210881ee32d3dc9ac088232e (patch)
tree7dfc062415efa89c01935fc07c0956f39778cfba /sys/netinet/ip_carp.c
parent65b8e7f92145f4c4f69649a66db8d9a3133d299a (diff)
don't let anything outside route.c access the routing table heads directly,
but go through a provided wrapper. also provide rt_lookup() instead of doing the lookup manually in many places. ryan ok
Diffstat (limited to 'sys/netinet/ip_carp.c')
-rw-r--r--sys/netinet/ip_carp.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 5da78dcc80d..ded38f8d7a7 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.115 2005/11/27 10:58:06 mpf Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.116 2005/11/27 16:22:45 henning Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -339,10 +339,8 @@ carp_setroute(struct carp_softc *sc, int cmd)
case AF_INET: {
int count = 0;
struct sockaddr sa;
+ struct sockaddr_in mask;
struct rtentry *rt;
- struct radix_node_head *rnh =
- rt_tables[ifa->ifa_addr->sa_family];
- struct radix_node *rn;
int hr_otherif, nr_ourif;
/*
@@ -366,8 +364,9 @@ carp_setroute(struct carp_softc *sc, int cmd)
RTF_HOST, NULL);
/* Check for our address on another interface */
- rn = rnh->rnh_matchaddr(ifa->ifa_addr, rnh);
- rt = (struct rtentry *)rn;
+ memset(&mask, 1, sizeof(mask));
+ rt = (struct rtentry *)rt_lookup(ifa->ifa_addr,
+ sintosa(&mask), 0);
hr_otherif = (rt && rt->rt_ifp != &sc->sc_if &&
rt->rt_flags & (RTF_CLONING|RTF_CLONED));
@@ -375,8 +374,9 @@ 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) {