git: bef7104571f3 - main - pf: use ERROUT_IOCTL()

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Wed, 06 Apr 2022 16:53:18 UTC
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=bef7104571f35eeffc27b25d8857a7940dd23ab8

commit bef7104571f35eeffc27b25d8857a7940dd23ab8
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2022-04-06 14:45:18 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
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