DragonFly commits List (threaded) for 2012-01
git: carp: Make carp interfaces work like ethernet interfaces
Author: Sepherosa Ziehau <email@example.com>
Date: Mon Jan 23 16:19:06 2012 +0800
carp: Make carp interfaces work like ethernet interfaces
- Use ether_ifattach() instead of if_attach() to attach carp and carp's
ioctl methed will fallback to ether_ioctl().
- VHID changes will be reflected into the carp's ethernet address.
- Reimplement carp output path.
* carp uses the parent's if_output() i.e. ether_output(), but passes
the carp interface's ifp.
* The ether_output() is adjusted to detect the carp interface and
switch to the carp's parent interface just before performing the
* ARP resolve will use carp instead of its parent interface, thus
the ARP output's source ethernet address and the sender hardware
address are consistent and loopback on the carp will work as
- Reimplement carp input path>
* Input interface will be changed to carp if the packet is destined
to the carp's ethernet address.
* If the received packet is broadcast or multicast, all of the carps
on the receiving interface will receive a copy of the packet.
- Fix up gratuitous ARP.
* No gratuitous ARP will be sent for carp upon IP address changes.
* Gratuitous ARP sent by carp use itself as interface not carp's
- Fix up ARP input path. Since ARP request is broadcast packet, parent
interface of the carp will also receive the packet and will reply the
ARP request. If carp and its parent interface have same IP address,
the parent's ARP reply will confuse the ARP requester: the ethernet
address of the IP is no longer carp's ethernet address.
- Rework carp's prefix route addition and deletion.
* Add IP addresses to carp will not add prefix routes
* Bring carp interface up will not add prefix routes for carp's
existing IP addresses
* Carp IP addresses prefix route will be added when carp is master,
and the parent's corresponding IP addresses prefix route will be
* Carp IP addresses prefix route will be deleted when carp is no
longer master and the parent's corresponding IP addresses prefix
route will be added back.
- Handle carp parent interface's up/down events.
* When carp's parent is down, we fake up a parent IP address deletion
event for carp.
* When carp's parent is up, we fake up a parent IP address addition
event for carp.
- Stringent checks on CARP proto input path.
- Nullfy ifnet's serialier; carp is protected by global carp token.
- Mark CARP protocol MPSAFE
Summary of changes:
sys/net/if_ethersubr.c | 63 ++--
sys/netinet/if_ether.c | 85 ++++--
sys/netinet/if_ether.h | 2 +-
sys/netinet/in.c | 21 ++
sys/netinet/in_proto.c | 8 +-
sys/netinet/ip_carp.c | 753 ++++++++++++++++++++++++++--------------------
sys/netinet/ip_carp.h | 13 +-
sys/netinet/raw_ip.c | 14 +
sys/netinet6/in6_proto.c | 2 +-
9 files changed, 571 insertions(+), 390 deletions(-)
DragonFly BSD source repository