Re: git: 7e5bf68495cc - main - netlink: add netlink support
- In reply to: Kristof Provost : "Re: git: 7e5bf68495cc - main - netlink: add netlink support"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 09 Mar 2023 17:45:50 UTC
> On 9 Mar 2023, at 15:38, Kristof Provost <kp@FreeBSD.org> wrote: > > On 1 Oct 2022, at 16:19, Alexander V. Chernikov wrote: > > The branch main has been updated by melifaro: > > URL: https://cgit.FreeBSD.org/src/commit/?id=7e5bf68495cc0a8c9793a338a8a02009a7f6dbb6 <https://cgit.freebsd.org/src/commit/?id=7e5bf68495cc0a8c9793a338a8a02009a7f6dbb6> > commit 7e5bf68495cc0a8c9793a338a8a02009a7f6dbb6 > Author: Alexander V. Chernikov <melifaro@FreeBSD.org> > AuthorDate: 2022-01-20 21:39:21 +0000 > Commit: Alexander V. Chernikov <melifaro@FreeBSD.org> > CommitDate: 2022-10-01 14:15:35 +0000 > > netlink: add netlink support > ... > + > +/* > + * Defition of numbers assigned to the netlink subsystems. > + */ > +#define NETLINK_ROUTE 0 /* Routing/device hook */ > +#define NETLINK_UNUSED 1 /* not supported */ > +#define NETLINK_USERSOCK 2 /* not supported */ > +#define NETLINK_FIREWALL 3 /* not supported */ > +#define NETLINK_SOCK_DIAG 4 /* not supported */ > +#define NETLINK_NFLOG 5 /* not supported */ > +#define NETLINK_XFRM 6 /* (not supported) PF_SETKEY */ > +#define NETLINK_SELINUX 7 /* not supported */ > +#define NETLINK_ISCSI 8 /* not supported */ > +#define NETLINK_AUDIT 9 /* not supported */ > +#define NETLINK_FIB_LOOKUP 10 /* not supported */ > +#define NETLINK_CONNECTOR 11 /* not supported */ > +#define NETLINK_NETFILTER 12 /* not supported */ > +#define NETLINK_IP6_FW 13 /* not supported */ > +#define NETLINK_DNRTMSG 14 /* not supported */ > +#define NETLINK_KOBJECT_UEVENT 15 /* not supported */ > +#define NETLINK_GENERIC 16 /* Generic netlink (dynamic families) */ > + > > So, really fun thing here, we also have #define NETLINK_GENERIC 0 in sys/net/if_mib.h. (And that’s exposed to userspace, and used there, so we can’t just change that.) > Wow. Thanks for pointing it out - it wasn’t defined in the kernel headers so I missed it. That looks like something FreeBSD-specific. Both NetBSD / OpenBSD doesn’t have it. It seem to provide: - iteration over the list of the interfaces - some basic interface traffic statistics - copy of the ’struct ifdata’ (basic interface properties and some interface traffic statistics) - Link-specific data (IFDATA_LINKSPECIFIC), not used by anything in base - Original “driver name” (IFDATA_DRIVERNAME) Most of this is already provided by either getifaddr(3) or netlink or even rtsock. I’m thinking of deprecating it in mid-term in favour of Netlink. I see the following options: 1) Remove usage of if_mib.h from ifconfig 2) Add compat layer: *) Rename NETLINK_GENERIC to NET_LINK_GENERIC (which is the right name de-facto) *) Add conditional define for NETLINK_GENERIC to if_mib and set it to 16 *) Define another tree in if_mib.c under net.link <http://net.link/>.generic16 with value 16 Personally I’m more thinking of starting from (1), then slowly replace the remaining bsnmp usages, and then declare it deprecated after 14.0. /Alexander > Which leads to much fun if we decided to do something like including the netlink_generic header in other headers, so we can define messages that contain the genlmsghdr struct. > > I ran into that experimenting with netlink for carp(4). I think I can work around it by adding a separate ip_carp_nl.h header for the netlink stuff, but sooner or later this is going to bite us. > > Kristof >