Commit Graph

17 Commits

Author SHA1 Message Date
Baptiste Daroussin
1edc3b6e56 netlink: unregister groups along with family
Differential Revision:	https://reviews.freebsd.org/D37308
Reviewed by:	melifaro
2022-11-08 12:46:58 +01:00
Alexander V. Chernikov
4dfd380e06 netlink: allow more than 64 groups per netlink socket. 2022-11-03 17:05:34 +00:00
Alexander V. Chernikov
669d63eb85 netlink: remove private netlink_var.h header from the non-netlink core files. 2022-11-03 17:04:18 +00:00
Alexander V. Chernikov
728ca8506d netlink: fix CTRL_CMD_GETFAMILY lookup/dumps.
Reported by:	bapt
2022-10-31 17:12:42 +00:00
Alexander V. Chernikov
830352ccca netlink: fix genetlink CTRL_ATTR_MCAST_GRP_MAX define.
Reported by:	harti
2022-10-31 15:03:27 +00:00
Alexander V. Chernikov
03de61aabb netlink: fix NLMSG_SPACE() macro.
Reported by:	bapt
2022-10-31 15:02:12 +00:00
Alexander V. Chernikov
fc47afbfaf netlink: fix generic netlink privilege check.
Reported by:	bapt
2022-10-31 13:40:25 +00:00
Ed Maste
43d0c2ddd2 netlink: use (void) for function definitions with no arguments
For some of these Clang produced a warning that "a function declaration
without a prototype is deprecated in all versions of C".  In other cases
the function defintion used () which did not match the header
declaration, which used (void).

Sponsored by:	The FreeBSD Foundation
2022-10-27 11:14:00 -04:00
Gleb Smirnoff
b958b862b1 netlink: make it working without INET6 2022-10-04 14:39:49 -07:00
Hans Petter Selasky
1d41a05557 Fix kernel build after fcb3f813f3 .
By adding missing ifdefs for INET and INET6 when building LINT-NOIP .

Differential Revision:	https://reviews.freebsd.org/D36731
Sponsored by:	NVIDIA Networking
2022-10-04 16:08:39 +02:00
Alexander V. Chernikov
356724fc93 netlink: fix non-default builds (no INET, INET6, ROUTE_MPATH). 2022-10-02 13:12:52 +00:00
Jung-uk Kim
fc083c3eb2 netlink: Fix build without VIMAGE 2022-10-01 21:41:54 -04:00
Alexander V. Chernikov
03994c24da netlink: fix build without INVARIANTS
Reported by:	cy
2022-10-01 21:20:50 +00:00
Alexander V. Chernikov
8d9f3e0572 netlink: fix format strings on 32-bit platforms 2022-10-01 21:16:31 +00:00
Alexander V. Chernikov
c90bff3fa7 netlink: fix debugging on 32-bit platforms 2022-10-01 19:03:35 +00:00
Alexander V. Chernikov
dddafa8d25 netlink: make test-includes happy by hiding most of the header
contents under _KERNEL.
2022-10-01 17:01:53 +00:00
Alexander V. Chernikov
7e5bf68495 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
2022-10-01 14:15:35 +00:00