Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp7415165ybp; Wed, 16 Oct 2019 08:19:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqwIV+SxexFXUH0fjg705zUpmkUthDZ/9911vxcsczithugJVstis44HUiQzhM21+7QBsxpr X-Received: by 2002:aa7:d717:: with SMTP id t23mr38967459edq.300.1571239171336; Wed, 16 Oct 2019 08:19:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571239171; cv=none; d=google.com; s=arc-20160816; b=AWPjXsjPKeL5nUsBO28cqVJqXpc/xVgYOWCVGL4uepCsB1Sj81tHrpr/9wSJIxkW7g cWbVJ52dLncdgBZY5T+rIMlhm7TTzDzPaO8l6v3qZ0PYUwVFasC+NU+bsNh3chL9QX6p t8OBzOFOxkr1JbkVT55Ydb5+yP4MzbTxZzRJJ3llmi/K/ARUsbfPa00pAELTML+v2h/F URybxdVxGBAs6eSPUf8IQzS54ucp3+wzwIqrBgK3pGZ0fXs8w3JHXK3alGsqfSCOo9l4 zeKQNMvmYIFZWIvvuqPPdSMGdp6xsg4w/J0Jb89Vn6prvBOaKJGF1orRuhlKhPx1Ys/Y HxqA== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=Z5f0yIHlY12I4Q0pn5WdnGvacnYGRlqyDdoVhSRxe6w=; b=OmgoRrfC++WbZC1Sd8tPrrhJSTzFVmuWbTNm7sqILg2J1UldFWXyy6K5IkX7qEd3ps x1KZEzsKmOnrs6/bsUhHi2IZITU982U4177ZvKwgVZy2MHk5KbfAvVdpc604ktLzRSJM 4HM1BcMVP/HMlEgFx9Ka8YvPy5z0yNnbTm8YHxUJpcW34ViucL5nheYvBLejc37VjCCd VyvOr6+eD1ytN7emnh2A+TSkfWAcQL6BAs4LI5LG63HTeOloCcaB989bVhbBvpQEMi00 7rZ+Ew1zSOsXfdjcRXZqJiKoG+Go4WrLA/9Hsc9WL4CV2mMjvT74jxjNdFkkhPtc7lof pxxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KXVD9nR2; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o22si15007015eju.25.2019.10.16.08.19.08; Wed, 16 Oct 2019 08:19:31 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KXVD9nR2; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405010AbfJPMNR (ORCPT + 99 others); Wed, 16 Oct 2019 08:13:17 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:54290 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392915AbfJPMNR (ORCPT ); Wed, 16 Oct 2019 08:13:17 -0400 Received: by mail-wm1-f65.google.com with SMTP id p7so2656800wmp.4; Wed, 16 Oct 2019 05:13:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Z5f0yIHlY12I4Q0pn5WdnGvacnYGRlqyDdoVhSRxe6w=; b=KXVD9nR2ME+vjiKCYNNlVGSIEL/PKns1EI1ssBfrfHxMZ717aw8ibU2cG4R4m6NSqN p3OmoJyT2lcjfH44LwfVR/VmCVbdH3GYLFw+V32nkyf8EcGxcvnqQpSRj0LQ3r10ocjB 8y5GPTJalQIciPmxHp4zSqM5VCiZEYK6BEnUw90H5439Tjy6JrHed1S+Pms/1sS/iH52 YCShR+vFhVmyMDOor5kVy3Tirlhg61IVASfyCzxIunRQdNrff4w8wb16pDV2veZUaH19 6zb+Q6HaZjq0dcc+V+f+wTmgUTvAfV8xRNZu7TeFl8ElKDDGLLdLHb+gYvtA8b2MkZlg 1UqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Z5f0yIHlY12I4Q0pn5WdnGvacnYGRlqyDdoVhSRxe6w=; b=sxgLkyTOmXWL5jCRND3AAm1+LbjJWKtITXxbjgfQwArjECW7xLdbuYYWoIkRxo6vLZ ulMJq7lKNYjqK9YaUQUw4ZzNp40L6mNZV0zjFQRbxqmaLYmvyjYxzH0M33SCPONpi0H/ DAtxXSTUx7nHmsjD5pZ+LOMTFKcms3JKGyc/V08b+QYFXDqmFGJBMWX2HJCPPWfheL5u mJJKvECfqG32lgS4QfZFYaUwPiJbOfAlXYQVznfDuem6r/SjDiaWbOl4n05iMOw34KhZ GM6DusNFunCP7EIT3dCp1RDXtW+8tS7dNWU15KjubJw4EKudcBJe8kuoTMLPh9r/eI7k Fxfg== X-Gm-Message-State: APjAAAV/CBnDkP3jyhY4ZhKtPaBwUWgbnaCH2NHn0Tms6GSB+sOhfW59 1OBKvv43RSsnXgOktOx6NEs= X-Received: by 2002:a1c:9a03:: with SMTP id c3mr3230806wme.109.1571227994744; Wed, 16 Oct 2019 05:13:14 -0700 (PDT) Received: from jimi (bzq-82-81-225-244.cablep.bezeqint.net. [82.81.225.244]) by smtp.gmail.com with ESMTPSA id d193sm2995178wmd.0.2019.10.16.05.13.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2019 05:13:14 -0700 (PDT) Date: Wed, 16 Oct 2019 15:13:07 +0300 From: Eyal Birger To: Zhiyuan Hou Cc: Cong Wang , Jamal Hadi Salim , Jiri Pirko , "David S . Miller" , Linux Kernel Network Developers , LKML , shmulik.ladkani@gmail.com Subject: Re: [PATCH net] net: sched: act_mirred: drop skb's dst_entry in ingress redirection Message-ID: <20191016151307.40f63896@jimi> In-Reply-To: References: <20191012071620.8595-1-zhiyuan2048@linux.alibaba.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Wed, 16 Oct 2019 01:22:01 +0800 Zhiyuan Hou wrote: > On 2019/10/15 1:57 =E4=B8=8A=E5=8D=88, Cong Wang wrote: > > On Sat, Oct 12, 2019 at 12:16 AM Zhiyuan Hou > > wrote: =20 > >> 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 =3D dev_queue_xmit(skb2); > >> - else > >> + else { > >> + skb_dst_drop(skb2); > >> err =3D netif_receive_skb(skb2); > >> + } =20 > > Good catch! Indeed! Thanks for fixing this! > > > > I don't want to be picky, but it seems this is only needed > > when redirecting from egress to ingress, right? That is, > > ingress to ingress, or ingress to egress is okay? If not, > > please fix all the cases while you are on it? =20 > Sure. But I think this patch is also needed when redirecting from > ingress to ingress. Because we cannot assure that a skb has null dst > in ingress redirection path. For example, if redirecting a skb from > loopback's ingress to other device's ingress, the skb will take a > dst. >=20 > As commit logs point out, skb with valid dst cannot be made routing > decision in following process. original dst may cause skb loss or > other unexpected behavior. On the other hand, removing the dst on ingress-to-ingress redirection may remove LWT information on incoming packets, which may be undesired. Eyal.