From nobody Fri Feb 18 10:46:05 2022 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 62EE519CD82C; Fri, 18 Feb 2022 10:46:06 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4K0SzL0tdWz4Tf0; Fri, 18 Feb 2022 10:46:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645181166; 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=gq1zQA5NxgE5LPohQ4dW8RkAvZC2mXyqwQC3COhpVTc=; b=O0wUDgV2jRn+dGi5DDQalxVRlmuhtowVN0vToJqw/+TNmj4afv6bwiPDtllB2dcG6YaYKL DHliSG0uh2kiwwBHHH5mtQP3tA4p724x/5XH1jh/bo8RqhIGcDJU3TmosA4S9yn29dWznm j71nqSqn9ld/3hfD+avZ00pQDu0D3k+3Pax8rKte82ExU/xuSDzCgDrQYkFUtdOG9v0siD QfaObLUcAeZe0egtEpCiKkBDvy5YryfHtjnrR50kB0fdwQGSgUeGKNqGXkMkaPePQXbYAa itRf7sInfo78Syyo7sY5jewxiWmk+FUtGEWh1a2JTQwC9aub6btE4HhPrmy34g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D46711BFD1; Fri, 18 Feb 2022 10:46:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 21IAk5qw043328; Fri, 18 Feb 2022 10:46:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21IAk55c043327; Fri, 18 Feb 2022 10:46:05 GMT (envelope-from git) Date: Fri, 18 Feb 2022 10:46:05 GMT Message-Id: <202202181046.21IAk55c043327@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 2f19661ace75 - stable/12 - libpfctl: fix creatorid endianness 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 2f19661ace75a35a69cf09fa89a7bbfac6a4d098 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645181166; 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=gq1zQA5NxgE5LPohQ4dW8RkAvZC2mXyqwQC3COhpVTc=; b=FMS+LEud5IRCsKbCI6i6BWZHtvRyGmzjdt48rsGNs+6rONAiR+/+oi0n/Gcaqrb0RUipb3 L7gZ5V9NkK3MsOMoYlgHUacDcehBo9D0Jm4o69fuBaGjMKgYD5mesEoQsWLUFeM+NjeHMR VootK4eJ8mab5ZPHIpgAsX1GWfNySt7LtzR9FYMu158+FakAXYhVFoHTB1pYMDU5FMxzvu EGBkEVglfyOKJuVz9uzj5QkFfcEBya552C4ct1/DqTleKie5v4YYNxB1Q4gyJlQAsD+Tdf LKxJ99IjzhJO3Nzm5IytG8Y3duN8ulqPFsQEyWts1PCzf0VlTy49QjXD0l1Sew== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645181166; a=rsa-sha256; cv=none; b=sB/4XNlaAiSVkt8JUeJcp5bs9xJLfzjK8JWknvdtRK0vTwY6HrXfINnY/4ZEJb5VLCmurK jH9HW2a0YG2ELwKjkVIWE7Z9fUyJZonDS/7NXVJWv2NC8iRT6tSg8eWayAlYLTphpE41l9 1eU4h7/j5Cc0WcdHeKiW21uCdsJ0vL3mQY/GpRCMV0HcF1jW6WwGKfIo6ZrHjqdR5k5e4/ adSnDOtDVhpjfta8v8qi6CQgd0TlWUbNXOCccyWE3YDrXvba61TjEaHt5pWpl+gZhVQFHI bQdTv1TRcUdFhfaGoRzfflixwsSOhBhcHHu553pWrbfG2r+oBnvMofb0g3Eapg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2f19661ace75a35a69cf09fa89a7bbfac6a4d098 commit 2f19661ace75a35a69cf09fa89a7bbfac6a4d098 Author: Kristof Provost AuthorDate: 2022-01-21 16:50:15 +0000 Commit: Kristof Provost CommitDate: 2022-02-18 10:15:31 +0000 libpfctl: fix creatorid endianness We provide the hostid (which is the state creatorid) to the kernel as a big endian number (see pfctl/pfctl.c pfctl_set_hostid()), so convert it back to system endianness when we get it from the kernel. This avoids a confusing mismatch between the value the user configures and the value displayed in the state. MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D33989 (cherry picked from commit 735748f30aad80593e2b7f5f5f175d64484c5eeb) --- lib/libpfctl/libpfctl.c | 4 ++-- sbin/pfctl/pfctl_parser.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 9252f64969bb..e77bdee93deb 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -188,7 +188,7 @@ pfctl_get_status(int dev) status->running = nvlist_get_bool(nvl, "running"); status->since = nvlist_get_number(nvl, "since"); status->debug = nvlist_get_number(nvl, "debug"); - status->hostid = nvlist_get_number(nvl, "hostid"); + status->hostid = ntohl(nvlist_get_number(nvl, "hostid")); status->states = nvlist_get_number(nvl, "states"); status->src_nodes = nvlist_get_number(nvl, "src_nodes"); @@ -809,7 +809,7 @@ pf_state_export_to_state(struct pfctl_state *ps, const struct pf_state_export *s ps->packets[1] = s->packets[1]; ps->bytes[0] = s->bytes[0]; ps->bytes[1] = s->bytes[1]; - ps->creatorid = s->creatorid; + ps->creatorid = ntohl(s->creatorid); ps->key[0].proto = s->proto; ps->key[1].proto = s->proto; ps->key[0].af = s->af; diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index adf9255f0c84..3242404954bc 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -541,7 +541,7 @@ print_status(struct pfctl_status *s, struct pfctl_syncookies *cookies, int opts) } if (opts & PF_OPT_VERBOSE) { - printf("Hostid: 0x%08x\n", ntohl(s->hostid)); + printf("Hostid: 0x%08x\n", s->hostid); for (i = 0; i < PF_MD5_DIGEST_LENGTH; i++) { buf[i + i] = hex[s->pf_chksum[i] >> 4];