summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2007-01-02 11:41:29 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2007-01-02 11:41:29 +0000
commit092c83a2f82d484410f825d5ffd8d2b3d07020e8 (patch)
treecbe88292444698ca3ea025a3364b816d7d313c9c
parentecff57031a7b6e9b519519018ab84c20b1dae787 (diff)
move local network route to real interface instead of carp interface; from mpf@
-rw-r--r--sys/netinet/in.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index f2d13390bd9..ef465658c04 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in.c,v 1.44 2006/03/05 21:48:56 miod Exp $ */
+/* $OpenBSD: in.c,v 1.45 2007/01/02 11:41:28 markus Exp $ */
/* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */
/*
@@ -70,6 +70,11 @@
#include <net/if.h>
#include <net/route.h>
+#include "carp.h"
+#if NCARP > 0
+#include <net/if_types.h>
+#endif
+
#include <netinet/in.h>
#include <netinet/in_var.h>
#include <netinet/igmp_var.h>
@@ -659,7 +664,6 @@ in_ifscrub(ifp, ia)
struct ifnet *ifp;
struct in_ifaddr *ia;
{
-
in_scrubprefix(ia);
}
@@ -793,13 +797,23 @@ in_addprefix(target, flags)
mask.s_addr != ia->ia_sockmask.sin_addr.s_addr)
continue;
}
-
+ if ((ia->ia_flags & IFA_ROUTE) == 0)
+ continue;
+#if NCARP > 0
+ /* move to a real interface instead of carp interface */
+ if (ia->ia_ifp->if_type == IFT_CARP &&
+ target->ia_ifp->if_type != IFT_CARP) {
+ rtinit(&(ia->ia_ifa), (int)RTM_DELETE,
+ rtinitflags(ia));
+ ia->ia_flags &= ~IFA_ROUTE;
+ break;
+ }
+#endif
/*
* if we got a matching prefix route inserted by other
* interface adderss, we don't need to bother
*/
- if (ia->ia_flags & IFA_ROUTE)
- return 0;
+ return 0;
}
/*