diff options
author | Kristof Provost <kp@FreeBSD.org> | 2022-04-06 14:45:18 +0000 |
---|---|---|
committer | Kristof Provost <kp@FreeBSD.org> | 2022-04-06 14:51:31 +0000 |
commit | bef7104571f35eeffc27b25d8857a7940dd23ab8 (patch) | |
tree | d5c873f8867ff2968f15185728f9eec48b67352d | |
parent | 3dcfd6c266d492075e8f8481a60170b22866db56 (diff) | |
download | src-bef7104571f35eeffc27b25d8857a7940dd23ab8.tar.gz src-bef7104571f35eeffc27b25d8857a7940dd23ab8.zip |
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")
-rw-r--r-- | sys/netpfil/pf/pf_ioctl.c | 12 |
1 files 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 |