linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Zhiyuan Hou <zhiyuan2048@linux.alibaba.com>,
	Jamal Hadi Salim <jhs@mojatatu.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	Jiri Pirko <jiri@resnulli.us>,
	"David S . Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net: sched: act_mirred: drop skb's dst_entry in ingress redirection
Date: Sat, 12 Oct 2019 22:34:50 +0300	[thread overview]
Message-ID: <2ad15b96-156d-7b71-0e37-74ceeacade35@cogentembedded.com> (raw)
In-Reply-To: <20191012071620.8595-1-zhiyuan2048@linux.alibaba.com>

Hello!

On 10/12/2019 10:16 AM, Zhiyuan Hou wrote:

> In act_mirred's ingress redirection, if the skb's dst_entry is valid
> when call function netif_receive_skb, the fllowing l3 stack process

  Following or flowing?

> (ip_rcv_finish_core) will check dst_entry and skip the routing
> decision. Using the old dst_entry is unexpected and may discard the
> skb in some case. For example dst->dst_input points to dst_discard.
> 
> This patch drops the skb's dst_entry before calling netif_receive_skb
> so that the skb can be made routing decision like a normal ingress
> skb.
> 
> Signed-off-by: Zhiyuan Hou <zhiyuan2048@linux.alibaba.com>
> ---
>  net/sched/act_mirred.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
> index 9ce073a05414..6108a64c0cd5 100644
> --- a/net/sched/act_mirred.c
> +++ b/net/sched/act_mirred.c
[...]
> @@ -298,8 +299,10 @@ static int tcf_mirred_act(struct sk_buff *skb, const struct tc_action *a,
>  
>  	if (!want_ingress)
>  		err = dev_queue_xmit(skb2);
> -	else
> +	else {
> +		skb_dst_drop(skb2);
>  		err = netif_receive_skb(skb2);
> +	}

   If you introduce {} in one *if* branch, {} should be added to the other branches as well,
says CodingStyle.

[...]

MBR, Sergei

  parent reply	other threads:[~2019-10-12 19:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-12  7:16 [PATCH net] net: sched: act_mirred: drop skb's dst_entry in ingress redirection Zhiyuan Hou
2019-10-12 10:59 ` Eric Dumazet
2019-10-14  7:07   ` Zhiyuan Hou
2019-10-14 12:46     ` Eric Dumazet
2019-10-17 16:08       ` Zhiyuan Hou
2019-10-12 19:34 ` Sergei Shtylyov [this message]
2019-10-14  7:08   ` Zhiyuan Hou
2019-10-14 17:57 ` Cong Wang
2019-10-15 17:22   ` Zhiyuan Hou
2019-10-16 12:13     ` Eyal Birger
2019-10-17 16:33       ` Zhiyuan Hou
2019-10-18 21:25         ` Eyal Birger
2019-10-21 13:06           ` Zhiyuan Hou
2019-10-21 20:50           ` Cong Wang
2019-10-22 10:37             ` 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=2ad15b96-156d-7b71-0e37-74ceeacade35@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=davem@davemloft.net \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    --cc=zhiyuan2048@linux.alibaba.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;
as well as URLs for NNTP newsgroup(s).