Date: Mon, 27 Mar 2023 17:11:25 +0100 From: Alexander Chernikov <melifaro@freebsd.org> To: Shawn Webb <shawn.webb@hardenedbsd.org> Cc: "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org> Subject: Re: git: 19e43c163c64 - main - netlink: add netlink KPI to the kernel by default Message-ID: <4C61BC36-8977-48A6-9A51-EB6D415DB4CB@freebsd.org> In-Reply-To: <20230327153934.6lghvi7cnqodhig3@mutt-hbsd> References: <202303271355.32RDtqJ9006858@gitrepo.freebsd.org> <20230327153934.6lghvi7cnqodhig3@mutt-hbsd>
next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail=_6EA743A0-4A9D-41C1-9DDD-C211E8A11347 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On 27 Mar 2023, at 16:39, Shawn Webb <shawn.webb@hardenedbsd.org> = wrote: >=20 > On Mon, Mar 27, 2023 at 01:55:52PM +0000, Alexander V. Chernikov = wrote: >> The branch main has been updated by melifaro: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D19e43c163c64636d2590dca006e22f18= d22f48b2 >>=20 >> 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 >>=20 >> netlink: add netlink KPI to the kernel by default >>=20 >> This change does the following: >>=20 >> 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. >>=20 >> 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. >>=20 >> 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(-) >>=20 >> 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 >=20 > It appears netlink/netlink_glue.c was missed from this commit: Sorry for the breakage, should be fixed in d3a49f62a284. >=20 > cc: error: no such file or directory: = '/usr/src/sys/netlink/netlink_glue.c' > cc: error: no input files >=20 > Thanks, >=20 > --=20 > Shawn Webb > Cofounder / Security Engineer > HardenedBSD >=20 > = https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03= A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --Apple-Mail=_6EA743A0-4A9D-41C1-9DDD-C211E8A11347 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii <html><head><meta http-equiv=3D"content-type" content=3D"text/html; = charset=3Dus-ascii"></head><body style=3D"overflow-wrap: break-word; = -webkit-nbsp-mode: space; line-break: after-white-space;"><meta = http-equiv=3D"content-type" content=3D"text/html; charset=3Dus-ascii"><div= style=3D"overflow-wrap: break-word; -webkit-nbsp-mode: space; = line-break: after-white-space;"><br><div><br><blockquote = type=3D"cite"><div>On 27 Mar 2023, at 16:39, Shawn Webb = <shawn.webb@hardenedbsd.org> wrote:</div><br = class=3D"Apple-interchange-newline"><div><meta charset=3D"UTF-8"><span = style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: = 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; = letter-spacing: normal; text-align: start; text-indent: 0px; = text-transform: none; white-space: normal; word-spacing: 0px; = -webkit-text-stroke-width: 0px; text-decoration: none; float: none; = display: inline !important;">On Mon, Mar 27, 2023 at 01:55:52PM +0000, = Alexander V. Chernikov wrote:</span><br style=3D"caret-color: rgb(0, 0, = 0); font-family: Helvetica; font-size: 12px; font-style: normal; = font-variant-caps: normal; font-weight: 400; letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none;"><blockquote type=3D"cite" style=3D"font-family: = Helvetica; font-size: 12px; font-style: normal; font-variant-caps: = normal; font-weight: 400; letter-spacing: normal; orphans: auto; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; = -webkit-text-stroke-width: 0px; text-decoration: none;">The branch main = has been updated by melifaro:<br><br>URL: = https://cgit.FreeBSD.org/src/commit/?id=3D19e43c163c64636d2590dca006e22f18= d22f48b2<br><br>commit = 19e43c163c64636d2590dca006e22f18d22f48b2<br>Author: = Alexander V. Chernikov = <melifaro@FreeBSD.org><br>AuthorDate: 2023-03-27 11:59:30 = +0000<br>Commit: Alexander V. Chernikov = <melifaro@FreeBSD.org><br>CommitDate: 2023-03-27 13:55:44 = +0000<br><br> netlink: add netlink KPI to the kernel by = default<br><br> This change does the = following:<br><br> Base Netlink KPIs (ability to = register the family, parse and/or<br> write a = Netlink message) are always present in the kernel. = Specifically,<br> * Implementation of genetlink = family/group registration/removal,<br> some = base accessors (netlink_generic_kpi.c, 260 LoC) are compiled = in<br> unconditionally.<br> = * Basic TLV parser functions (netlink_message_parser.c, 507 LoC) = are<br> compiled in = unconditionally.<br> * Glue functions = (netlink<>rtsock), malloc/core sysctl = definitions<br> (netlink_glue.c, 259 LoC) are = compiled in unconditionally.<br> * The rest of the KPI = _functions_ are defined in the = netlink_glue.c,<br> but their implementation = calls a pointer to either the stub = function<br> or the actual function, depending on = whether the module is loaded or not.<br><br> This = approach allows to have only 1k LoC out of ~3.7k LoC = (current<br> sys/netlink implementation) in the = kernel, which will not grow further.<br> It also allows = for the generic netlink kernel customers to = load<br> successfully without requiring Netlink = module and operate correctly<br> once Netlink = module is loaded.<br><br> Reviewed by: = imp<br> MFC after: = 2 weeks<br> Differential = Revision: = https://reviews.freebsd.org/D39269<br>---<br>sys/conf/files = &n= bsp; | = 4 +-<br>sys/conf/options = &n= bsp; | 2 = +-<br>sys/modules/carp/Makefile = | = 2 +-<br>sys/modules/netlink/Makefile = | 6 = +-<br>sys/net/route.c = &n= bsp; | 19 = ---<br>sys/netinet/ip_carp.c = &n= bsp; | 2 +<br>sys/netlink/netlink_ctl.h = | = 10 +-<br>sys/netlink/netlink_domain.c = | 24 = ---<br>sys/netlink/netlink_generic.c = | 282 = +++--------------------------------<br>sys/netlink/netlink_generic_kpi.c = | 279 = ++++++++++++++++++++++++++++++++++<br>sys/netlink/netlink_io.c = | = 2 +<br>sys/netlink/netlink_message_writer.c | 22 = +--<br>sys/netlink/netlink_message_writer.h | 86 = +++++++++++<br>sys/netlink/netlink_module.c = | 26 = +++-<br>sys/netlink/netlink_var.h = | = 44 ++++++<br>sys/netlink/route/iface.c = | = 2 +<br>sys/netlink/route/neigh.c = | = 2 +<br>sys/netlink/route/nexthop.c = | 2 = +<br>sys/netlink/route/rt.c = &n= bsp; | 2 +<br>19 files changed, 497 insertions(+), 321 = deletions(-)<br><br>diff --git a/sys/conf/files = b/sys/conf/files<br>index 629283f7c071..94cd7135b277 100644<br>--- = a/sys/conf/files<br>+++ b/sys/conf/files<br>@@ -4424,10 +4424,12 @@ = netipsec/xform_ipcomp.c<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>optional ipsec inet | ipsec = inet6<br>netipsec/xform_tcp.c<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>optional ipsec inet tcp_signature = | \<br><span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span><span class=3D"Apple-converted-space"> </span>ipsec inet6 = tcp_signature | ipsec_support inet tcp_signature | \<br><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span><span = class=3D"Apple-converted-space"> </span>ipsec_support inet6 = tcp_signature<br>+netlink/netlink_generic_kpi.c<span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>standard<br>+netlink/netlink_glue.c<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>standard<br></blockquote><br = style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: = 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; = letter-spacing: normal; text-align: start; text-indent: 0px; = text-transform: none; white-space: normal; word-spacing: 0px; = -webkit-text-stroke-width: 0px; text-decoration: none;"><span = style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: = 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; = letter-spacing: normal; text-align: start; text-indent: 0px; = text-transform: none; white-space: normal; word-spacing: 0px; = -webkit-text-stroke-width: 0px; text-decoration: none; float: none; = display: inline !important;">It appears netlink/netlink_glue.c was = missed from this commit:</span><br style=3D"caret-color: rgb(0, 0, 0); = font-family: Helvetica; font-size: 12px; font-style: normal; = font-variant-caps: normal; font-weight: 400; letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none;"></div></blockquote>Sorry for the breakage, = should be fixed in d3a49f62a284.<br><blockquote = type=3D"cite"><div><br style=3D"caret-color: rgb(0, 0, 0); font-family: = Helvetica; font-size: 12px; font-style: normal; font-variant-caps: = normal; font-weight: 400; letter-spacing: normal; text-align: start; = text-indent: 0px; text-transform: none; white-space: normal; = word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: = none;"><span style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; = font-size: 12px; font-style: normal; font-variant-caps: normal; = font-weight: 400; letter-spacing: normal; text-align: start; = text-indent: 0px; text-transform: none; white-space: normal; = word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: = none; float: none; display: inline !important;">cc: error: no such file = or directory: '/usr/src/sys/netlink/netlink_glue.c'</span><br = style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: = 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; = letter-spacing: normal; text-align: start; text-indent: 0px; = text-transform: none; white-space: normal; word-spacing: 0px; = -webkit-text-stroke-width: 0px; text-decoration: none;"><span = style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: = 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; = letter-spacing: normal; text-align: start; text-indent: 0px; = text-transform: none; white-space: normal; word-spacing: 0px; = -webkit-text-stroke-width: 0px; text-decoration: none; float: none; = display: inline !important;">cc: error: no input files</span><br = style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: = 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; = letter-spacing: normal; text-align: start; text-indent: 0px; = text-transform: none; white-space: normal; word-spacing: 0px; = -webkit-text-stroke-width: 0px; text-decoration: none;"><br = style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: = 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; = letter-spacing: normal; text-align: start; text-indent: 0px; = text-transform: none; white-space: normal; word-spacing: 0px; = -webkit-text-stroke-width: 0px; text-decoration: none;"><span = style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: = 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; = letter-spacing: normal; text-align: start; text-indent: 0px; = text-transform: none; white-space: normal; word-spacing: 0px; = -webkit-text-stroke-width: 0px; text-decoration: none; float: none; = display: inline !important;">Thanks,</span><br style=3D"caret-color: = rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: = normal; font-variant-caps: normal; font-weight: 400; letter-spacing: = normal; text-align: start; text-indent: 0px; text-transform: none; = white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none;"><br style=3D"caret-color: rgb(0, 0, 0); = font-family: Helvetica; font-size: 12px; font-style: normal; = font-variant-caps: normal; font-weight: 400; letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none;"><span style=3D"caret-color: rgb(0, 0, 0); = font-family: Helvetica; font-size: 12px; font-style: normal; = font-variant-caps: normal; font-weight: 400; letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none; float: none; display: inline !important;">--<span = class=3D"Apple-converted-space"> </span></span><br = style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: = 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; = letter-spacing: normal; text-align: start; text-indent: 0px; = text-transform: none; white-space: normal; word-spacing: 0px; = -webkit-text-stroke-width: 0px; text-decoration: none;"><span = style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: = 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; = letter-spacing: normal; text-align: start; text-indent: 0px; = text-transform: none; white-space: normal; word-spacing: 0px; = -webkit-text-stroke-width: 0px; text-decoration: none; float: none; = display: inline !important;">Shawn Webb</span><br style=3D"caret-color: = rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: = normal; font-variant-caps: normal; font-weight: 400; letter-spacing: = normal; text-align: start; text-indent: 0px; text-transform: none; = white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none;"><span style=3D"caret-color: rgb(0, 0, 0); = font-family: Helvetica; font-size: 12px; font-style: normal; = font-variant-caps: normal; font-weight: 400; letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none; float: none; display: inline = !important;">Cofounder / Security Engineer</span><br style=3D"caret-color:= rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: = normal; font-variant-caps: normal; font-weight: 400; letter-spacing: = normal; text-align: start; text-indent: 0px; text-transform: none; = white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none;"><span style=3D"caret-color: rgb(0, 0, 0); = font-family: Helvetica; font-size: 12px; font-style: normal; = font-variant-caps: normal; font-weight: 400; letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none; float: none; display: inline = !important;">HardenedBSD</span><br style=3D"caret-color: rgb(0, 0, 0); = font-family: Helvetica; font-size: 12px; font-style: normal; = font-variant-caps: normal; font-weight: 400; letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none;"><br style=3D"caret-color: rgb(0, 0, 0); = font-family: Helvetica; font-size: 12px; font-style: normal; = font-variant-caps: normal; font-weight: 400; letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none;"><a = href=3D"https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn= _Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc" = style=3D"font-family: Helvetica; font-size: 12px; font-style: normal; = font-variant-caps: normal; font-weight: 400; letter-spacing: normal; = orphans: auto; text-align: start; text-indent: 0px; text-transform: = none; white-space: normal; widows: auto; word-spacing: 0px; = -webkit-text-size-adjust: auto; -webkit-text-stroke-width: = 0px;">https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_W= ebb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc</a></div></blockquote= ></div><br></div></body></html>= --Apple-Mail=_6EA743A0-4A9D-41C1-9DDD-C211E8A11347--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C61BC36-8977-48A6-9A51-EB6D415DB4CB>