Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1926901ybp; Sat, 12 Oct 2019 00:31:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7UL5MXwZAdkALL7Qm7LMhOqidAe/G/WIe07RC8IgE9lIFarh0SMa23d5GIzbPTDr6bQPJ X-Received: by 2002:a17:906:fcce:: with SMTP id qx14mr18293042ejb.186.1570865490517; Sat, 12 Oct 2019 00:31:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570865490; cv=none; d=google.com; s=arc-20160816; b=tnvJ+BhDGurbn3eJDZbi5jD6GWkmWhigrJgdIpJFG8KyKJZTMF5X4hSXTQAlmvHA9T 2bsf+cTPi8DOKv+wJMZVrGS59BbY910uFzWutGjwSXMEFnKtsxdNsaRHBytRdFTQRkWF J44rzzNmOK1GiskJuBLoGb4lk4qQGvCwn92UShEsfGNpDEXxPc8a2eRvYN0Ne6kgfW4k DXBFk7nFBesV2aiCb15c0LRdFZwcmgdAscTVupy9A+cWGb1ew+mIKNabPuXu2SPxteyJ 5owyNHboRRt6ZovcnzEO+gUmMAbVjELt9EjVXfGO1GazNlH0z+LqvXK9cB+3Vkb+hE2L EcBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=V8eqrRDKCfOn4oHE6ANw9BC0ufTjlrQajtTbcA+qx4w=; b=DdNJ8mXX9ujgZaE318TYygUEB4DzhE2KlpeZnFFWTDssD3OSp2neR3ITFIiLfV6BmO 6b5SxEh/z9++jBCP7e2oCWpG5CLY5QD9qJCne42n1whoA6nMiPlCa4Jg6tijKn3bwPHf YyWGnEa7CGxDh8hhYmfKGiLtF7NCQcx8/tq4aY5k2LOMQjomQu7rcs0sqUY+oTX+S8Nh i4ndhuRPWWIA2lTpUHN01oIY7HygrLBrKxuzB5g9jlOAyBfhO+ed8/J+ay2DEpQpeLKs 043ol2KX+YaSMDhy1dRIR/VojJoYezfo+7xgK0AJ6JKXDuqw/GbYDG77GhXv/4CvKH1e QmKw== 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 5si7630456edy.95.2019.10.12.00.31.07; Sat, 12 Oct 2019 00:31:30 -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 S1728801AbfJLHQX (ORCPT + 99 others); Sat, 12 Oct 2019 03:16:23 -0400 Received: from out30-45.freemail.mail.aliyun.com ([115.124.30.45]:60060 "EHLO out30-45.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726728AbfJLHQX (ORCPT ); Sat, 12 Oct 2019 03:16:23 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01419;MF=zhiyuan2048@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0TenwfOo_1570864580; Received: from localhost(mailfrom:zhiyuan2048@linux.alibaba.com fp:SMTPD_---0TenwfOo_1570864580) by smtp.aliyun-inc.com(127.0.0.1); Sat, 12 Oct 2019 15:16:20 +0800 From: Zhiyuan Hou To: Jamal Hadi Salim , Cong Wang , Jiri Pirko , "David S . Miller" Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net] net: sched: act_mirred: drop skb's dst_entry in ingress redirection Date: Sat, 12 Oct 2019 15:16:20 +0800 Message-Id: <20191012071620.8595-1-zhiyuan2048@linux.alibaba.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 (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 @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -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 (err) { out: -- 2.21.0