From nobody Sun Jul 5 14:15:55 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gtTzw0KXTz6kLVy for ; Sun, 05 Jul 2026 14:15:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gtTzv5QzZz3CNQ for ; Sun, 05 Jul 2026 14:15:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783260955; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=n5gAV+21GbZnMrRf1wjQzPpyWRHizq0pWm50m7IiqUI=; b=tmSsXQmfJLlMvivinZegd5hwJx5KowtI7+8W8ItBQLoBOG+WItZ6y4bLW3LJDnxf3PmYee YFN0ZZhzM9qBowGVWAjNXLvn+9XNG+rwq7YYGMUAIBM6aYrIYAmVw9EU4hGQqZIc7aFJMo ZWrU7Q/I07XMbshbuo+kPIqRx8cQ0fWub/UX5o2Ss3U3O2QTUYD3vcAfxGCt9YzJIT8Xn0 sk0S39qrzUxWVmbfCvpFXIJVxbFYP6ZYRedINQEm2AatOIJofIvt8j3p5+lv4Lz8KFLbLj tCdHatrG1CrQG+j8ZlNQUTI9aulLQ3RRNLfd/UOD27etM33BYWHfiXSFBSj+CA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783260955; a=rsa-sha256; cv=none; b=it43bMUyLNJ79DBz1WletE8/naFsna10mJ0T7qOYFNjr7n2V+WXPWDfU4l+pLiQz5dSTuX hG4cR/R+KTXTSp3suy4dHxeT7HjTQ0zlxJGL7MPrlg/0PMNb7dk+mTcSV2cDRaVSARhYoL 3oacHlnuf8eNh/bz7jeI73UJ6PHd6z7WP2N3L9p9EJIhVFb840Jg1kyabFMhPhU++fPYYM GlM4cgIYvMYFWUeonGcnVuSuLrZGON4cQCeLI4jDU14dBEh465BTjRXsFRjwJI5eYedxpS Bt0CnQOtharidbpjpII7uJPOFzPODonUze8blFYCnr6bVgHUmVmAqRyQF17lSg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783260955; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=n5gAV+21GbZnMrRf1wjQzPpyWRHizq0pWm50m7IiqUI=; b=eYKEIJ03Q09CX1/v251+cuPPLL+jZUN4UZfeOegKdxqiJ1OTed7YD0R7YsK2x54HJPdRas lJGcDm3rieZN0jkUH9Trab87f6PJonpMaFkq4zvT30J+dj+jpzm1W3zWgEXxUqpddqbmgE HV1a8T+wtYaGhFgS3STQbHJkjVbO5Dd01RkLsByhVEwFKbrF9hhAe5nHA3OVMJ9xbY/2Zx nq36zvygmxeq4EmXawUwwDnkTvHpUwT3PD1128svRC0xd7b76YjyMet62ZXz1Y5Wz1I+zb quQqtLVc8mYb+W4Kv7v7/UWkxd78bPp+3nSXKfIrNHLv2bp2TTcD/awWO0guVA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gtTzv3wcSz67Q for ; Sun, 05 Jul 2026 14:15:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3c4f2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 05 Jul 2026 14:15:55 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Ishan Agrawal From: Kristof Provost Subject: git: c268c80fc3d5 - main - libsysdecode: cache Generic Netlink family IDs List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c268c80fc3d5eaeec2d01205b338dbaa7661502a Auto-Submitted: auto-generated Date: Sun, 05 Jul 2026 14:15:55 +0000 Message-Id: <6a4a671b.3c4f2.ab40292@gitrepo.freebsd.org> The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c268c80fc3d5eaeec2d01205b338dbaa7661502a commit c268c80fc3d5eaeec2d01205b338dbaa7661502a Author: Ishan Agrawal AuthorDate: 2026-06-29 06:00:40 +0000 Commit: Kristof Provost CommitDate: 2026-07-05 14:03:52 +0000 libsysdecode: cache Generic Netlink family IDs Record Generic Netlink family IDs learned from CTRL_CMD_GETFAMILY responses and use them to decode subsequent Generic Netlink messages using symbolic family names instead of numeric IDs. Signed-off-by: Ishan Agrawal Reviewed by: kp Sponsored-by: Google LLC (GSoC 2026) --- lib/libsysdecode/netlink.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/lib/libsysdecode/netlink.c b/lib/libsysdecode/netlink.c index 4dbe6c087dcf..a9c226e6065d 100644 --- a/lib/libsysdecode/netlink.c +++ b/lib/libsysdecode/netlink.c @@ -12,8 +12,11 @@ #include #include #include +#include +#include #include "sysdecode.h" +#include "support.h" /* * Decodes a buffer as a Netlink message stream. @@ -23,6 +26,9 @@ * to fallback to a standard hex/string dump. */ +static struct name_table *family_table = NULL; +static size_t num_family = 0; + bool sysdecode_netlink(FILE *fp, const void *buf, size_t len, int protocol) { @@ -41,6 +47,12 @@ sysdecode_netlink(FILE *fp, const void *buf, size_t len, int protocol) if (nl->nlmsg_len < sizeof(struct nlmsghdr) || nl->nlmsg_len > remaining) return (false); + if (family_table == NULL) { + family_table = malloc((num_family + 1) * + sizeof(struct name_table)); + family_table[num_family] = (struct name_table){0, NULL}; + } + fprintf(fp, "netlink{"); while (remaining >= sizeof(struct nlmsghdr)) { @@ -124,6 +136,22 @@ sysdecode_netlink(FILE *fp, const void *buf, size_t len, int protocol) } } + if (family_name && family_id && + !lookup_value(family_table, family_id)) { + num_family++; + + family_table = realloc(family_table, + (num_family + 1) * + sizeof(struct name_table)); + family_table[num_family - 1].val = + family_id; + family_table[num_family - 1].str = + strdup(family_name); + + family_table[num_family] = + (struct name_table){0, NULL}; + } + fprintf(fp, "}"); break; default: @@ -131,6 +159,10 @@ sysdecode_netlink(FILE *fp, const void *buf, size_t len, int protocol) break; } + const char *family = lookup_value(family_table, nl->nlmsg_type); + if (family != NULL && strcmp(family, "pfctl") == 0) + fprintf(fp, ",pf={}"); + /* Handle Alignment (Netlink messages are 4-byte aligned). */ size_t aligned_len = NLMSG_ALIGN(nl->nlmsg_len); if (aligned_len > remaining)