Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Feb 2021 07:35:29 +0100
From:      "Kristof Provost" <kp@FreeBSD.org>
To:        d@delphij.net
Cc:        freebsd-net@freebsd.org, "FreeBSD stable" <freebsd-stable@freebsd.org>
Subject:   Re: [pf] stable/12: block by OS broken
Message-ID:  <11E53D9F-CE51-4726-85FB-A0B4558572CD@FreeBSD.org>
In-Reply-To: <37b0e157-8173-7fb7-7ca3-c4a8b2ad0b31@delphij.net>
References:  <37b0e157-8173-7fb7-7ca3-c4a8b2ad0b31@delphij.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 18 Feb 2021, at 6:01, Xin Li wrote:
> Hi,
>
> It appears that some change between 939430f2377 (December 31) and
> b4bf7bdeb70 (today) on stable/12 have broken pf in a way that the
> following rule:
>
> block in quick proto tcp from any os "Linux" to any port ssh
>
> would get interpreted as:
>
> block drop in quick proto tcp from any to any port = 22
>
> (and block all SSH connection instead of just the ones initiated from
> Linux).
>
Thanks for the report. I think I see the problem.

Can you test this patch?

	diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c
	index 593a38d4a360..458c6af3fa5e 100644
	--- a/sys/netpfil/pf/pf_ioctl.c
	+++ b/sys/netpfil/pf/pf_ioctl.c
	@@ -1623,7 +1623,7 @@ pf_rule_to_krule(const struct pf_rule *rule, 
struct pf_krule *krule)
	        /* Don't allow userspace to set evaulations, packets or bytes. 
*/
	        /* kif, anchor, overload_tbl are not copied over. */

	-       krule->os_fingerprint = krule->os_fingerprint;
	+       krule->os_fingerprint = rule->os_fingerprint;

	        krule->rtableid = rule->rtableid;
	        bcopy(rule->timeout, krule->timeout, sizeof(krule->timeout));

With any luck we’ll be able to include the fix in 13.0.

Best regards,
Kristof



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?11E53D9F-CE51-4726-85FB-A0B4558572CD>