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/netinet6/in6.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/netinet6/in6.c')
-rw-r--r-- | sys/netinet6/in6.c | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 163dbfe..7bd5e64 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -206,7 +206,7 @@ in6_ifloop_request(int cmd, struct ifaddr *ifa) * rely on the cloning mechanism from the corresponding interface route * any more. */ -static void +void in6_ifaddloop(struct ifaddr *ifa) { struct rtentry *rt; @@ -226,7 +226,7 @@ in6_ifaddloop(struct ifaddr *ifa) * Remove loopback rtentry of ownaddr generated by in6_ifaddloop(), * if it exists. */ -static void +void in6_ifremloop(struct ifaddr *ifa) { struct in6_ifaddr *ia; @@ -1551,6 +1551,39 @@ in6_ifinit(ifp, ia, sin6, newhost) return (error); } +struct in6_multi_mship * +in6_joingroup(ifp, addr, errorp) + struct ifnet *ifp; + struct in6_addr *addr; + int *errorp; +{ + struct in6_multi_mship *imm; + + imm = malloc(sizeof(*imm), M_IPMADDR, M_NOWAIT); + if (!imm) { + *errorp = ENOBUFS; + return NULL; + } + imm->i6mm_maddr = in6_addmulti(addr, ifp, errorp); + if (!imm->i6mm_maddr) { + /* *errorp is alrady set */ + free(imm, M_IPMADDR); + return NULL; + } + return imm; +} + +int +in6_leavegroup(imm) + struct in6_multi_mship *imm; +{ + + if (imm->i6mm_maddr) + in6_delmulti(imm->i6mm_maddr); + free(imm, M_IPMADDR); + return 0; +} + /* * Find an IPv6 interface link-local address specific to an interface. */ |