From: Hari Chandrakanthan <hari.chandrakanthan@oss.qualcomm.com>
To: Florian Westphal <fw@strlen.de>
Cc: pablo@netfilter.org, phil@nwl.cc,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH net-next] netfilter: nf_conntrack: add ct expression support for netdev egress chains
Date: Thu, 15 Oct 2026 20:06:53 +0530 [thread overview]
Message-ID: <67d8e88a-eff0-4c8d-a030-b29b5d86f450@oss.qualcomm.com> (raw)
In-Reply-To: <as0HMjsgUvKd7dAo@strlen.de>
On 10/12/2026 9:43 PM, Florian Westphal wrote:
> Hari Chandrakanthan <hari.chandrakanthan@oss.qualcomm.com> wrote:
>> I agree that enabling inet/bridge conntrack solely for netdev/egress
>> would be unnecessary overhead.
> Not following. What is 'netdev egress only'?
By netdev/egress only, I mean that the nft rule with a ct expression
(e.g., ct mark set) is present only in the egress chain for a netdev,
with no other nft conntrack rules in inet or bridge chains.
For example, it may be possible that only rules similar to the below
nft rules are added at the netdev egress chain, with no other ct rule
in inet or bridge hooks.
nft add table netdev qos_table
nft add chain netdev qos_table wlan0_qos \
{ type filter hook egress device "wlan0" priority 0\; }
nft add rule netdev qos_table wlan0_qos \
ether daddr 00:03:7f:01:50:65 \
ip saddr 192.168.1.10 \
ip daddr 192.168.1.20 \
ip protocol tcp \
tcp sport 12345 \
tcp dport 443 \
ct mark set 0x10
> Where are the skbs coming from, i.e. though what pipeline?
>
> Bridge?
> Routing?
In the use case that we are trying to address, the device is a Wi-Fi
access point router. It receives the classification rules from a Wi-Fi
client device for QoS prioritization of down-link traffic to the client
(n-tuple to Wi-Fi TID mappings) via SCS. We would like to apply these
classification rules on the access point router using nft rules
(ct/skb mark set rules) at the WLAN netdev's egress chain.
The skbs of interest that are processed by these rules at the netdev
egress hook are primarily expected to be forwarded traffic (bridged or
routed), before they reach the netdev egress hook. However, it is
possible that the traffic can also be originated from the device.
>> To address this, as suggested by Pablo, we are considering enabling
>> conntrack lookup/creation at
>> netdev/ingress. This would allow netdev chains to access conntrack state
>> without requiring conntrack
>> to be enabled for the inet or bridge families, avoiding unnecessary
>> overhead for netdev-only use cases.
> FWIW bridge conntrack is already problematic (see recent RFC patch
> to refag in INPUT, conntrack is pretty much routing-only.
>
>> Kindly share your thoughts on this approach.
> I think you'd have to explain your use case.
>
> I thought you only want
>
> skb-> mark = ct->mark
>
> from egress. That would imply something else already enabled conntrack
> anyway, else you'd have no conntrack marks set that you could read.
As mentioned in the previous comment, in the use case that we are
trying to address, the device is a Wi-Fi access point router. It
receives classification rules from a Wi-Fi client device for
prioritizing downlink traffic to the client (n-tuple to Wi-Fi TID
mappings) via SCS. We would like to apply these rules on the access
point router using nft rules (ct/skb mark set rules) at the WLAN
netdev egress chain.
The nft rules at netdev egress chain achieve the below functionality:
1. If connmark is not set on the first skb seen by the rule,
perform flow classification (based on dmac addr and n-tuple) and
store the result in the ct's mark via ct mark set. Typically, this rule
will be skipped when the connmark is already set for the flow.
2. If connmark is already set (for subsequent packets), copy it to
skb->mark. Ideally, only this rule should be processed by the vast
majority of packets for the flow.
There are three advantages we see in this solution for this use case:
1. We wanted to avoid incurring the cost of n-tuple match for every
single packet at the netdev egress hook, by applying the
classification rule (tuple match and connmark set) only for the
first packets until connmark is set.
2. Adding the rules at the egress hook of the netdev restricts the
scope of these rules only to packets egressing the netdev of
interest, without incurring the cost of processing these rules for
traffic egressing on other netdevs in the system or other hooks.
Hence, we preferred adding the connmark set rule in the netdev egress
chain itself, instead of the other hooks (such as
forward/post-routing).
3. The destination MAC address (Wi-Fi client) should also be available
in the skb for rule matching, which is available at the netdev egress hook.
next prev parent reply other threads:[~2026-10-15 14:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-06 8:58 [RFC PATCH net-next] netfilter: nf_conntrack: add ct expression support for netdev egress chains Hari Chandrakanthan
2026-10-06 11:39 ` Florian Westphal
2026-10-12 12:16 ` Hari Chandrakanthan
2026-10-12 16:13 ` Florian Westphal
2026-10-15 14:36 ` Hari Chandrakanthan [this message]
2026-10-06 14:04 ` Pablo Neira Ayuso
2026-10-12 12:28 ` Hari Chandrakanthan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=67d8e88a-eff0-4c8d-a030-b29b5d86f450@oss.qualcomm.com \
--to=hari.chandrakanthan@oss.qualcomm.com \
--cc=coreteam@netfilter.org \
--cc=fw@strlen.de \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=phil@nwl.cc \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox