# # new CARP has been committed to head/ # The reason for this patch was that CARP protocol actually doesn't bring a new interface, but is a property of interface address. Rewriting it in this way helps to remove several hacks from incoming packet processing[1], simplifies some code, makes CARP addresses more sane from viewpoint of routing daemons such as quagga/zebra. It also brings support for a single redundant address on the subnet, the thing that is called "carpdev feature" in OpenBSD, long awaited in FreeBSD. Along with the major change that "carp isn't ifnet", several unrelated features are added: + single redundant address in subnet (already mentioned "carpdev") + switching state with ifconfig + displaying keys with ifconfig -k + using more modern kernel interfaces to allocate multicast memberships + better locking + module unload support + kern/161123 One feature is dropped for now: - arpbalance algorithm I plan to restore arpbalance algorithm as well as add ipbalance from OpenBSD, however this requires a next stage of rewriting code. I'd like the current patch to settle a bit first. New implementation doesn't touch protocol, so new CARP would work with older one as redundant pair[2]. Configuration of new implementation looks like this: # In this live example I've got box running one static address 10.0.0.118, # on igb0. Its peer is old CARP implementation with following configuration: # carp0: flags=49 metric 0 mtu 1500 # inet6 2001:db8::3 prefixlen 64 # inet 10.0.0.112 netmask 0xffffffe0 # nd6 options=21 # carp: MASTER vhid 112 advbase 1 advskew 0 % ifconfig igb0 igb0: flags=8843 metric 0 mtu 1500 options=401bb ether 00:25:90:03:0e:fa inet 10.0.0.118 netmask 0xffffffe0 broadcast 10.0.0.127 nd6 options=21 media: Ethernet autoselect (1000baseT ) status: active % ifconfig igb0 inet6 2001:db8::3 vhid 112 pass qwerty % ifconfig igb0 10.0.0.112/27 alias vhid 112 % ifconfig igb0 igb0: flags=8943 metric 0 mtu 1500 options=401bb ether 00:25:90:03:0e:fa inet6 fe80::225:90ff:fe03:efa%igb0 prefixlen 64 scopeid 0x1 inet 10.0.0.118 netmask 0xffffffe0 broadcast 10.0.0.127 inet6 2001:db8::3 prefixlen 64 vhid 112 inet 10.0.0.112 netmask 0xffffffe0 broadcast 10.0.0.127 vhid 112 nd6 options=21 media: Ethernet autoselect (1000baseT ) status: active carp: BACKUP vhid 112 advbase 1 advskew 0 % ifconfig igb0 vhid 112 state master % ifconfig igb0 igb0: flags=8943 metric 0 mtu 1500 options=401bb ether 00:25:90:03:0e:fa inet6 fe80::225:90ff:fe03:efa%igb0 prefixlen 64 scopeid 0x1 inet 10.0.0.118 netmask 0xffffffe0 broadcast 10.0.0.127 inet6 2001:db8::3 prefixlen 64 vhid 112 inet 10.0.0.112 netmask 0xffffffe0 broadcast 10.0.0.127 vhid 112 nd6 options=21 media: Ethernet autoselect (1000baseT ) status: active carp: MASTER vhid 112 advbase 1 advskew 0 # peer switched to backup Patch consist of single file newcarp.diff, that should be applied to root of source tree. Would apply and compile only on fresh head/. Patch is planned to be included into FreeBSD 10. It isn't going to be merged to stable/9, since as you see above it changes semantics of ifconfig(8), size of struct ifreq, and probably a couple of other APIs/ABIs. History: 20111113 Sync with recent head/. Minor nits. 20111026 Fixed sending gratutious ARP on initialization. Fixed warning messages about someone using my IP address. Minor nits. 20111013 Update. Added infrastructure to import vhid number to userland, and now ifconfig(8) displayes it correctly. Thanks to Bjoern Zeeb for that! Included patch from kern/161123. Minor nits. 20110812 Update. Fixed installing/deleting loopback route for inet6 address when switching master/backup. 20110811 First version published. For review and brave testers. [1] Not all of them are removed by this patch, but I suppose it is now more likely to kill carp_iamatch/carp_forus, inlining them into input packet path. However, at this moment that fact that CARP is optional feature in network stack, makes this difficult. [2] Don't forget that pfsync(4) from FreeBSD 9.x won't work with one from FreeBSD 8.x.