FreeBSD adds support for the Netlink protocol used in the Linux kernel

The FreeBSD codebase adopts an implementation of the Netlink communication protocol (RFC 3549), which is used in Linux to organize interaction between the kernel and processes in user space. The project is limited to supporting the NETLINK_ROUTE family of operations for managing the state of the networking subsystem in the kernel.

In its current form, the Netlink support layer allows FreeBSD to use the Linux ip utility from the iproute2 package to manage network interfaces, set IP addresses, configure routing, and manipulate nexthop objects that store the state used to forward a packet to the desired destination. After slightly changing the header files, it is possible to use Netlink in the Bird routing package.

The Netlink implementation for FreeBSD is packaged as a loadable kernel module that, if possible, does not affect other kernel subsystems and creates separate task queues (tasqueue) to process incoming messages via the protocol and perform operations in asynchronous mode. The reason for porting Netlink is the lack of a standard mechanism for interacting with kernel subsystems, which leads to different subsystems and drivers inventing their own protocols.

Netlink offers a unified communication layer and an extensible message format that can act as an intermediary that automatically combines disparate data from different sources into a single request. For example, FreeBSD subsystems such as devd, jail, and pfilctl can be migrated to Netlink, now using their own ioctl calls, which will greatly simplify the creation of applications for working with these subsystems. In addition, using Netlink to modify the nexthop objects and groups in the routing stack will allow more efficient interaction with user-space routing processes.

Features currently implemented:

  • Getting information about routes, nexthops objects and groups, network interfaces, addresses and neighboring hosts (arp/ndp).
  • Formation of notifications about the appearance and disconnection of network interfaces, setting and deleting addresses, adding and deleting routes.
  • Adding and removing routes, nexthops objects and groups, gateways, network interfaces.
  • Integration with the Rtsock interface to manage the routing table.

Source: opennet.ru

Add a comment