From owner-freebsd-net@freebsd.org Thu Feb 18 06:35:32 2021 Return-Path: Delivered-To: freebsd-net@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3CFCA52BA7B; Thu, 18 Feb 2021 06:35:32 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dh4hh1HS9z3H9D; Thu, 18 Feb 2021 06:35:32 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id 043AD3086; Thu, 18 Feb 2021 06:35:32 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 3AAC94B125; Thu, 18 Feb 2021 07:35:30 +0100 (CET) From: "Kristof Provost" To: d@delphij.net Cc: freebsd-net@freebsd.org, "FreeBSD stable" Subject: Re: [pf] stable/12: block by OS broken Date: Thu, 18 Feb 2021 07:35:29 +0100 X-Mailer: MailMate (1.13.2r5673) 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> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed; markup=markdown Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Feb 2021 06:35:32 -0000 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