diff options
author | glebius <glebius@FreeBSD.org> | 2005-02-22 13:04:05 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2005-02-22 13:04:05 +0000 |
commit | e1d22638d0a8257ed01b7f95d1b6d5cef74ebd07 (patch) | |
tree | 120bc2567ed859da022499edb1691fa4c7bdd908 /sys/net/if_ethersubr.c | |
parent | a986ceef8da1f3c7f37ca981d799c33b3e6ae3f2 (diff) | |
download | FreeBSD-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/net/if_ethersubr.c')
-rw-r--r-- | sys/net/if_ethersubr.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 1b973fe..2c4ff99 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -37,6 +37,7 @@ #include "opt_bdg.h" #include "opt_mac.h" #include "opt_netgraph.h" +#include "opt_carp.h" #include <sys/param.h> #include <sys/systm.h> @@ -73,6 +74,10 @@ #include <netinet6/nd6.h> #endif +#ifdef DEV_CARP +#include <netinet/ip_carp.h> +#endif + #ifdef IPX #include <netipx/ipx.h> #include <netipx/ipx_if.h> @@ -315,6 +320,12 @@ ether_output(struct ifnet *ifp, struct mbuf *m, } } +#ifdef DEV_CARP + if (ifp->if_carp && + (error = carp_output(ifp, m, dst, NULL))) + goto bad; +#endif + /* Handle ng_ether(4) processing, if any */ if (IFP2AC(ifp)->ac_netgraph != NULL) { if ((error = (*ng_ether_output_p)(ifp, &m)) != 0) { @@ -606,6 +617,18 @@ ether_demux(struct ifnet *ifp, struct mbuf *m) if (!(BDG_ACTIVE(ifp)) && !((ether_type == ETHERTYPE_VLAN || m->m_flags & M_VLANTAG) && ifp->if_nvlans > 0)) { +#ifdef DEV_CARP + /* + * XXX: Okay, we need to call carp_forus() and - if it is for us + * jump over code that does the normal check + * "ac_enaddr == ether_dhost". The check sequence is a bit + * different from OpenBSD, so we jump over as few code as possible, + * to catch _all_ sanity checks. This needs evaluation, to see if + * the carp ether_dhost values break any of these checks! + */ + if (ifp->if_carp && carp_forus(ifp->if_carp, eh->ether_dhost)) + goto pre_stats; +#endif /* * Discard packet if upper layers shouldn't see it because it * was unicast to a different Ethernet address. If the driver @@ -628,6 +651,9 @@ ether_demux(struct ifnet *ifp, struct mbuf *m) } } +#ifdef DEV_CARP +pre_stats: +#endif /* Discard packet if interface is not up */ if ((ifp->if_flags & IFF_UP) == 0) { m_freem(m); |