git: f5f71f729a5f - main - pfctl: don't require port numbers when killing by key

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Fri, 09 May 2025 22:16:24 UTC
The branch main has been updated by kp:

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

commit f5f71f729a5fe029fdb029c2bbed35f88d44ab15
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-05-09 15:21:18 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-05-09 20:49:30 +0000

    pfctl: don't require port numbers when killing by key
    
    If the port number is zero (e.g. for ICMP echo request states) we don't
    print it. Accept this when killing states by key. Assume port number 0 if not
    specified.
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 sbin/pfctl/pfctl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c
index c540a62f0409..94aaaa315639 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -1040,8 +1040,9 @@ pfctl_parse_host(char *str, struct pf_rule_addr *addr)
 	} else if ((sbs = strchr(s, ':')) != NULL) {
 		hints.ai_family = AF_INET;
 		*(sbs++) = '\0';
-	} else
-		goto error;
+	} else {
+		/* Assume that no ':<number>' means port 0 */
+	}
 
 	if (getaddrinfo(s, sbs, &hints, &ai) != 0)
 		goto error;