Project

General

Profile

Actions

Regression #16672

open

Firewall rules matching and tagging across distinct anchors are ignored by subsequent tagged rule

Added by Arthur Wiebe 22 days ago. Updated 13 days ago.

Status:
Feedback
Priority:
Normal
Category:
Rules / NAT
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
26.03
Release Notes:
Default
Affected Version:
2.9.0
Affected Architecture:
All

Description

Starting at pfSense Plus 25.11 our team noticed a bug occurring on x86 hardware such as the Netgate 4200/6100.
I've tested on Netgate 2100 (aarch64) and Netgate 3100 (armv7) and the issue does not occur there.

The bug gets triggered when two same or similar match rules (attaching a tag) under two distinct anchors (depth 1 and 2 tested) match a packet. In this scenario any remaining rules that would match such packet by tag get ignored and a default rule applies.

Basic Reproduction in pf


block in inet all

anchor "first" {
  match from <ip_address_or_table> to <ip_address_or_table> tag "allow" 
}

anchor "second" {
  match from <ip_address_or_table> to <ip_address_or_table> tag "allow" 
}

pass in quick on <interface> inet from any to any tagged "allow" keep state

Meanwhile this works:


block in inet all

anchor "firstandonly" {
  match from <ip_address_or_table> to <ip_address_or_table> tag "allow" 
}

pass in quick on <interface> inet from any to any tagged "allow" keep state

Steps to Reproduce on pfSense

  1. Delete all firewall rules on the LAN interface, and create a single allow any rule that allows traffic tagged with example_tag.
  2. Run the attached script matching-anchor-bug.sh on the pfSense appliance. It creates the test match rules under the userrules/* anchor.
  3. From an endpoint on the LAN, try to ping 208.123.73.78.
  4. Notice in /var/log/filter.log that the match rules get hit, but the pass rule you created in the LAN interface does not.
  5. Now re-run the script as follows: ./matching-anchor-bug.sh single-anchor
  6. Notice how the ping immediately starts to be passed as it's now hitting your pass rule.

Files

matching-anchor-bug.sh (3.02 KB) matching-anchor-bug.sh Arthur Wiebe, 01/29/2026 02:51 AM
pf-add-pass-rule.png (508 KB) pf-add-pass-rule.png What the LAN pass rule should look like Arthur Wiebe, 01/29/2026 02:56 AM
pf-lan-rule-view.png (146 KB) pf-lan-rule-view.png What LAN firewall rules should look like Arthur Wiebe, 01/29/2026 02:56 AM
Actions #1

Updated by Arthur Wiebe 21 days ago

It appears this may be resolved in freebsd as of this commit https://github.com/freebsd/freebsd-src/commit/4616481212302b5d875cfc7a00766af017318f7f

Actions #2

Updated by Jim Pingle 20 days ago

  • Project changed from pfSense Plus to pfSense
  • Subject changed from pf: Rules matching and tagging across distinct anchors are ignored by subsequent tagged rule to Firewall rules matching and tagging across distinct anchors are ignored by subsequent tagged rule
  • Category changed from packetfilter to Rules / NAT
  • Assignee set to Kristof Provost
  • Target version set to 2.9.0
  • Affected Plus Version deleted (25.11.1)
  • Plus Target Version set to 26.03

That should get picked up in our next upstream src merge here shortly.

Actions #3

Updated by Marcos M 13 days ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 100
  • Affected Version set to 2.9.0
  • Affected Architecture All added
  • Affected Architecture deleted (4100, 4200, 6100, amd64)
Actions

Also available in: Atom PDF