Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4186328ybp; Mon, 14 Oct 2019 00:12:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqwxyzdx5OpsZg0MHWR5twn5d88EPbO7StNWwgDMlTS29JWS1nMZQOSWMI4TUpTBglpbjEXQ X-Received: by 2002:aa7:d582:: with SMTP id r2mr20077324edq.196.1571037179490; Mon, 14 Oct 2019 00:12:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571037179; cv=none; d=google.com; s=arc-20160816; b=rz/ewfGXtnpz/MXTU46JKvTenhUb5RdVXexcn5Zb4TdFQ6Z8Drns0ZSVKGnsR+ysON BdC+GIZV7qz3o91PmvBvfVPx/s9lPAw3gh2YE7jjjXLIvlqmQsphbnkMj9uIVb0+5ihn oevX1k5X2Bv76SDhFqbSFkWX2KvtMcgRDlYorCc9Rg//CiDgoleHjoz863dFb1fGj05a V4JiJBSFmSkAWPI6ut8sLkL+b5uz3jtwdSisNZGOe7Hv0trA2abE8Z3VIkDXUu72VAJU b+3qgCqurOpDn4yeS/cu3Lw3tjQPYkiV0iONdhXk7UhODzGKDIxjXtHIbO2VrPUAqVQ/ u61w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:subject:from; bh=B+Os4m0eYMd2FxpoeBUKA02DMPVvZXoDr+FqWwbb+1c=; b=c2rJVclwefM/s4du74PyaieBUqa6oztH5BAt8YY7+k3UdOV46nYx+HBx0DTTidHamS emWTndE44sTXP/v+BJEqK0a3HNs8H4070V3YfKB1fe9rvdB6dv/Bzcz1xi4S1BGm+WQP 10/dhZWzJcB86foWdUEdkzPFQM+UiIn6pHfZrRp/SUiG0ulIGdfxQLVSDZFwzlEdYv3c aDyTVxx23OWTR0MFIoLfjiWEVcuFxeJnmRsxIOldlbrTQoLpj01kAWa4iYyOLwPsdRRR i3MOOXfb8AXb9umBgmqgw1apb9h5bCEyM8hGzm3hkhI9+tLUnj45UIK2qi32RysFBh9i 01Ug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i38si12910456eda.64.2019.10.14.00.12.36; Mon, 14 Oct 2019 00:12:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730337AbfJNHI6 (ORCPT + 99 others); Mon, 14 Oct 2019 03:08:58 -0400 Received: from out30-54.freemail.mail.aliyun.com ([115.124.30.54]:47143 "EHLO out30-54.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729966AbfJNHI6 (ORCPT ); Mon, 14 Oct 2019 03:08:58 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R251e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04391;MF=zhiyuan2048@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0Teyix93_1571036934; Received: from houzhiyuandeMacBook-Pro.local(mailfrom:zhiyuan2048@linux.alibaba.com fp:SMTPD_---0Teyix93_1571036934) by smtp.aliyun-inc.com(127.0.0.1); Mon, 14 Oct 2019 15:08:54 +0800 From: Zhiyuan Hou Subject: Re: [PATCH net] net: sched: act_mirred: drop skb's dst_entry in ingress redirection To: Sergei Shtylyov , Jamal Hadi Salim , Cong Wang , Jiri Pirko , "David S . Miller" Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20191012071620.8595-1-zhiyuan2048@linux.alibaba.com> <2ad15b96-156d-7b71-0e37-74ceeacade35@cogentembedded.com> Message-ID: <20b0aafe-4c1c-1c7a-5563-56eb43ebb409@linux.alibaba.com> Date: Mon, 14 Oct 2019 15:08:54 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 In-Reply-To: <2ad15b96-156d-7b71-0e37-74ceeacade35@cogentembedded.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/10/13 3:34 上午, Sergei Shtylyov wrote: > 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? Sorry, it should be following. I will change it in next version. >> (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 >> --- >> 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. I will change it in next version . Thanks. > [...] > > MBR, Sergei