From nobody Wed Jun 24 12:16:14 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 4glgs00nYRz6j5WW for ; Wed, 24 Jun 2026 12:16:20 +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 4glgrz5WpVz3lj9 for ; Wed, 24 Jun 2026 12:16:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1782303379; 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=1w75Io5hFqOQ1D3ySkLmkwt5YkVRDbGbmNGP1p4MRxE=; b=o/3sPOTF7aRUd/sAxycJuBVOgEx2BSrcvdDwA4+JNzWAkRtWj8OGLM/nKqi/LoDvf5qxWK Fq6Xz1qCOgMyTztGraAY7HdTnPRLJplSwD/siGa1K7c8MkssvSudB5UdD+HJBXjYXzUyiB 7d9Ec7g5uszkO49WBiH+63VyrAA6fLNBY01VEnlvuyYmjUikyi22GxfbqF60XRlbJlkqc6 0zvwd4fMcRBMAzgqAhkVNnNeA6s+U3F8VJvVUkND+C8/Ltpgxjlzsq308oY+b5w7SSssN3 t+CcVKbznW1Vz1F63/s/PRk7GvLr6uWEi2D12QNpriqsJT1vThGitqCOS4P/Iw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1782303379; a=rsa-sha256; cv=none; b=eHU0nc3rVtGtupcm5EWNI1WK9iThgPrQBPlMKz96PGxJihfBJAyLCQoF7kU71zQ/uZLUEU pylaubINcS8wlDFXErX3dXss6y0GUdYtqg0fG0CrcSQt/Ja9MX4yD5BdK7YNkaxOCqq4I8 pdkoiw/ILHx6QMUlzQE4Jax211EH+hNDpEKzgPLuv8AO6Dhud4uixRDCE3pWUDzxPBUM+p L0fyk5EbLTV6P/YwZqQRm0VuFaiJvt6xzcpyCqH/cA3C/SJx1lF/hTvDAsRrM6ct7bAxtr UJH1lM/8TCo9YIFqFzWcJuvTKMhjtSX59KzSGVSFW3G+gTI2uQEipcbIKt+ifA== 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=1782303379; 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=1w75Io5hFqOQ1D3ySkLmkwt5YkVRDbGbmNGP1p4MRxE=; b=wnBkWxYgNL7FMEdilWLepYceB3aAcQmfem1dgx6nBpj54FUziz2b99Z6VJq3dvVNlu5my4 fJQ5idb/QPZI+203UrydmJnY5uDSf+KRxb7s7WSwg+s1O9jlruAzuAHPY4bXTyH973GuIS X6j5j1e4f7RXtN8JnqohkeFKTKr8QpKVsinDeCE0WUKeX1W7v2/XRWp7yHyk4AScCdEA53 5Dc4VaGArQDnE/rfNTavn+2CxWMRp0/N9SsKARZpXeaNKJVt0c7rOt1TafWsSPIeQGE15o aa3ykDmrGZj/8Gn5XTkcDLUINJF8vvWiz6nIsmUXYuWybkPYoUSxOZMdBG/zNw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4glgrz3dTkz4fW for ; Wed, 24 Jun 2026 12:16:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 34860 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 24 Jun 2026 12:16:14 +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: 4c932a4d45fb - main - netlink: decode netlink message flags symbolically 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: 4c932a4d45fb3130ffa80176f5ff9dcacabd49f1 Auto-Submitted: auto-generated Date: Wed, 24 Jun 2026 12:16:14 +0000 Message-Id: <6a3bca8e.34860.210c19cb@gitrepo.freebsd.org> The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4c932a4d45fb3130ffa80176f5ff9dcacabd49f1 commit 4c932a4d45fb3130ffa80176f5ff9dcacabd49f1 Author: Ishan Agrawal AuthorDate: 2026-06-24 04:08:07 +0000 Commit: Kristof Provost CommitDate: 2026-06-24 12:15:20 +0000 netlink: decode netlink message flags symbolically Generate an nlm_flag table definition for mktable from netlink/netlink.h, add a sysdecode_nlm_flag() helper to libsysdecode, and use it when decoding netlink message headers. This enables mktable to generate netlink message flag lookup tables and replaces raw hexadecimal output for recognized NLM_F_* flag values with their symbolic names. Reviewed by: kp Signed-off-by: Ishan Agrawal Sponsored by: Google LLC (GSoC 2026) Pull Request: https://github.com/freebsd/freebsd-src/pull/2294 --- lib/libsysdecode/flags.c | 8 ++++++++ lib/libsysdecode/mktables | 1 + lib/libsysdecode/netlink.c | 7 +++++-- lib/libsysdecode/sysdecode.h | 3 ++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/libsysdecode/flags.c b/lib/libsysdecode/flags.c index 8009a7a2f97e..983314e56369 100644 --- a/lib/libsysdecode/flags.c +++ b/lib/libsysdecode/flags.c @@ -70,6 +70,7 @@ #include #include #include +#include #include "support.h" @@ -1215,3 +1216,10 @@ sysdecode_pfnl_cmd(int cmd) return (lookup_value(pfnl_cmd, cmd)); } + +const char * +sysdecode_nlm_flag(int flag) +{ + + return (lookup_value(nlm_flag, flag)); +} diff --git a/lib/libsysdecode/mktables b/lib/libsysdecode/mktables index 2bfbaf529f44..df794b74c168 100644 --- a/lib/libsysdecode/mktables +++ b/lib/libsysdecode/mktables @@ -171,6 +171,7 @@ fi gen_table "shmflags" "SHM_[A-Z_]+[[:space:]]+0x[0-9]+" "sys/mman.h" "SHM_ANON" gen_table "itimerwhich" "ITIMER_[A-Z]+[[:space:]]+[0-9]+" "sys/time.h" gen_table "pfnl_cmd" "PFNL_CMD_[A-Z_]+[[:space:]]+[0-9]+" "netpfil/pf/pf_nl.h" +gen_table "nlm_flag" "NLM_F_[A-Z]+[[:space:]]+0x[0-9]+" "netlink/netlink.h" # Generate a .depend file for our output file if [ -n "$output_file" ]; then diff --git a/lib/libsysdecode/netlink.c b/lib/libsysdecode/netlink.c index a28a0a061134..2143a0d391a5 100644 --- a/lib/libsysdecode/netlink.c +++ b/lib/libsysdecode/netlink.c @@ -73,8 +73,11 @@ sysdecode_netlink(FILE *fp, const void *buf, size_t len) } fprintf(fp, ",flags="); - /* TODO: decode flags symbolically using sysdecode_mask. */ - fprintf(fp, "0x%x", nl->nlmsg_flags); + const char *nlm_f = sysdecode_nlm_flag(nl->nlmsg_flags); + if (nlm_f != NULL) + fprintf(fp, "%s", nlm_f); + else + fprintf(fp, "0x%x", nl->nlmsg_flags); fprintf(fp, ",seq=%u,pid=%u", nl->nlmsg_seq, nl->nlmsg_pid); diff --git a/lib/libsysdecode/sysdecode.h b/lib/libsysdecode/sysdecode.h index 4675b1e3c463..3675a582a9b8 100644 --- a/lib/libsysdecode/sysdecode.h +++ b/lib/libsysdecode/sysdecode.h @@ -66,7 +66,8 @@ const char *sysdecode_ipproto(int _protocol); void sysdecode_kevent_fflags(FILE *_fp, short _filter, int _fflags, int _base); const char *sysdecode_itimer(int _which); -const char *sysdecode_pfnl_cmd(int cmd); +const char *sysdecode_pfnl_cmd(int _cmd); +const char *sysdecode_nlm_flag(int _flag); const char *sysdecode_kevent_filter(int _filter); bool sysdecode_kevent_flags(FILE *_fp, int _flags, int *_rem); const char *sysdecode_kldsym_cmd(int _cmd);