git: e790bcd784c9 - main - pfctl: Use error label in host_if()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 30 Jun 2025 15:00:55 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=e790bcd784c995f7aa8f730d1de1b6c5de5872b2
commit e790bcd784c995f7aa8f730d1de1b6c5de5872b2
Author: Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-06-27 12:23:34 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-06-30 15:00:28 +0000
pfctl: Use error label in host_if()
This brings it in line with host() and host_dns().
OK sashan miko
Obtained from: OpenBSD, kn <kn@openbsd.org>, d127311405
Sponsored by: Rubicon Communications, LLC ("Netgate")
---
sbin/pfctl/pfctl_parser.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c
index 0c5f184106cd..d903b592b1ac 100644
--- a/sbin/pfctl/pfctl_parser.c
+++ b/sbin/pfctl/pfctl_parser.c
@@ -1852,22 +1852,18 @@ host_if(const char *s, int mask)
flags |= PFI_AFLAG_PEER;
else if (!strcmp(p+1, "0"))
flags |= PFI_AFLAG_NOALIAS;
- else {
- free(ps);
- return (NULL);
- }
+ else
+ goto error;
*p = '\0';
}
if (flags & (flags - 1) & PFI_AFLAG_MODEMASK) { /* Yep! */
fprintf(stderr, "illegal combination of interface modifiers\n");
- free(ps);
- return (NULL);
+ goto error;
}
if ((flags & (PFI_AFLAG_NETWORK|PFI_AFLAG_BROADCAST)) && mask > -1) {
fprintf(stderr, "network or broadcast lookup, but "
"extra netmask given\n");
- free(ps);
- return (NULL);
+ goto error;
}
if (ifa_exists(ps) || !strncmp(ps, "self", IFNAMSIZ)) {
/* interface with this name exists */
@@ -1876,6 +1872,7 @@ host_if(const char *s, int mask)
set_ipmask(n, mask > -1 ? mask : 128);
}
+error:
free(ps);
return (h);
}