From nobody Sat Nov 02 16:56:01 2024 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XgkQ96F1jz5cLYq for ; Sat, 02 Nov 2024 16:56:01 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XgkQ954h2z4XpY for ; Sat, 2 Nov 2024 16:56:01 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730566561; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IUmYhr4oZMGB/505FO960igrw3d8OiBNZPU7IdVeSbM=; b=Y0XzK++lRXroJK9yCHeyzCMQhtfKAjlk/TUZe4u8yfYAchBObmkJXzgeNKKhIvJCVBoHeU oJdFzGrISoU/j7BmKZR+IF2ZeBgO/Lf2jdNDn3U11oZNIighd26+DWTc8hw1GvAnHsO/a2 6UlJxFq7OtMmoJIjfNC1tl3d9J1IUtfCc+V/ag40kDhhRl9tDOlAfdcr4A9Zfcwj2sRaDl moNiquFcWZ8OBalLeJ5xAPdnEWvm5CLOarA9EXxN7H+o8RNx+vpIkrWSCl582iyTtgNeco i+UhIUt90id2GfYD09rqJkCETghqEHFZungjeZMxkzJsiuai603YiOigtF275g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730566561; a=rsa-sha256; cv=none; b=MPNVvMgVzxmqOnKXD55EiwOsh0b6sBKpDRqOqwRKVYn7ucjOMZw/qHk9U20igMcNJCtzWj u/xMcAyQE1rKiD0jfm3BQlbFZ6rueY+/0evggTI//CqvuGyiDzMyGAbZpotUE8uehS0CAX MwI0u/bdDAdB7eGiSKzvEtfsc6fQ+hPtUV2cZbfzdfTrdppWnTIZ5NQ9cfGqHK8jmy66EV q6r4cG7xJMuQ156jorple8tlEvheKZnVeniCJKGxY1F35hZXWF22rgAbrciGzbhjs+RVkE 5aE/Y7R6Xzm5NwP00EcSAbyN1/Ox0TnHMHRvFnMYek4u0R+YTOXyY+pmObPStA== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XgkQ94Rn7z1Bcs for ; Sat, 2 Nov 2024 16:56:01 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 4A2Gu1n6061446 for ; Sat, 2 Nov 2024 16:56:01 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 4A2Gu1Hl061445 for bugs@FreeBSD.org; Sat, 2 Nov 2024 16:56:01 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 282496] PF source tracking counter wrapping around Date: Sat, 02 Nov 2024 16:56:01 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: misc X-Bugzilla-Version: 14.1-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: mkrzewicki@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D282496 Bug ID: 282496 Summary: PF source tracking counter wrapping around Product: Base System Version: 14.1-RELEASE Hardware: amd64 OS: Any Status: New Severity: Affects Only Me Priority: --- Component: misc Assignee: bugs@FreeBSD.org Reporter: mkrzewicki@gmail.com Hi, I have a pf firewall with some rules limiting the number of coonnections and tracking per host like this: pass in quick on igb0 from to any flags S/SA keep state (source-track rule) label "holy" pass in on igb0 inet from any to ! 10.0.0.0/20 flags S/SA keep state (source-track rule, max-src-states 200, max-src-conn 400) label "slow" dnpipe(2, 1) now from time to time I got complaints from users of no connectivity. I not= iced that 'pfctl -sS' sometimes reports a number of connections close to int_max= so I started monitoring that with a simple cron job: * * * * * pfctl -sS|awk '{print $1 " " $8}'|tr ',' ' '|while read addr conn= ; do echo $conn >> /root/pfconntrack/$addr; done it looks like the counter is sometimes decreased below 0 and being an unsig= ned int wraps around to int_max; looks like a race condition like maybe there a= re a few threads decreasing this counter without a check or lock(?) as the large number always follows a low number of connections and after a while it gets back up to a small integer value (close to zero) - below an example of such= a sequence minute by minute for one of the hosts: 10 3 4294967292 4294967292 4294967291 4294967293 4294967292 4294967290 4294967290 1 2 4294967294 2 4 of course the time when the counter is high my users complain as the rule happily stops matching for their hosts. I have asked about this in the forums but it seems nobody knows what to do about this there. So the question is: is it a bug or am I doing something wrong and this behaviour is expected? thanks, --=20 You are receiving this mail because: You are the assignee for the bug.=