Skip to content

Netifyd connection marking#1520

Open
gsanchietti wants to merge 4 commits intomainfrom
netifyd-connection-marking
Open

Netifyd connection marking#1520
gsanchietti wants to merge 4 commits intomainfrom
netifyd-connection-marking

Conversation

@gsanchietti
Copy link
Member

@gsanchietti gsanchietti commented Feb 12, 2026

We cannot reliably block applications, seems that different systems behave differently, we are investigating on the why.
Following actions so far have been taken to address this issue:

  • removed nft set blocks, moving to conntrack labeling approach

Evaluate also the following changes:

  • remove netify-init labeling
  • use reject instead of drop so the client can stop the requests

Replaces #1519

@Tbaile Tbaile force-pushed the netifyd-connection-marking branch from 8beb3b9 to 1d568d2 Compare February 13, 2026 08:34
@gsanchietti gsanchietti changed the base branch from main to netifyd-nfqueue February 13, 2026 09:59
@gsanchietti gsanchietti changed the base branch from netifyd-nfqueue to main February 13, 2026 10:00
@Tbaile Tbaile mentioned this pull request Feb 13, 2026
@gsanchietti gsanchietti force-pushed the netifyd-connection-marking branch from 1d568d2 to c5e62aa Compare February 13, 2026 14:20
Copy link
Member Author

@gsanchietti gsanchietti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall the PR is good and works well.

The proposed changes should:

  • reduce client traffic due to the reject
  • speedup the traffic handling because the chain adds only one label

Comment on lines +15 to +24
chain dpi_blocks {
type filter hook prerouting priority filter + 10; policy accept;

# init is to allow kernel to set labels
ct label set netify-init
{% if log_enabled -%}
ct label netify-block counter log prefix "DPI block: " limit rate {{ log_limit }}
{% endif -%}
ct label netify-block counter drop
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Evaluate this changes:

  1. if the support does not need to know if a connection has been seen by netifyd, create a dummy chain to initialize the labels
  2. use the reject instead of drop so clients will not keep retrying to send TCP packets
Suggested change
chain dpi_blocks {
type filter hook prerouting priority filter + 10; policy accept;
# init is to allow kernel to set labels
ct label set netify-init
{% if log_enabled -%}
ct label netify-block counter log prefix "DPI block: " limit rate {{ log_limit }}
{% endif -%}
ct label netify-block counter drop
}
chain dpi_dummy {
# this init is to allow kernel to set labels
ct label set netify-init
}
chain dpi_blocks {
type filter hook prerouting priority filter + 10; policy accept;
{% if log_enabled -%}
ct label netify-block counter log prefix "DPI block: " limit rate {{ log_limit }}
{% endif -%}
ct label netify-block counter reject
}

Copy link
Member Author

@gsanchietti gsanchietti Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After few other tests, I'd choose:

  • use reject instead of drop
  • keep netify-init label so we can easily check which connections have been through netifyd once the nfq is enabled
  • re-add removed features to tag a connection with different qos:
    • add back actions inside dpi-config
    • add rules inside dpi-nft:
      ct label bulk counter ip dscp set cs1 return
      ct label best_effort counter ip dscp set cs0 return
      ct label video counter ip dscp set af41 return
      ct label voice counter ip dscp set cs6 return
      

Given this info, we could improve the conntrack page to show these extra info.
Suggested command:

conntrack -L -o labels,id,xml

To be used here

@gsanchietti gsanchietti marked this pull request as ready for review February 13, 2026 15:08
@gsanchietti gsanchietti requested a review from Tbaile February 13, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants