Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2561368ybp; Sat, 12 Oct 2019 12:36:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqyRN5SJ75jm3icA4IUSR34/1gdZ5XD1v3CVkheeDnTGQBPfBw0Jk0TOjOckHdZlKsZvF3lT X-Received: by 2002:a50:ed05:: with SMTP id j5mr20074932eds.251.1570908992783; Sat, 12 Oct 2019 12:36:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570908992; cv=none; d=google.com; s=arc-20160816; b=yVmA4G2Ad5vSfgByqLjqLFHSFBPAuMx0rf5x5B3IAraHejA5XTSxyP23wKRU6yBHPH PYdeY/LezVPUVWsNJWsr2/HycYCeba6B9Vf/wQrknDyG6WKr1P79V4BQK/Lq1XLS8w+L DN9aQ3Zldo73pbg7HW2wGwAA/YYQSDCV3hAN/oJJVEEGOhhFguOnkQKR4w/cB+YVzJNh TJXbGS0EK1WylQk+ClhgSMAywC1T8VENbWKJF66K1adFr1oimg4En3Apf0JASdKlPJpk 4hLplWzsBMCd9ni3qCLTOGL44ywT8diOdv5urq5Oxo/Ly20iDfeHV5N/6ZOQVoCfSEd4 1wQw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :dkim-signature; bh=wgrBphK2ZKLKLKQJBxJ+04hzcg40mP5P57Sgt0XI3AI=; b=O/cteazevAgVRoI72dqqOSvZfyOQTQSzlUu57K+VKBoTvP3me2s1x1kCcOWROiS4Lm Aixqo+JVtFRo6fMqa0gc1F6uTjwWyjJpaFes7d+vH0COYjXmAGFRtNn6aYgsGHvJTo7d uSgg5hLIlGj/a6AkZrDV7Q+pcP3Q1O0U7u4cPfbQZ3DTH6x+SmU8S2VxsdQ6zQyoYWvQ ilpx9c3SGkPVc6V55bbv3DqRN7Xw6WaKTXzk4lCjqWLPahTCQBCuQ7LgIdGrZn4Kshbs 7w1egJ5i6WpcYz8msmlhjne4ezcMmjmzdKZMQ6Dzz15vwVm2xcNQSTPyDc7a0g97723P AihA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cogentembedded-com.20150623.gappssmtp.com header.s=20150623 header.b=F4fTfDBg; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id os6si7706521ejb.224.2019.10.12.12.36.07; Sat, 12 Oct 2019 12:36:32 -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=@cogentembedded-com.20150623.gappssmtp.com header.s=20150623 header.b=F4fTfDBg; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729594AbfJLTe5 (ORCPT + 99 others); Sat, 12 Oct 2019 15:34:57 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:38201 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729432AbfJLTe4 (ORCPT ); Sat, 12 Oct 2019 15:34:56 -0400 Received: by mail-lj1-f196.google.com with SMTP id b20so12926934ljj.5 for ; Sat, 12 Oct 2019 12:34:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:organization:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=wgrBphK2ZKLKLKQJBxJ+04hzcg40mP5P57Sgt0XI3AI=; b=F4fTfDBgS2eid7oSFip/FDEDfPXrx4FrxGQxqvEl6QMaNqZR+i+EZqafXAthP5P9+x yHDghCUdv3wc8EPxs/921ZARMAob8jyZMCrTSv0zK99uzKHDGI8lw/wBsKCd17vOs5fB rUJsYkHvgyQ4O+KQlKvYeWoUVRTtnYMV1MlGJD97zCMfaEMG9XKwULB/glNYZpP06Wnv JjMCb4X+FZWgQRRmLr3t4MvFWuS0hGzksJJ8e9Ubv7NGr8M4YDefwzP6AcY0TZ2fj5Io 0GjbMofkS1RYHQNwGyRtHqTtYj9UuTHx+IUHTuF1vjhdUF74ZGYN6abZhYWqg/cwvttF nt1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=wgrBphK2ZKLKLKQJBxJ+04hzcg40mP5P57Sgt0XI3AI=; b=VcDJaoIE0Bgqw4TGATeEOKAYG/n6g7UIICH8pMpmY/Kegvp7qhB7u78OaTy4fy8R3H 5HyfufRcW390TzVgPkQhqQDqX2AiemfvWOw9Qc05fTfDDJthBv5M9w1qAOtecz8qrBzH wTc7NQzz/FNIOogZt1sUlDt0BSgqTtymimlrz+ZvyX27YkEcmv5shdXuyPYjrpQsrZUl 3Q48ekrpjHkg4DWlZrW+GEgLbHt0sHlyo2N2v0jMqH6MaXIUgCCwgHySVGGX0RA/rZO6 qMgq0tm4mj+PuFsHfKgYtqRjN9ZVDyELSS21qJJk9Gp6kWQuIRDnE76W55ctZ+O1APNz CfOg== X-Gm-Message-State: APjAAAXyyxWs84RQCLvEekP2KsGnj9923Ew6uP81NacXHildJ2JUdiz2 N3kkeVSUWzmx5f8OgD2t/gFsl0H7Sbc= X-Received: by 2002:a05:651c:1213:: with SMTP id i19mr6593579lja.19.1570908892385; Sat, 12 Oct 2019 12:34:52 -0700 (PDT) Received: from wasted.cogentembedded.com ([2a00:1fa0:42ce:cb54:d810:b267:5380:ba01]) by smtp.gmail.com with ESMTPSA id g21sm2991604lje.67.2019.10.12.12.34.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Oct 2019 12:34:51 -0700 (PDT) Subject: Re: [PATCH net] net: sched: act_mirred: drop skb's dst_entry in ingress redirection To: Zhiyuan Hou , 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> From: Sergei Shtylyov Organization: Cogent Embedded Message-ID: <2ad15b96-156d-7b71-0e37-74ceeacade35@cogentembedded.com> Date: Sat, 12 Oct 2019 22:34:50 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20191012071620.8595-1-zhiyuan2048@linux.alibaba.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-MW Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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