git: 4aafc73d1255 - main - pfctl: pfctl_set_hostid always returns 0

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Tue, 14 Jan 2025 10:37:47 UTC
The branch main has been updated by kp:

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

commit 4aafc73d1255a92463d2ee73cea381462775e64a
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-01-07 10:55:05 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-01-14 08:54:17 +0000

    pfctl: pfctl_set_hostid always returns 0
    
    Don't pretend otherwise and make it a void function instead.
    
    ok dlg
    
    Obtained from:  OpenBSD, mcbride <mcbride@openbsd.org>, 9ac6101ff7
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 sbin/pfctl/parse.y        | 5 +----
 sbin/pfctl/pfctl.c        | 6 ++----
 sbin/pfctl/pfctl_parser.h | 2 +-
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index fc9cf86081f6..63bee3ab6a1c 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -702,10 +702,7 @@ option		: SET REASSEMBLE yesno optnodf		{
 				yyerror("hostid must be non-zero");
 				YYERROR;
 			}
-			if (pfctl_set_hostid(pf, $3) != 0) {
-				yyerror("error setting hostid %08x", $3);
-				YYERROR;
-			}
+			pfctl_set_hostid(pf, $3);
 		}
 		| SET BLOCKPOLICY DROP	{
 			if (pf->opts & PF_OPT_VERBOSE)
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c
index 190d1a382c03..4b2a69f456a2 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -2571,11 +2571,11 @@ pfctl_load_logif(struct pfctl *pf, char *ifname)
 	return (pfctl_set_statusif(pfh, ifname ? ifname : ""));
 }
 
-int
+void
 pfctl_set_hostid(struct pfctl *pf, u_int32_t hostid)
 {
 	if ((loadopt & PFCTL_FLAG_OPTION) == 0)
-		return (0);
+		return;
 
 	HTONL(hostid);
 
@@ -2584,8 +2584,6 @@ pfctl_set_hostid(struct pfctl *pf, u_int32_t hostid)
 
 	if (pf->opts & PF_OPT_VERBOSE)
 		printf("set hostid 0x%08x\n", ntohl(hostid));
-
-	return (0);
 }
 
 int
diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h
index 551f2ff7537c..2b0766dfd99f 100644
--- a/sbin/pfctl/pfctl_parser.h
+++ b/sbin/pfctl/pfctl_parser.h
@@ -290,7 +290,7 @@ int	pfctl_set_reassembly(struct pfctl *, int, int);
 int	pfctl_set_optimization(struct pfctl *, const char *);
 int	pfctl_apply_limit(struct pfctl *, const char *, unsigned int);
 int	pfctl_set_logif(struct pfctl *, char *);
-int	pfctl_set_hostid(struct pfctl *, u_int32_t);
+void	pfctl_set_hostid(struct pfctl *, u_int32_t);
 int	pfctl_do_set_debug(struct pfctl *, char *);
 int	pfctl_set_interface_flags(struct pfctl *, char *, int, int);
 int	pfctl_cfg_syncookies(struct pfctl *, uint8_t, struct pfctl_watermarks *);