carp(4) allows people to share a set of IP addresses and can only

use IPv4/v6 for inter-node communication (according to my reading).

Properly wrap the carp callouts in INET || INET6 and refelect this
in sys/conf/files as well.  While in theory this should be ok,
it might be a bit optimistic to think that carp could build with
inet6 only[1].

Discussed with:		mlaier [1]
This commit is contained in:
Bjoern A. Zeeb 2009-06-11 10:26:38 +00:00
parent 493f0f1709
commit 259d2d5431
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=193983
4 changed files with 18 additions and 2 deletions

View File

@ -2352,7 +2352,7 @@ netinet/if_atm.c optional atm
netinet/if_ether.c optional ether
netinet/igmp.c optional inet
netinet/in.c optional inet
netinet/ip_carp.c optional carp
netinet/ip_carp.c optional inet carp | inet6 carp
netinet/in_gif.c optional gif inet
netinet/ip_gre.c optional gre inet
netinet/ip_id.c optional inet

View File

@ -86,9 +86,11 @@
#include <netinet/if_ether.h>
#include <netinet/vinet.h>
#endif
#if defined(INET) || defined(INET6)
#ifdef DEV_CARP
#include <netinet/ip_carp.h>
#endif
#endif
#include <security/mac/mac_framework.h>
@ -1738,9 +1740,11 @@ if_unroute(struct ifnet *ifp, int flag, int fam)
pfctlinput(PRC_IFDOWN, ifa->ifa_addr);
ifp->if_qflush(ifp);
#if defined(INET) || defined(INET6)
#ifdef DEV_CARP
if (ifp->if_carp)
carp_carpdev_state(ifp->if_carp);
#endif
#endif
rt_ifmsg(ifp);
}
@ -1762,9 +1766,11 @@ if_route(struct ifnet *ifp, int flag, int fam)
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link)
if (fam == PF_UNSPEC || (fam == ifa->ifa_addr->sa_family))
pfctlinput(PRC_IFUP, ifa->ifa_addr);
#if defined(INET) || defined(INET6)
#ifdef DEV_CARP
if (ifp->if_carp)
carp_carpdev_state(ifp->if_carp);
#endif
#endif
rt_ifmsg(ifp);
#ifdef INET6
@ -1816,9 +1822,11 @@ do_link_state_change(void *arg, int pending)
if ((ifp->if_type == IFT_ETHER || ifp->if_type == IFT_L2VLAN) &&
IFP2AC(ifp)->ac_netgraph != NULL)
(*ng_ether_link_state_p)(ifp, link_state);
#if defined(INET) || defined(INET6)
#ifdef DEV_CARP
if (ifp->if_carp)
carp_carpdev_state(ifp->if_carp);
#endif
#endif
if (ifp->if_bridge) {
KASSERT(bstp_linkstate_p != NULL,("if_bridge bstp not loaded!"));

View File

@ -122,9 +122,11 @@ __FBSDID("$FreeBSD$");
#include <netinet6/ip6_var.h>
#include <netinet6/vinet6.h>
#endif
#if defined(INET) || defined(INET6)
#ifdef DEV_CARP
#include <netinet/ip_carp.h>
#endif
#endif
#include <machine/in_cksum.h>
#include <netinet/if_ether.h> /* for struct arpcom */
#include <net/bridgestp.h>
@ -2231,7 +2233,7 @@ bridge_input(struct ifnet *ifp, struct mbuf *m)
return (m);
}
#ifdef DEV_CARP
#if (defined(INET) || defined(INET6)) && defined(DEV_CARP)
# define OR_CARP_CHECK_WE_ARE_DST(iface) \
|| ((iface)->if_carp \
&& carp_forus((iface)->if_carp, eh->ether_dhost))

View File

@ -79,9 +79,11 @@
#include <netinet6/nd6.h>
#endif
#if defined(INET) || defined(INET6)
#ifdef DEV_CARP
#include <netinet/ip_carp.h>
#endif
#endif
#ifdef IPX
#include <netipx/ipx.h>
@ -393,10 +395,12 @@ ether_output(struct ifnet *ifp, struct mbuf *m,
return (error);
}
#if defined(INET) || defined(INET6)
#ifdef DEV_CARP
if (ifp->if_carp &&
(error = carp_output(ifp, m, dst, NULL)))
goto bad;
#endif
#endif
/* Handle ng_ether(4) processing, if any */
@ -712,6 +716,7 @@ ether_input(struct ifnet *ifp, struct mbuf *m)
}
}
#if defined(INET) || defined(INET6)
#ifdef DEV_CARP
/*
* Clear M_PROMISC on frame so that carp(4) will see it when the
@ -726,6 +731,7 @@ ether_input(struct ifnet *ifp, struct mbuf *m)
if (ifp->if_carp && carp_forus(ifp->if_carp, eh->ether_dhost)) {
m->m_flags &= ~M_PROMISC;
} else
#endif
#endif
{
/*