pfctl: report ICMP states consistently for IPv4/IPv6

Remove the '#ifndef INET6', which never actually mattered because this
define is never set. This makes us report ICMP states for IPv4 and IPv6
the same way (and also aligns us with OpenBSD).

This means we will now always report state 0:0 rather than
NO_TRAFFIC:NO_TRAFFIC for icmp6 (like we already did for icmp).

Reported by:	Lev Prokofev <lev@netgate.com>
Sponsored by:	Rubicon Communications, LLC ("Netgate")
This commit is contained in:
Kristof Provost
2025-12-12 18:07:19 +01:00
parent 2f29d0f3e6
commit 1dee2336ab
-5
View File
@@ -324,13 +324,8 @@ print_state(struct pfctl_state *s, int opts)
} else if (proto == IPPROTO_SCTP) {
printf(" %s:%s\n", sctp_state_name(src->state),
sctp_state_name(dst->state));
#ifndef INET6
} else if (proto != IPPROTO_ICMP && src->state < PFOTHERS_NSTATES &&
dst->state < PFOTHERS_NSTATES) {
#else
} else if (proto != IPPROTO_ICMP && proto != IPPROTO_ICMPV6 &&
src->state < PFOTHERS_NSTATES && dst->state < PFOTHERS_NSTATES) {
#endif
/* XXX ICMP doesn't really have state levels */
const char *states[] = PFOTHERS_NAMES;