Skip to content

Support pfsync(4) 'defer' feature flag in the Web UI #9237

Closed

Description

@bernardm-aca

Important notices

Before you add a new report, we ask you kindly to acknowledge the following:

Is your feature request related to a problem? Please describe.

We use OPNsense clusters in asymmetric routing scenarios where query packets leave our datacenter via the first cluster node, and response packets flow back via the other node. We rely on the pf state synchronization facility to ensure all connection states created by the first node are replicated to the second node, so that it can accept incoming responses based on firewall states.

In the latest version of OPNsense Community, such a scenario leads to a race condition: response packets almost always hit the second node before state synchronization completes. The second node, finding 0 match in its state database, drops the initial transmit of those packets. It will take some time (and at least 1 retransmit) to have response packets accepted, as state synchronization completed meanwhile.

This behavior can be improved by enabling the defer feature on the pfsync interfaces of our firewalls, which ensures a connection state is replicated before allowing a connection. When this flag is on, the issue I just described disappears.

Describe the solution you like

Please, add a checkbox in the System / High Availability / Settings page:

  • Name: Defer packet transmission until state sync
  • Description (from the ifconfig(8) man page):

    Defer transmission of the first packet in a state until a peer has acknowledged that the associated state has been inserted.

Ensure the OPNsense framework configures the pfsync(4) interface accordingly:

  • When the checkbox is checked, the defer flag must be present:
    ifconfig pfsync0 defer
  • When the checkbox is unchecked, the defer flag must be absent:
    ifconfig pfsync0 -defer

Describe alternatives you considered

Currently, we use a custom cron job to enable the defer feature flag.

Additional context

None.

Activity

  1. AdSchellevis commented on Sep 25, 2025

    @AdSchellevis
    Member

    some more context about the defer flag:

    https://undeadly.org/cgi?action=article;sid=20090619100514
    https://www.openbsd.org/faq/pf/carp.html

    In some cases this can be practical indeed, I'll see if we can put this on the roadmap for 26.1

  2. self-assigned this
    on Sep 25, 2025
  3. added this to the 26.1 milestone on Oct 5, 2025
  4. bernardm-aca commented on Oct 8, 2025

    @bernardm-aca
    Author

    Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

featureAdding new functionalityroadmapMajor roadmap item

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions