From: Roi Dayan <roid@nvidia.com>
To: Hangbin Liu <liuhangbin@gmail.com>, <netdev@vger.kernel.org>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
Cong Wang <xiyou.wangcong@gmail.com>,
Jiri Pirko <jiri@resnulli.us>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Marcelo Ricardo Leitner <mleitner@redhat.com>,
Alaa Hleihel <ahleihel@redhat.com>,
Davide Caratti <dcaratti@redhat.com>,
Aaron Conole <aconole@redhat.com>
Subject: Re: [PATCH net] net: sched: act_mirred: Reset ct info when mirror/redirect skb
Date: Mon, 9 Aug 2021 11:35:38 +0300 [thread overview]
Message-ID: <a25a75de-ac21-f20b-3372-9d90cb485f2f@nvidia.com> (raw)
In-Reply-To: <20210809070455.21051-1-liuhangbin@gmail.com>
On 2021-08-09 10:04 AM, Hangbin Liu 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 -+-------
> |
> ------------
>
> tc qdisc add dev veth0 clsact
> # The same with "action mirred egress mirror dev veth1" or "action mirred ingress redirect dev veth1"
> tc filter add dev veth0 egress chain 1 protocol ip flower ct_state +trk action mirred ingress mirror dev veth1
> tc filter add dev veth0 egress chain 0 protocol ip flower ct_state -inv action ct commit action goto chain 1
> tc qdisc add dev veth1 clsact
> tc filter add dev veth1 ingress chain 0 protocol ip flower ct_state +trk action drop
>
> ping <remove ip via veth0> &
> tc -s filter show dev veth1 ingress
>
> With command 'tc -s filter show', we can find the pkts were dropped on
> veth1.
>
We can add a fixes line on the commit added ct support
Fixes: b57dc7c13ea9 ("net/sched: Introduce action ct")
> Signed-off-by: Roi Dayan <roid@nvidia.com>
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> ---
> net/sched/act_mirred.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
> index 7153c67f641e..2ef4cd2c848b 100644
> --- a/net/sched/act_mirred.c
> +++ b/net/sched/act_mirred.c
> @@ -273,6 +273,9 @@ static int tcf_mirred_act(struct sk_buff *skb, const struct tc_action *a,
> goto out;
> }
>
> + /* All mirred/redirected skbs should clear previous ct info */
> + nf_reset_ct(skb2);
> +
> want_ingress = tcf_mirred_act_wants_ingress(m_eaction);
>
> expects_nh = want_ingress || !m_mac_header_xmit;
>
next prev parent reply other threads:[~2021-08-09 8:35 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 [this message]
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
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=a25a75de-ac21-f20b-3372-9d90cb485f2f@nvidia.com \
--to=roid@nvidia.com \
--cc=aconole@redhat.com \
--cc=ahleihel@redhat.com \
--cc=davem@davemloft.net \
--cc=dcaratti@redhat.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=liuhangbin@gmail.com \
--cc=mleitner@redhat.com \
--cc=netdev@vger.kernel.org \
--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