[pf] stable/12: block by OS broken

Kristof Provost kp at FreeBSD.org
Thu Feb 18 06:35:32 UTC 2021


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


More information about the freebsd-stable mailing list