summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_carp.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet/ip_carp.c')
-rw-r--r--sys/netinet/ip_carp.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 228163fcf6c..87be99facf6 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.169 2008/10/28 23:07:12 mpf Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.170 2009/06/05 00:05:22 claudio Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -424,9 +424,9 @@ carp_setroute(struct carp_softc *sc, int cmd)
info.rti_info[RTAX_DST] = ifa->ifa_addr;
info.rti_flags = RTF_HOST;
error = rtrequest1(RTM_DELETE, &info, RTP_CONNECTED,
- NULL, 0);
+ NULL, sc->sc_if.if_rdomain);
rt_missmsg(RTM_DELETE, &info, info.rti_flags, NULL,
- error, 0);
+ error, sc->sc_if.if_rdomain);
/* Check for our address on another interface */
/* XXX cries for proper API */
@@ -441,7 +441,7 @@ carp_setroute(struct carp_softc *sc, int cmd)
satosin(&sa)->sin_addr.s_addr = satosin(ifa->ifa_netmask
)->sin_addr.s_addr & satosin(&sa)->sin_addr.s_addr;
rt = (struct rtentry *)rt_lookup(&sa,
- ifa->ifa_netmask, 0);
+ ifa->ifa_netmask, sc->sc_if.if_rdomain);
nr_ourif = (rt && rt->rt_ifp == &sc->sc_if);
/* Restore the route label */
@@ -465,9 +465,11 @@ carp_setroute(struct carp_softc *sc, int cmd)
info.rti_info[RTAX_GATEWAY] = ifa->ifa_addr;
info.rti_flags = RTF_UP | RTF_HOST;
error = rtrequest1(RTM_ADD, &info,
- RTP_CONNECTED, NULL, 0);
- rt_missmsg(RTM_ADD, &info, info.rti_flags,
- &sc->sc_if, error, 0);
+ RTP_CONNECTED, NULL,
+ sc->sc_if.if_rdomain);
+ rt_missmsg(RTM_ADD, &info,
+ info.rti_flags, &sc->sc_if,
+ error, sc->sc_if.if_rdomain);
}
if (!hr_otherif || nr_ourif || !rt) {
if (nr_ourif && !(rt->rt_flags &
@@ -475,9 +477,11 @@ carp_setroute(struct carp_softc *sc, int cmd)
bzero(&info, sizeof(info));
info.rti_info[RTAX_DST] = &sa;
info.rti_info[RTAX_NETMASK] = ifa->ifa_netmask;
- error = rtrequest1(RTM_DELETE, &info, RTP_CONNECTED, NULL, 0);
+ error = rtrequest1(RTM_DELETE,
+ &info, RTP_CONNECTED, NULL,
+ sc->sc_if.if_rdomain);
rt_missmsg(RTM_DELETE, &info, info.rti_flags, NULL,
- error, 0);
+ error, sc->sc_if.if_rdomain);
}
ifa->ifa_rtrequest = arp_rtrequest;
@@ -489,11 +493,13 @@ carp_setroute(struct carp_softc *sc, int cmd)
info.rti_info[RTAX_NETMASK] = ifa->ifa_netmask;
info.rti_info[RTAX_LABEL] =
(struct sockaddr *)&sa_rl;
- error = rtrequest1(RTM_ADD, &info, RTP_CONNECTED, NULL, 0);
+ error = rtrequest1(RTM_ADD, &info,
+ RTP_CONNECTED, NULL,
+ sc->sc_if.if_rdomain);
if (error == 0)
ifa->ifa_flags |= IFA_ROUTE;
rt_missmsg(RTM_ADD, &info, info.rti_flags,
- &sc->sc_if, error, 0);
+ &sc->sc_if, error, sc->sc_if.if_rdomain);
}
break;
case RTM_DELETE:
@@ -1996,6 +2002,7 @@ carp_set_addr(struct carp_softc *sc, struct sockaddr_in *sin)
if (ia->ia_ifp != &sc->sc_if &&
ia->ia_ifp->if_type != IFT_CARP &&
(ia->ia_ifp->if_flags & IFF_MULTICAST) &&
+ ia->ia_ifp->if_rdomain == sc->sc_if.if_rdomain &&
(sin->sin_addr.s_addr & ia->ia_subnetmask) ==
ia->ia_subnet) {
if (!ia_if)