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.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.c')
-rw-r--r-- | sys/net/if.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index b6505df..3c25986 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -34,6 +34,7 @@ #include "opt_inet6.h" #include "opt_inet.h" #include "opt_mac.h" +#include "opt_carp.h" #include <sys/param.h> #include <sys/types.h> @@ -78,6 +79,9 @@ #ifdef INET #include <netinet/if_ether.h> #endif +#ifdef DEV_CARP +#include <netinet/ip_carp.h> +#endif void (*ng_ether_link_state_p)(struct ifnet *ifp, int state); @@ -529,6 +533,12 @@ if_detach(struct ifnet *ifp) int found; EVENTHANDLER_INVOKE(ifnet_departure_event, ifp); +#ifdef DEV_CARP + /* Maybe hook to the generalized departure handler above?!? */ + if (ifp->if_carp) + carp_ifdetach(ifp); +#endif + /* * Remove routes and flush queues. */ @@ -933,6 +943,10 @@ if_unroute(struct ifnet *ifp, int flag, int fam) if (fam == PF_UNSPEC || (fam == ifa->ifa_addr->sa_family)) pfctlinput(PRC_IFDOWN, ifa->ifa_addr); if_qflush(&ifp->if_snd); +#ifdef DEV_CARP + if (ifp->if_carp) + carp_carpdev_state(ifp->if_carp); +#endif rt_ifmsg(ifp); } @@ -951,6 +965,10 @@ 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); +#ifdef DEV_CARP + if (ifp->if_carp) + carp_carpdev_state(ifp->if_carp); +#endif rt_ifmsg(ifp); #ifdef INET6 in6_if_up(ifp); |