diff options
-rw-r--r-- | sys/netinet/in.c | 23 |
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; |