=== Netlink on FreeBSD Links: + link:https://reviews.freebsd.org/D36002[Initial review] URL: link:https://reviews.freebsd.org/D36002[https://reviews.freebsd.org/D36002] + link:https://static.ipfw.ru/files/netlink.pdf[Netlink talk] URL: link:https://static.ipfw.ru/files/netlink.pdf[https://static.ipfw.ru/files/netlink.pdf] Contact: Alexander Chernikov Netlink is a communication protocol defined in RFC 3549. It is an async, TLV-based protocol, providing 1-1 and 1-many communications between kernel and userland. Netlink is currently used in the Linux kernel to modify, read and subscribe for nearly all networking states. Interface state, addresses, routes, firewall, rules, fibs, etc, are controlled via Netlink. ==== Why is Netlink important for FreeBSD? POSIX defines an API for base functions/system calls. There is no such standard for the plethora of protocol/device-level/subsystem-level ioctls. Each subsystem/driver invents its own protocol, handling format and compatibility. Extendability is a notable problem in the networking control plane. For example, it is extremely hard to add properties to the routing socket messages without breaking compatibility. Netlink offers unification by providing a standard communication layer and basic easily-extendable message formatting. It can serve as a "broker", automatically combining requested data from different sources in a single request (example: interface state dump). Netlink APIs lower the bar for application developers to support FreeBSD, while providing the desired extendability. ==== Current status Netlink has been committed to HEAD. The code implements a subset of the `NETLINK_ROUTE` subsystem and `NETLINK_GENERIC` framework. `NETLINK_ROUTE` supports add/delete/replace operations for routes, nexthops and link-level addresses. Partial support exists for the interface addresses and interfaces. Linuxulator support for Netlink has been committed to HEAD. It is possible to use the unmodified ip from iproute2 with routes, nexthops, addresses and interfaces. The simple userland library, snl(3), that provides convenient abstractions on the netlink socket, has been committed to HEAD. The first third-party software, BIRD, link:https://gitlab.nic.cz/labs/bird/-/commit/1e47b9f203aaaad0fb658d40a1670f1d0437f1f8[added experimental FreeBSD Netlink support]. ==== Next steps * Add Netlink to GENERIC * Make `netstat/route/arp/ndp/ifconfig` use Netlink interfaces (help is appreciated) * Add FreeBSD Netlink support to ports of FreeRangeRouting (FRRouting (FRR)).