From nobody Wed Apr 06 16:53:18 2022 X-Original-To: dev-commits-src-main@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 1E22A1A99281; Wed, 6 Apr 2022 16:53:19 +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 4KYVvL6VX1z4mk0; Wed, 6 Apr 2022 16:53:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649263998; 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=tFa71y2GJ3FFnVIl+YJ22oUMexJu3fPKQG1n0qabTW4=; b=K4DcE3REqQhuCnJsHb0OpTJxy6LtTAT2rH9ixXIinD+giZeI2l4QbgVFap9XHIj8y4CrS6 RmDJhqQGRzjfd5Z1dn/OEVwQ+ndbGx4D5FeCcvTkVKu2myNyCoEPnjMMUCJWBaQnHy84GL St7cMM+B/6T14IGhvCRDnzGDSEvoI2V5mvQTSPlaWe+i+nquZISs2nAiArsHntcq102wbn JVyBq2D+o8cOIbJOFkdVyasx+KkXFkl2DCKdhSXzb/1c35MIEL5AUOv2PeNidTMs9Lpoqw m0zfWq+GnPV1ZCrqg1d7lD0hl0yBw9rlcHas+AexSgDfa+9hG21HhqvQUbWitg== 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 8AB281EEBD; Wed, 6 Apr 2022 16:53:18 +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 236GrILW055005; Wed, 6 Apr 2022 16:53:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 236GrI3n055004; Wed, 6 Apr 2022 16:53:18 GMT (envelope-from git) Date: Wed, 6 Apr 2022 16:53:18 GMT Message-Id: <202204061653.236GrI3n055004@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: bef7104571f3 - main - pf: use ERROUT_IOCTL() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: bef7104571f35eeffc27b25d8857a7940dd23ab8 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1649263998; 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=tFa71y2GJ3FFnVIl+YJ22oUMexJu3fPKQG1n0qabTW4=; b=pB+NygTSakXy0BO/WifjNyY7enn5E1lYh+ih1V7bXfDzMTux93U0svi8zc6JP9DuqqtRvH 1Z0tk9phbL8Gs5Spnr12atKAgVj1gxgFAHjMQE/HEzJgKnEXySyUDcwcTGdXR4eIjLmhPj hBH1cz9mHATkVU07oU5qs7A4QI+21wz70OlXGWwsiQ0l/UorgcVTYvWr+EwTDv/WD3k/bt uQAWss5oHxbT8fCj+nbKYyowEV7E9qGtUbkm6JZ8nXQFW/erm1cFwJaDKgDh7btYemHzKF J+4FH6oKGf/7iUT+Pd6RBVQMUkeG+mZiAdbZdeA4qng2M8JMnTn2uy043UIWzQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1649263998; a=rsa-sha256; cv=none; b=SPTVMe7txylZpWgtVWN5l3uZbUujeqkjRkDPO/gGn6dEUInxtrL6G9lkGzkoBcEeEayRn1 6t9Aeh0ngGf5X6su1d9nd4h/Xk9BcbPdWvN8dYMtnQXakl+qMY1CQonVaehhGwfTvUmAjk JfqOoWnbjv7uqjtGU70/j+X5rPF09XWvxJFw7/4ndruTwXOZGBDhU9gueB/vhISnHKqlxM 03+1Xay5xv9sC4H9bOCyNIaarzzxtyrKpR5r0Dl7/+AchcQUe2Ia6pxHDVnmNzHxi1NMqo Jp72MkOYATMa7QdcaC1c/IC0CYF2W+JuPowmA3a9w43dnG+ECrwI19FsyNc1/A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=bef7104571f35eeffc27b25d8857a7940dd23ab8 commit bef7104571f35eeffc27b25d8857a7940dd23ab8 Author: Kristof Provost AuthorDate: 2022-04-06 14:45:18 +0000 Commit: Kristof Provost CommitDate: 2022-04-06 14:51:31 +0000 pf: use ERROUT_IOCTL() Use ERROUT_IOCTL() rather than hand-rolling the macro. This adds DTrace SDTs in the error path, making debugging ioctl errors easier. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf_ioctl.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index c170a270454b..22adc141846d 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2590,7 +2590,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td nvl = NULL; packed = NULL; -#define ERROUT(x) do { error = (x); goto DIOCGETETHRULES_error; } while (0) +#define ERROUT(x) ERROUT_IOCTL(DIOCGETETHRULES_error, x) if (nv->len > pf_ioctl_maxcount) ERROUT(ENOMEM); @@ -2671,7 +2671,7 @@ DIOCGETETHRULES_error: bool clear = false; const char *anchor; -#define ERROUT(x) do { error = (x); goto DIOCGETETHRULE_error; } while (0) +#define ERROUT(x) ERROUT_IOCTL(DIOCGETETHRULE_error, x) if (nv->len > pf_ioctl_maxcount) ERROUT(ENOMEM); @@ -2773,7 +2773,7 @@ DIOCGETETHRULE_error: struct pfi_kkif *kif = NULL; const char *anchor = "", *anchor_call = ""; -#define ERROUT(x) do { error = (x); goto DIOCADDETHRULE_error; } while (0) +#define ERROUT(x) ERROUT_IOCTL(DIOCADDETHRULE_error, x) nvlpacked = malloc(nv->len, M_TEMP, M_WAITOK); if (nvlpacked == NULL) @@ -2883,7 +2883,7 @@ DIOCADDETHRULE_error: struct pf_keth_anchor *anchor; int nr = 0; -#define ERROUT(x) do { error = (x); goto DIOCGETETHRULESETS_error; } while (0) +#define ERROUT(x) ERROUT_IOCTL(DIOCGETETHRULESETS_error, x) if (nv->len > pf_ioctl_maxcount) ERROUT(ENOMEM); @@ -2961,7 +2961,7 @@ DIOCGETETHRULESETS_error: int nr = 0, req_nr = 0; bool found = false; -#define ERROUT(x) do { error = (x); goto DIOCGETETHRULESET_error; } while (0) +#define ERROUT(x) ERROUT_IOCTL(DIOCGETETHRULESET_error, x) if (nv->len > pf_ioctl_maxcount) ERROUT(ENOMEM); @@ -3396,7 +3396,7 @@ DIOCGETRULENV_error: newrule->cpid = td->td_proc ? td->td_proc->p_pid : 0; TAILQ_INIT(&newrule->rpool.list); } -#define ERROUT(x) { error = (x); goto DIOCCHANGERULE_error; } +#define ERROUT(x) ERROUT_IOCTL(DIOCCHANGERULE_error, x) PF_RULES_WLOCK(); #ifdef PF_WANT_32_TO_64_COUNTER