AddrSel
Address Selection Utility for Mac OS X
Motivation
When running on a dual-stack network, the host needs to select which stack to use. Apple uses an improved version of Happy Eyeballs (RFC6555) to address the issue. The algorithm dynamically makes decisions based on latency and other factors, providing a fast Internet experience.
While this is the favored behavior to most users, network administrators could be annoyed. They would like to configure the policy table (described in RFC3484) statically, so they can have direct control for sure.
Therefore, I decide to bring the missing ADDRSEL section back. It was once enabled in the bsd part of xnu kernel, implementing several functions to configure the policy table. I copy that part of code into a kext and wrap it up. And here it is.
How to use
- Build the xcode project
sudo chown root:wheel addrsel.kext
sudo kextload addrsel.kext
(you may need to disable SIP or kext signature check)sudo ./ip6addrctl
Stuff used to make this
- xnu/bsd/netinet6/in6_src.c: configure policy table
- KernelResolver: resolve un-exported symbol (addrsel_policytab)
- Kernel Control API: communicate with userspace
- ip6addrctl.c: command line interface