From: Hangbin Liu <liuhangbin@gmail.com>
To: Eyal Birger <eyal.birger@gmail.com>
Cc: Marcelo Ricardo Leitner <mleitner@redhat.com>,
netdev@vger.kernel.org, jhs@mojatatu.com,
xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net,
kuba@kernel.org, ahleihel@redhat.com, dcaratti@redhat.com,
aconole@redhat.com, roid@nvidia.com,
Shmulik Ladkani <shmulik.ladkani@gmail.com>
Subject: Re: [PATCH net] net: sched: act_mirred: Reset ct info when mirror/redirect skb
Date: Thu, 21 Apr 2022 19:00:07 +0800 [thread overview]
Message-ID: <YmE5N0aNisKVLAyt@Laptop-X1> (raw)
In-Reply-To: <CAHsH6GvoDr5qOKsvvuShfHFi4CsCfaC-pUbxTE6OfYWhgTf9bg@mail.gmail.com>
Hi Eyal,
On Tue, Apr 19, 2022 at 09:14:38PM +0300, Eyal Birger wrote:
> > > > On Mon, 9 Aug 2021 15:04:55 +0800 you wrote:
> > > > > When mirror/redirect a skb to a different port, the ct info should be reset
> > > > > for reclassification. Or the pkts will match unexpected rules. For example,
> > > > > with following topology and commands:
> > > > >
> > > > > -----------
> > > > > |
> > > > > veth0 -+-------
> > > > > |
> > > > > veth1 -+-------
> > > > > |
> > > > >
> > > > > [...]
> > > >
> > > > Here is the summary with links:
> > > > - [net] net: sched: act_mirred: Reset ct info when mirror/redirect skb
> > > > https://git.kernel.org/netdev/net/c/d09c548dbf3b
> > >
> > > Unfortunately this commit breaks DNAT when performed before going via mirred
> > > egress->ingress.
> > >
> > > The reason is that connection tracking is lost and therefore a new state
> > > is created on ingress.
> > >
> > > This breaks existing setups.
> > >
> > > See below a simplified script reproducing this issue.
I think we come in to a paradox state. Some user don't want to have previous
ct info after mirror, while others would like to keep. In my understanding,
when we receive a pkt from a interface, the skb should be clean and no ct info
at first. But I may wrong.
Jamal, Wang Cong, Jiri, do you have any comments?
> >
> > I guess I can understand why the reproducer triggers it, but I fail to
> > see the actual use case you have behind it. Can you please elaborate
> > on it?
>
> One use case we use mirred egress->ingress redirect for is when we want to
> reroute a packet after applying some change to the packet which would affect
> its routing. for example consider a bpf program running on tc ingress (after
> mirred) setting the skb->mark based on some criteria.
>
> So you have something like:
>
> packet routed to dummy device based on some criteria ->
> mirred redirect to ingress ->
> classification by ebpf logic at tc ingress ->
> packet routed again
>
> We have a setup where DNAT is performed before this flow in that case the
> ebpf logic needs to see the packet after the NAT.
Is it possible to check whether it's need to set the skb->mark before DNAT?
So we can update it before egress and no need to re-route.
Thanks
Hangbin
next prev parent reply other threads:[~2022-04-21 11:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-09 7:04 [PATCH net] net: sched: act_mirred: Reset ct info when mirror/redirect skb Hangbin Liu
2021-08-09 8:35 ` Roi Dayan
2021-08-09 10:00 ` patchwork-bot+netdevbpf
2022-04-19 16:50 ` Eyal Birger
2022-04-19 17:26 ` Marcelo Ricardo Leitner
2022-04-19 18:14 ` Eyal Birger
2022-04-20 10:07 ` Hangbin Liu
2022-04-21 11:00 ` Hangbin Liu [this message]
2022-04-22 13:41 ` Marcelo Ricardo Leitner
2022-04-23 16:08 ` Eyal Birger
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=YmE5N0aNisKVLAyt@Laptop-X1 \
--to=liuhangbin@gmail.com \
--cc=aconole@redhat.com \
--cc=ahleihel@redhat.com \
--cc=davem@davemloft.net \
--cc=dcaratti@redhat.com \
--cc=eyal.birger@gmail.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=mleitner@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=roid@nvidia.com \
--cc=shmulik.ladkani@gmail.com \
--cc=xiyou.wangcong@gmail.com \
/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