summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2005-03-20 10:27:17 +0000
committerglebius <glebius@FreeBSD.org>2005-03-20 10:27:17 +0000
commit3adfed4ac4f3f6731adda700d863d34bafdf290f (patch)
treee42cb332d9ec4c9dd7052742e30beac63d0fe2e2
parentd4583f618fa4d349dd484197bf8e99956a527336 (diff)
downloadFreeBSD-src-3adfed4ac4f3f6731adda700d863d34bafdf290f.zip
FreeBSD-src-3adfed4ac4f3f6731adda700d863d34bafdf290f.tar.gz
Remove a workaround from previos revision. It proved to be incorrect.
Add two another workarounds for carp(4) interfaces: - do not add connected route when address is assigned to carp(4) interface - do not add connected route when other interface goes down Embrace workarounds with #ifdef DEV_CARP
-rw-r--r--sys/netinet/in.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index 3b81d0a..f7c49a0 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -31,6 +31,8 @@
* $FreeBSD$
*/
+#include "opt_carp.h"
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/sockio.h>
@@ -722,6 +724,13 @@ in_ifinit(ifp, ia, sin, scrub)
ia->ia_net = i & ia->ia_netmask;
ia->ia_subnet = i & ia->ia_subnetmask;
in_socktrim(&ia->ia_sockmask);
+#ifdef DEV_CARP
+ /*
+ * XXX: carp(4) does not have interface route
+ */
+ if (ifp->if_type == IFT_CARP)
+ return (0);
+#endif
/*
* Add route for the network.
*/
@@ -739,12 +748,6 @@ in_ifinit(ifp, ia, sin, scrub)
return (0);
flags |= RTF_HOST;
}
- /*
- * XXX: A route to network should never point to a carp(4)
- * interface. Use only host route for CARP address.
- */
- if (ifp->if_type == IFT_CARP)
- flags |= RTF_HOST;
if ((error = in_addprefix(ia, flags)) != 0)
return (error);
@@ -852,8 +855,14 @@ in_scrubprefix(target)
* If we got a matching prefix address, move IFA_ROUTE and
* the route itself to it. Make sure that routing daemons
* get a heads-up.
+ *
+ * XXX: a special case for carp(4) interface
*/
- if ((ia->ia_flags & IFA_ROUTE) == 0) {
+ if ((ia->ia_flags & IFA_ROUTE) == 0
+#ifdef DEV_CARP
+ && (ia->ia_ifp->if_type != IFT_CARP)
+#endif
+ ) {
rtinit(&(target->ia_ifa), (int)RTM_DELETE,
rtinitflags(target));
target->ia_flags &= ~IFA_ROUTE;
OpenPOWER on IntegriCloud