summaryrefslogtreecommitdiffstats
path: root/sys/net/if_bridge.c
diff options
context:
space:
mode:
authorwill <will@FreeBSD.org>2010-08-11 00:51:50 +0000
committerwill <will@FreeBSD.org>2010-08-11 00:51:50 +0000
commitaa4e762c4a720fc3e1b4d3f08d09c5b65bb07735 (patch)
tree5194d90f80d5d4fac28f6f736d5c02cf80511112 /sys/net/if_bridge.c
parent8afd703de9fc0419708d83e8c31c1f0facca78dd (diff)
downloadFreeBSD-src-aa4e762c4a720fc3e1b4d3f08d09c5b65bb07735.zip
FreeBSD-src-aa4e762c4a720fc3e1b4d3f08d09c5b65bb07735.tar.gz
Allow carp(4) to be loaded as a kernel module. Follow precedent set by
bridge(4), lagg(4) etc. and make use of function pointers and pf_proto_register() to hook carp into the network stack. Currently, because of the uncertainty about whether the unload path is free of race condition panics, unloads are disallowed by default. Compiling with CARPMOD_CAN_UNLOAD in CFLAGS removes this anti foot shooting measure. This commit requires IP6PROTOSPACER, introduced in r211115. Reviewed by: bz, simon Approved by: ken (mentor) MFC after: 2 weeks
Diffstat (limited to 'sys/net/if_bridge.c')
-rw-r--r--sys/net/if_bridge.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index 5f33dd5..fb04731 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -79,7 +79,6 @@ __FBSDID("$FreeBSD$");
#include "opt_inet.h"
#include "opt_inet6.h"
-#include "opt_carp.h"
#include <sys/param.h>
#include <sys/mbuf.h>
@@ -121,10 +120,8 @@ __FBSDID("$FreeBSD$");
#include <netinet6/ip6_var.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>
@@ -2144,6 +2141,10 @@ drop:
m_freem(m);
}
+#if defined(INET) || defined(INET6)
+int (*carp_forus_p)(struct carp_if *, u_char *);
+#endif
+
/*
* bridge_input:
*
@@ -2252,13 +2253,13 @@ bridge_input(struct ifnet *ifp, struct mbuf *m)
return (m);
}
-#if (defined(INET) || defined(INET6)) && defined(DEV_CARP)
+#if (defined(INET) || defined(INET6))
# define OR_CARP_CHECK_WE_ARE_DST(iface) \
|| ((iface)->if_carp \
- && carp_forus((iface)->if_carp, eh->ether_dhost))
+ && (*carp_forus_p)((iface)->if_carp, eh->ether_dhost))
# define OR_CARP_CHECK_WE_ARE_SRC(iface) \
|| ((iface)->if_carp \
- && carp_forus((iface)->if_carp, eh->ether_shost))
+ && (*carp_forus_p)((iface)->if_carp, eh->ether_shost))
#else
# define OR_CARP_CHECK_WE_ARE_DST(iface)
# define OR_CARP_CHECK_WE_ARE_SRC(iface)
OpenPOWER on IntegriCloud