From nobody Wed Jul 2 08:27:15 2025 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 4bXCgR3sS2z604k4; Wed, 02 Jul 2025 08:27:15 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bXCgR1Zcdz3ZLN; Wed, 02 Jul 2025 08:27:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751444835; 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=VAeBmX1BNijua9rxEtLRPMJIcG4OybqaxiTRrAIyCa8=; b=cjjig199gN3DoNwexS2RMf6bfSZr6am9OVavi9B9f6BVF8xfkjzuyGBNVVZ6yEB22BGfXp UZ5zvWB7VNSDbY+19a1rIYuwdGrtw/ywmG0fgYRew8RVX15eEBlE3cm6rvEzkbgUnnuAvb ickwQyY7iQAj1qjcL7OI1d1/GY4x8d3F8VmEfXn2akPI2X4Fi/MLnlT9uWq3Z8NaqMTRve oNA1kQzNU2qc1WpnPvEEChAIg4IvN2i0qW4YqKxzDNc/O1U1i8D+ebPfud2ZFBLWrNqOLn T6NegUWhIbkGToshbB9sN9uSVQd/d3/MmYcdkDhgZCTFC6wa58onMV19AeYXgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751444835; 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=VAeBmX1BNijua9rxEtLRPMJIcG4OybqaxiTRrAIyCa8=; b=vzvu1/SghrRHBXphImuvQDqazwQj08Ay2vy4xJ4wlN5rPikGKU6H/NaNHXbGtbgG3ynXXC meVUe9iqlpCKiffX8HjK+0ScKQ9mw3Gts+QAa+BFQlXVGYWcul3hD0sRSH5caXfQXYlEP8 vJOi1uSo8Ky1gDwm1hyTHO9TCVc4wz5RhUoUNPvQS9izAdX2AAjUoexfRDNN/VxgbEh22s ztP+BjwqsBUQ6OQrHjvmHkIuTbPAVKAicsKjXxjtmSqDZmWx5t9niUYlqtIXgbK4VJPXiN 5XCA4l3nh65a3fSChav9k8FsJ+lsz05GRJk6LqN7wOjVrkPiQqq4dLbvRiF7/w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751444835; a=rsa-sha256; cv=none; b=eNsMGFuYOSn93lqMIxVYFdfBwtZqnCT1rUFVXRsgmfIS0gUemrC8V/9e8XoNBQZOFjM6dy 9xkuG1P2pG82FlTLIDsShh+0mC2BxQgh/dxR2zNdUwv0Ke/Tqely4vPDXZcfLS0XCFwdhK gHGvbnIWWjFfkrJRY1/qRxHwI7R4QjnTajAvqYQp+4h97j2mpSE5o24eOCwbmtfQ7NV1JH /hX3Q5jx+xCziZ62rGQYQhP7SSHLeLrCKWfSTJ+ftcPrjjXQ0goexe3ey3lj6ZFaN2Qnjr 5e5ylkkH5oUI1px42opbcEe6IZkbXT41eBcmIiic3fpRyoFiM8R+VS9+R6Jv5g== 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 4bXCgR19lxz1B4n; Wed, 02 Jul 2025 08:27:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5628RFv8025616; Wed, 2 Jul 2025 08:27:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5628RFO9025614; Wed, 2 Jul 2025 08:27:15 GMT (envelope-from git) Date: Wed, 2 Jul 2025 08:27:15 GMT Message-Id: <202507020827.5628RFO9025614@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: dd2d7ba6f338 - main - pfctl: Fix function name in error messages by using __func__ 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 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: dd2d7ba6f338925af00883220a03d86c4e9d0307 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=dd2d7ba6f338925af00883220a03d86c4e9d0307 commit dd2d7ba6f338925af00883220a03d86c4e9d0307 Author: Kristof Provost AuthorDate: 2025-06-27 12:43:54 +0000 Commit: Kristof Provost CommitDate: 2025-07-02 07:40:53 +0000 pfctl: Fix function name in error messages by using __func__ Obtained from: OpenBSD, kn , 91a155f4b6 Obtained from: OpenBSD, kn , f79f34e142 Sponsored by: Rubicon Communications, LLC ("Netgate") --- sbin/pfctl/pfctl.c | 22 +++++++++++----------- sbin/pfctl/pfctl_parser.c | 6 +++--- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 8b76b0c3fdfd..926c18ee5dbc 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -2252,8 +2252,8 @@ int pfctl_rules(int dev, char *filename, int opts, int optimize, char *anchorname, struct pfr_buffer *trans) { -#define ERR(x) do { warn(x); goto _error; } while(0) -#define ERRX(x) do { warnx(x); goto _error; } while(0) +#define ERR(...) do { warn(__VA_ARGS__); goto _error; } while(0) +#define ERRX(...) do { warnx(__VA_ARGS__); goto _error; } while(0) struct pfr_buffer *t, buf; struct pfioc_altq pa; @@ -2288,10 +2288,10 @@ pfctl_rules(int dev, char *filename, int opts, int optimize, memset(&pf, 0, sizeof(pf)); memset(&trs, 0, sizeof(trs)); if ((path = calloc(1, MAXPATHLEN)) == NULL) - ERRX("pfctl_rules: calloc"); + ERRX("%s: calloc", __func__); if (strlcpy(trs.pfrt_anchor, anchorname, sizeof(trs.pfrt_anchor)) >= sizeof(trs.pfrt_anchor)) - ERRX("pfctl_rules: strlcpy"); + ERRX("%s: strlcpy", __func__); pf.dev = dev; pf.h = pfh; pf.opts = opts; @@ -2300,16 +2300,16 @@ pfctl_rules(int dev, char *filename, int opts, int optimize, /* non-brace anchor, create without resolving the path */ if ((pf.anchor = calloc(1, sizeof(*pf.anchor))) == NULL) - ERRX("pfctl_rules: calloc"); + ERRX("%s: calloc", __func__); rs = &pf.anchor->ruleset; pf_init_ruleset(rs); rs->anchor = pf.anchor; if (strlcpy(pf.anchor->path, anchorname, sizeof(pf.anchor->path)) >= sizeof(pf.anchor->path)) - errx(1, "pfctl_rules: strlcpy"); + errx(1, "%s: strlcpy", __func__); if (strlcpy(pf.anchor->name, anchorname, sizeof(pf.anchor->name)) >= sizeof(pf.anchor->name)) - errx(1, "pfctl_rules: strlcpy"); + errx(1, "%s: strlcpy", __func__); pf.astack[0] = pf.anchor; @@ -2322,14 +2322,14 @@ pfctl_rules(int dev, char *filename, int opts, int optimize, /* Set up ethernet anchor */ if ((pf.eanchor = calloc(1, sizeof(*pf.eanchor))) == NULL) - ERRX("pfctl_rules: calloc"); + ERRX("%s: calloc", __func__); if (strlcpy(pf.eanchor->path, anchorname, sizeof(pf.eanchor->path)) >= sizeof(pf.eanchor->path)) - errx(1, "pfctl_rules: strlcpy"); + errx(1, "%s: strlcpy", __func__); if (strlcpy(pf.eanchor->name, anchorname, sizeof(pf.eanchor->name)) >= sizeof(pf.eanchor->name)) - errx(1, "pfctl_rules: strlcpy"); + errx(1, "%s: strlcpy", __func__); ethrs = &pf.eanchor->ruleset; pf_init_eth_ruleset(ethrs); @@ -2343,7 +2343,7 @@ pfctl_rules(int dev, char *filename, int opts, int optimize, * loaded at parse time. */ if (pfctl_ruleset_trans(&pf, anchorname, pf.anchor, true)) - ERRX("pfctl_rules"); + ERRX("%s", __func__); if (pf.loadopt & PFCTL_FLAG_ETH) pf.eth_ticket = pfctl_get_ticket(t, PF_RULESET_ETH, anchorname); if (altqsupport && (pf.loadopt & PFCTL_FLAG_ALTQ)) diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 871a18ca6c28..6b47d75f77f3 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1483,7 +1483,7 @@ ifa_load(void) continue; n = calloc(1, sizeof(struct node_host)); if (n == NULL) - err(1, "address: calloc"); + err(1, "%s: calloc", __func__); n->af = ifa->ifa_addr->sa_family; n->ifa_flags = ifa->ifa_flags; #ifdef __KAME__ @@ -1540,7 +1540,7 @@ ifa_load(void) ifa->ifa_addr)->sdl_index; } if ((n->ifname = strdup(ifa->ifa_name)) == NULL) - err(1, "ifa_load: strdup"); + err(1, "%s: strdup", __func__); n->next = NULL; n->tail = n; if (h == NULL) @@ -1743,7 +1743,7 @@ ifa_lookup(char *ifa_name, int flags) got6 = 1; n = calloc(1, sizeof(struct node_host)); if (n == NULL) - err(1, "address: calloc"); + err(1, "%s: calloc", __func__); n->af = p->af; if (flags & PFI_AFLAG_BROADCAST) memcpy(&n->addr.v.a.addr, &p->bcast,