Historically drivers were always traversing address lists manually. This
always was a nuisance:
- drivers depending on struct ifaddr, struct ifmaddr
- yet another dependency on struct ifnet
- dependency on how we lock address lists
All three points had been changed in the past numerous times and always
required at minimum recompilation of drivers, but sometimes a sweeping edit.
The most recent problem came with the network epoch. Conversion from LIST
to CK_LIST was performed with sed(1), but the bitter problem is that epoch
isn't a lock. Thus if_addr_rlock, if_maddr_rlock were converted into epoch
acqusition, but in an ugly way - the epoch tracker was placed on ifnet.
Thus, parallel call into if_addr_rlock on same interface would panic. This
was attempted to be corrected in r340413, which moved epoch tracker into
struct thread. This also emerged FreeBSD-EN-19:11.net for the stable/12.
The new KPI hides locking and internal representation of interface addresses.
The inital plan was to give KPI that will call a given callback for every
address. After editing all the drivers in the system, the plan was updated:
- filter out only link level addresses, no driver is interested in !AF_LINK
- count successfully processed addresses and return resulting count
- provide basic address counting functions
After converting all the drivers, the old KPIs are removed and then all
epoch related hacks from struct thread removed as well.
The branch is not planned to be committed as a single commit. The full
commit history can be browsed here: