Re: git: 19e43c163c64 - main - netlink: add netlink KPI to the kernel by default

From: Shawn Webb <shawn.webb_at_hardenedbsd.org>
Date: Mon, 27 Mar 2023 15:39:34 UTC
On Mon, Mar 27, 2023 at 01:55:52PM +0000, Alexander V. Chernikov wrote:
> The branch main has been updated by melifaro:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=19e43c163c64636d2590dca006e22f18d22f48b2
> 
> commit 19e43c163c64636d2590dca006e22f18d22f48b2
> Author:     Alexander V. Chernikov <melifaro@FreeBSD.org>
> AuthorDate: 2023-03-27 11:59:30 +0000
> Commit:     Alexander V. Chernikov <melifaro@FreeBSD.org>
> CommitDate: 2023-03-27 13:55:44 +0000
> 
>     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
> ---
>  sys/conf/files                       |   4 +-
>  sys/conf/options                     |   2 +-
>  sys/modules/carp/Makefile            |   2 +-
>  sys/modules/netlink/Makefile         |   6 +-
>  sys/net/route.c                      |  19 ---
>  sys/netinet/ip_carp.c                |   2 +
>  sys/netlink/netlink_ctl.h            |  10 +-
>  sys/netlink/netlink_domain.c         |  24 ---
>  sys/netlink/netlink_generic.c        | 282 +++--------------------------------
>  sys/netlink/netlink_generic_kpi.c    | 279 ++++++++++++++++++++++++++++++++++
>  sys/netlink/netlink_io.c             |   2 +
>  sys/netlink/netlink_message_writer.c |  22 +--
>  sys/netlink/netlink_message_writer.h |  86 +++++++++++
>  sys/netlink/netlink_module.c         |  26 +++-
>  sys/netlink/netlink_var.h            |  44 ++++++
>  sys/netlink/route/iface.c            |   2 +
>  sys/netlink/route/neigh.c            |   2 +
>  sys/netlink/route/nexthop.c          |   2 +
>  sys/netlink/route/rt.c               |   2 +
>  19 files changed, 497 insertions(+), 321 deletions(-)
> 
> diff --git a/sys/conf/files b/sys/conf/files
> index 629283f7c071..94cd7135b277 100644
> --- a/sys/conf/files
> +++ b/sys/conf/files
> @@ -4424,10 +4424,12 @@ netipsec/xform_ipcomp.c		optional ipsec inet | ipsec inet6
>  netipsec/xform_tcp.c		optional ipsec inet tcp_signature | \
>  	 ipsec inet6 tcp_signature | ipsec_support inet tcp_signature | \
>  	 ipsec_support inet6 tcp_signature
> +netlink/netlink_generic_kpi.c	standard
> +netlink/netlink_glue.c		standard

It appears netlink/netlink_glue.c was missed from this commit:

cc: error: no such file or directory: '/usr/src/sys/netlink/netlink_glue.c'
cc: error: no input files

Thanks,

-- 
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc