The FreeBSD codebase includes an implementation of the Netlink communication protocol (RFC 3549), used in Linux for facilitating interaction between the kernel and user-space processes. The project is limited to supporting the NETLINK_ROUTE family of operations for managing the state of the network subsystem in the kernel.
Currently, the level of Netlink support allows the use of the Linux utility ip from the iproute2 package in FreeBSD for managing network interfaces, setting IP addresses, configuring routing, and manipulating nexthop objects that store state information used for directing packets to their desired destinations. With minor modifications to the header files, it is possible to use Netlink in the Bird routing package.
The Netlink implementation for FreeBSD is designed as a loadable kernel module that, whenever possible, does not interfere with other kernel subsystems and creates separate task queues (tasqueue) for processing incoming protocol messages and executing operations asynchronously. The reason for porting Netlink is the lack of a standard mechanism for interacting with kernel subsystems, which leads different subsystems and drivers to invent their own protocols.
Netlink offers a unified communication layer and extensible message format, which can act as a mediator, automatically aggregating disparate data from various sources into a single request. For instance, FreeBSD subsystems such as devd, jail, and pfilctl, which currently use their own ioctl calls, can be transitioned to use Netlink, significantly simplifying application development for interacting with these subsystems. Moreover, using Netlink to modify nexthop objects and groups within the routing stack will allow for more efficient interactions with user-space routing processes.
Currently implemented capabilities:
- Retrieval of information about routes, objects and groups of nexthops, network interfaces, addresses, and neighboring hosts (arp/ndp).
- Generation of notifications for the appearance and disappearance of network interfaces, setting and removing addresses, adding and deleting routes.
- Adding and removing routes, objects and groups of nexthops, gateways, and network interfaces.
- Integration with the Rtsock interface for managing the routing table.
Source: opennet.ru
