#
a034c0ae |
| 03-Dec-2024 |
Gleb Smirnoff <glebius@FreeBSD.org> |
netlink: refactor writer initialization KPI
o Allow callers to initialize a writer that will malloc(9) with M_WAITOK. o Use size_t for expected malloc size. o Use correct types to initialize a group
netlink: refactor writer initialization KPI
o Allow callers to initialize a writer that will malloc(9) with M_WAITOK. o Use size_t for expected malloc size. o Use correct types to initialize a group writer. o Rename functions into nl_writer_ namespace instead of nlmsg_, cause they are working on nl_writer, not on nlmsg. o Make the KPI responsible to sparsely initialize the writer structure. o Garbage collect chain writer. Fixes 17083b94a915.
All current consumers are left as is, however some may benefit from M_WAITOK allocation as well as supplying a correct expected size.
Reviewed by: melifaro Differential Revision: https://reviews.freebsd.org/D47549
show more ...
|
Revision tags: release/14.2.0, release/13.4.0, release/14.1.0, release/13.3.0, release/14.0.0 |
|
#
ab393e95 |
| 12-Oct-2023 |
Kristof Provost <kp@FreeBSD.org> |
netlink: move NETLINK define to opt_global.h
Move the NETLINK define into opt_global.h so we can rely on it being set correctly, without having to remember to include opt_netlink.h. This ensures tha
netlink: move NETLINK define to opt_global.h
Move the NETLINK define into opt_global.h so we can rely on it being set correctly, without having to remember to include opt_netlink.h. This ensures that the NETLINK define is correctly set. If not we may end up with unloadable modules, due to missing symbols (such as nlmsg_get_group_writer).
PR: 274306 Reviewed by: imp, markj MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D42179
show more ...
|
Revision tags: release/13.2.0 |
|
#
19e43c16 |
| 27-Mar-2023 |
Alexander V. Chernikov <melifaro@FreeBSD.org> |
netlink: add netlink KPI to the kernel by default
This change does the following:
Base Netlink KPIs (ability to register the family, parse and/or write a Netlink message) are always present in the
netlink: add netlink KPI to the kernel by default
This change does the following:
Base Netlink KPIs (ability to register the family, parse and/or write a Netlink message) are always present in the kernel. Specifically, * Implementation of genetlink family/group registration/removal, some base accessors (netlink_generic_kpi.c, 260 LoC) are compiled in unconditionally. * Basic TLV parser functions (netlink_message_parser.c, 507 LoC) are compiled in unconditionally. * Glue functions (netlink<>rtsock), malloc/core sysctl definitions (netlink_glue.c, 259 LoC) are compiled in unconditionally. * The rest of the KPI _functions_ are defined in the netlink_glue.c, but their implementation calls a pointer to either the stub function or the actual function, depending on whether the module is loaded or not.
This approach allows to have only 1k LoC out of ~3.7k LoC (current sys/netlink implementation) in the kernel, which will not grow further. It also allows for the generic netlink kernel customers to load successfully without requiring Netlink module and operate correctly once Netlink module is loaded.
Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D39269
show more ...
|
#
c9313a0b |
| 22-Dec-2022 |
Alexander V. Chernikov <melifaro@FreeBSD.org> |
netlink: allow netlink to be build in the kernel
Differential Revision: https://reviews.freebsd.org/D37781
|
Revision tags: release/12.4.0 |
|
#
a87d2d18 |
| 04-Oct-2022 |
Gleb Smirnoff <glebius@FreeBSD.org> |
netlink: fix standalone module build
|
Revision tags: release/13.1.0 |
|
#
7e5bf684 |
| 20-Jan-2022 |
Alexander V. Chernikov <melifaro@FreeBSD.org> |
netlink: add netlink support
Netlinks is a communication protocol currently used in Linux kernel to modify, read and subscribe for nearly all networking state. Interfaces, addresses, routes, firew
netlink: add netlink support
Netlinks is a communication protocol currently used in Linux kernel to modify, read and subscribe for nearly all networking state. Interfaces, addresses, routes, firewall, fibs, vnets, etc are controlled via netlink. It is async, TLV-based protocol, providing 1-1 and 1-many communications.
The current implementation supports the subset of NETLINK_ROUTE family. To be more specific, the following is supported: * Dumps: - routes - nexthops / nexthop groups - interfaces - interface addresses - neighbors (arp/ndp) * Notifications: - interface arrival/departure - interface address arrival/departure - route addition/deletion * Modifications: - adding/deleting routes - adding/deleting nexthops/nexthops groups - adding/deleting neghbors - adding/deleting interfaces (basic support only) * Rtsock interaction - route events are bridged both ways
The implementation also supports the NETLINK_GENERIC family framework.
Implementation notes: Netlink is implemented via loadable/unloadable kernel module, not touching many kernel parts. Each netlink socket uses dedicated taskqueue to support async operations that can sleep, such as interface creation. All message processing is performed within these taskqueues.
Compatibility: Most of the Netlink data models specified above maps to FreeBSD concepts nicely. Unmodified ip(8) binary correctly works with interfaces, addresses, routes, nexthops and nexthop groups. Some software such as net/bird require header-only modifications to compile and work with FreeBSD netlink.
Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D36002 MFC after: 2 months
show more ...
|