summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_input.c
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2005-02-22 13:04:05 +0000
committerglebius <glebius@FreeBSD.org>2005-02-22 13:04:05 +0000
commite1d22638d0a8257ed01b7f95d1b6d5cef74ebd07 (patch)
tree120bc2567ed859da022499edb1691fa4c7bdd908 /sys/netinet/ip_input.c
parenta986ceef8da1f3c7f37ca981d799c33b3e6ae3f2 (diff)
downloadFreeBSD-src-e1d22638d0a8257ed01b7f95d1b6d5cef74ebd07.zip
FreeBSD-src-e1d22638d0a8257ed01b7f95d1b6d5cef74ebd07.tar.gz
Add CARP (Common Address Redundancy Protocol), which allows multiple
hosts to share an IP address, providing high availability and load balancing. Original work on CARP done by Michael Shalayeff, with many additions by Marco Pfatschbacher and Ryan McBride. FreeBSD port done solely by Max Laier. Patch by: mlaier Obtained from: OpenBSD (mickey, mcbride)
Diffstat (limited to 'sys/netinet/ip_input.c')
-rw-r--r--sys/netinet/ip_input.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 3021285..ecf79ae 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -35,6 +35,7 @@
#include "opt_ipstealth.h"
#include "opt_ipsec.h"
#include "opt_mac.h"
+#include "opt_carp.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -66,6 +67,9 @@
#include <netinet/ip_var.h>
#include <netinet/ip_icmp.h>
#include <machine/in_cksum.h>
+#ifdef DEV_CARP
+#include <netinet/ip_carp.h>
+#endif
#include <sys/socketvar.h>
@@ -509,10 +513,17 @@ passin:
* XXX - Checking is incompatible with IP aliases added
* to the loopback interface instead of the interface where
* the packets are received.
+ *
+ * XXX - This is the case for carp vhost IPs as well so we
+ * insert a workaround. If the packet got here, we already
+ * checked with carp_iamatch() and carp_forus().
*/
checkif = ip_checkinterface && (ipforwarding == 0) &&
m->m_pkthdr.rcvif != NULL &&
((m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) == 0) &&
+#ifdef DEV_CARP
+ !m->m_pkthdr.rcvif->if_carp &&
+#endif
(dchg == 0);
/*
OpenPOWER on IntegriCloud