svn commit: r193983 - in head/sys: conf net

Bjoern A. Zeeb bz at FreeBSD.org
Thu Jun 11 10:26:39 UTC 2009


Author: bz
Date: Thu Jun 11 10:26:38 2009
New Revision: 193983
URL: http://svn.freebsd.org/changeset/base/193983

Log:
  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]

Modified:
  head/sys/conf/files
  head/sys/net/if.c
  head/sys/net/if_bridge.c
  head/sys/net/if_ethersubr.c

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Thu Jun 11 09:59:47 2009	(r193982)
+++ head/sys/conf/files	Thu Jun 11 10:26:38 2009	(r193983)
@@ -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

Modified: head/sys/net/if.c
==============================================================================
--- head/sys/net/if.c	Thu Jun 11 09:59:47 2009	(r193982)
+++ head/sys/net/if.c	Thu Jun 11 10:26:38 2009	(r193983)
@@ -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,10 +1740,12 @@ if_unroute(struct ifnet *ifp, int flag, 
 			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,10 +1766,12 @@ if_route(struct ifnet *ifp, int flag, in
 	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
 	in6_if_up(ifp);
@@ -1816,10 +1822,12 @@ do_link_state_change(void *arg, int pend
 	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!"));
 		(*bstp_linkstate_p)(ifp, link_state);

Modified: head/sys/net/if_bridge.c
==============================================================================
--- head/sys/net/if_bridge.c	Thu Jun 11 09:59:47 2009	(r193982)
+++ head/sys/net/if_bridge.c	Thu Jun 11 10:26:38 2009	(r193983)
@@ -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 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))

Modified: head/sys/net/if_ethersubr.c
==============================================================================
--- head/sys/net/if_ethersubr.c	Thu Jun 11 09:59:47 2009	(r193982)
+++ head/sys/net/if_ethersubr.c	Thu Jun 11 10:26:38 2009	(r193983)
@@ -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,11 +395,13 @@ ether_output(struct ifnet *ifp, struct 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 */
 	if (IFP2AC(ifp)->ac_netgraph != NULL) {
@@ -712,6 +716,7 @@ ether_input(struct ifnet *ifp, struct mb
 		}
 	}
 
+#if defined(INET) || defined(INET6)
 #ifdef DEV_CARP
 	/*
 	 * Clear M_PROMISC on frame so that carp(4) will see it when the
@@ -727,6 +732,7 @@ ether_input(struct ifnet *ifp, struct mb
 		m->m_flags &= ~M_PROMISC;
 	} else
 #endif
+#endif
 	{
 		/*
 		 * If the frame received was not for our MAC address, set the


More information about the svn-src-head mailing list