From nobody Tue Sep 29 11:03:24 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 4hvFf45TDLz6cZcV for ; Tue, 29 Sep 2026 11:03:24 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hvFf44WPBz4tYN for ; Tue, 29 Sep 2026 11:03:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790679804; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JrdQ0/PunBLOQvzyL/wgz/PjPHGZpGKPDWXwkGS73Yg=; b=xSkc7vlrOtif0H3r7dD4i8QGA5Rj5sdGAcECMFWK06gFjrqdsMFEsIfgOoPQYGXc+wD2oC v2j1XTnmqaVS/axHg24jtE9AX8weI3TUEESz28iLYL9QcI2nlF3a24iV3OQJei2wWrTUsI qhI9V7/JuaJf2aUCM9jCCpeQBEyG67/V47k0q2Ja5xTCoY6cNSMA4E19UH2HzeI0fK70nW xydTqUy7dehEMPPX356X3XoSVVMYJNMw4mh3p0M2b7Lim9H57dA1i7WDkvV/FBukvqQorb OG3fduau64oCcbcbV1pbYp5YSqIbngnCpH8Ho63lhXZSYIyxRE0mTPTmVuYeBw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1790679804; b=hOHmJqdPVYHw362yzYBK9U+kC6MDIM2OER3NmTpGUqnit+pEANC3yHMuEyz+AiULdS87Kx ig1EsYFz35CVV3f0RC9a6PzuZKn0FncFe/3sVrMPCJu5Zri7HlfCKTj7wWiuiu68sFtKLV F72XgiaUmwKCbSYbbRaiNfjG59uustKvtfCGjaxmv3pkTl8cSgTv/sCc+tyG5upiQCfKP4 OHtjUH7yiT2PEyGdPLt24pJ85tL9tO1hbb/mW15gitiA7NADFuWOLQEn/tf8Uc3kdtJe3U fG8qJ3zLtFi8qGlw45pRXaGAKJTMVg4OIgbMAkYuD3ksLY79MQQr5FHghkBYBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790679804; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JrdQ0/PunBLOQvzyL/wgz/PjPHGZpGKPDWXwkGS73Yg=; b=Ti8uHKEjeA/sLCaRN9/zQiYR5zGc6041zIaiaxW/zcXpki+beIn9hMaJdTQH5uanxlRUI9 XB3rYvWVATgcpEly3hgrFj/Ne94Vv45YMOznmdmB1RiQkz5C1SKBhrblg+wbMTWE9yXi6L aObOH4RAngIIZqZ18wZNlfhzqVT82FjxLHBpVeb4Z75qzK1Im3ued4Z/jimU8+wMoPwusw S9FBbhYRNDwur2cGDPnP9SZQS2JjQWXTAzDIqxuVsx06ZDJAQ8I0wHVLWHQ80mvQjF96IE UgaRVZ2iVmJ0kLTwfDu8O30ODhfViYkfFD2YhxCR78xTLqgNkVRfGc9M9eO/9g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hvFf43YQfz18m8 for ; Tue, 29 Sep 2026 11:03:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 38d84 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 29 Sep 2026 11:03:24 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: R. Christian McDonald Subject: git: 806adba81f3d - main - libpfctl: decode PFR_A_AF into a u8 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: rcm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 806adba81f3d808994b0cec955c38ef1a089e739 Auto-Submitted: auto-generated Date: Tue, 29 Sep 2026 11:03:24 +0000 Message-Id: <6abb9afc.38d84.55dec9b3@gitrepo.freebsd.org> The branch main has been updated by rcm: URL: https://cgit.FreeBSD.org/src/commit/?id=806adba81f3d808994b0cec955c38ef1a089e739 commit 806adba81f3d808994b0cec955c38ef1a089e739 Author: R. Christian McDonald AuthorDate: 2026-09-29 01:21:56 +0000 Commit: R. Christian McDonald CommitDate: 2026-09-29 11:00:50 +0000 libpfctl: decode PFR_A_AF into a u8 The kernel sends PFR_A_AF as a u32, although it is documented and parsed as a u8, and libpfctl decoded it with snl_attr_get_uint32() straight into the u8 pfra_af. That overwrote pfra_net, pfra_not and pfra_fback, and left pfra_af zero on big-endian hosts. Decode it via a temporary, and accept a u8 as well, so that the kernel can be corrected later without breaking libpfctl. Reviewed by: kp Approved by: kp (mentor) Fixes: f27e44e2e3b5 ("pf: convert DIOCRGETADDRS to netlink") Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D60110 --- lib/libpfctl/libpfctl.c | 18 +++++++++++++++++- sys/netpfil/pf/pf_nl.h | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 26fcb6f50045..6578cff5e45a 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -2777,9 +2777,25 @@ struct nl_addrs { size_t total_count; }; +/* pfra_af is a u8, but the kernel sends PFR_A_AF as a u32. Accept both. */ +static bool +snl_attr_get_pfra_af(struct snl_state *ss, struct nlattr *nla, + const void *arg __unused, void *target) +{ + uint32_t af; + + if (snl_attr_get_uint8(ss, nla, NULL, target)) + return (true); + if (! snl_attr_get_uint32(ss, nla, NULL, &af)) + return (false); + *(uint8_t *)target = af; + + return (true); +} + #define _OUT(_field) offsetof(struct pfr_addr, _field) static const struct snl_attr_parser ap_pfr_addr[] = { - { .type = PFR_A_AF, .off = _OUT(pfra_af), .cb = snl_attr_get_uint32 }, + { .type = PFR_A_AF, .off = _OUT(pfra_af), .cb = snl_attr_get_pfra_af }, { .type = PFR_A_NET, .off = _OUT(pfra_net), .cb = snl_attr_get_uint8 }, { .type = PFR_A_NOT, .off = _OUT(pfra_not), .cb = snl_attr_get_bool }, { .type = PFR_A_ADDR, .off = _OUT(pfra_ip6addr), .cb = snl_attr_get_in6_addr }, diff --git a/sys/netpfil/pf/pf_nl.h b/sys/netpfil/pf/pf_nl.h index 2b6785b6ffca..220ef8ea9cd8 100644 --- a/sys/netpfil/pf/pf_nl.h +++ b/sys/netpfil/pf/pf_nl.h @@ -494,7 +494,7 @@ enum pf_tstats_t { enum pfr_addr_t { PFR_A_UNSPEC, - PFR_A_AF = 1, /* uint8_t */ + PFR_A_AF = 1, /* uint8_t, uint32_t in replies */ PFR_A_NET = 2, /* uint8_t */ PFR_A_NOT = 3, /* bool */ PFR_A_ADDR = 4, /* in6_addr */