Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1780390ybg; Sat, 19 Oct 2019 02:21:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqwEGVVqWH9VVUO+Dy8mgwHpPqB0GHJOssbsNUAr1r9XhCaCYLbkEKHhBj9ksHhPsitfQMh0 X-Received: by 2002:aa7:c24d:: with SMTP id y13mr14254737edo.186.1571476882658; Sat, 19 Oct 2019 02:21:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571476882; cv=none; d=google.com; s=arc-20160816; b=LL0IFmBvoRKUJF+u/4C9chjxNC2GFSWGrewlIjmvp3j37noLzhyvQ5siKym2K8Hpkj 9hH82r4v/SFMJri+V+TJh9hStCeWZqvqETd3tQtUBPHYz9V8ZpkfcEPDT9ZZvB3lmM4v +q0O9KIJ2rrmTMZ2LdX1m09Pc3rG4va8iSVdU2tN/DVM0rcxRa3dyjzv5E9nO9mAv/22 qsV85pUUuwd7Wh2H3AH6v/QtnJXOjgfBePmEquFNCMyfaNAw2CmOIsIbrgoRR4FHQdb5 yALQttuMlAslmYsSZkNum9+JcDCVl06jLd6BBO84WxErHs+QF2jBl+9C+7ZMuUwdx4GV kr6g== 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=yZfAzIb/Kba55Aw+sHVK09/x4YWKV6syg8pmtZMsJ50=; b=Gv40Wbyn6/sI9a/Wz4sCMFvH4x3KLfjMFEFxfAtUGCBoPohvQVTJNfkXtG4vxnDLFy XQDat4a0SFlAClQ0B+ZMZV45I3uhb8DoVW9LFtyepTO+nxQ158vmdtEcNGn/u3s1b9rH nHOS+E3DgjHRrE++dTY4aoqC33WCzW02AklzVSQn50AdYqTNAee/WWbE/UcL6sPhRDJr Nsr4c/pIrT/r9HvOPM/Ucdu9UFMsSw/vALgSNiVYtI8Sl+wa+kszYzKf8xICvfbadJIT ij4FGCmYHhGtdzcNdQeMd8ZZug8Lgnh8GJV993RekpbiwTWKymWSUBEeF1d1VJ2prntS btVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iWYh2Nd0; 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 p18si5437831ejn.370.2019.10.19.02.20.58; Sat, 19 Oct 2019 02:21:22 -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=iWYh2Nd0; 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 S2440472AbfJRVZN (ORCPT + 99 others); Fri, 18 Oct 2019 17:25:13 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:37243 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727508AbfJRVZN (ORCPT ); Fri, 18 Oct 2019 17:25:13 -0400 Received: by mail-wm1-f65.google.com with SMTP id f22so7373663wmc.2; Fri, 18 Oct 2019 14:25:10 -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=yZfAzIb/Kba55Aw+sHVK09/x4YWKV6syg8pmtZMsJ50=; b=iWYh2Nd0eM/HeqF1v6SwZNakMYD+XJJS0R7WEABGsIvTS0U12VMb4Hk3oKkMK5BqB9 oNRweWnwMGVcURXallNaXSuhdW284JnhCX3GtezlOZCnlaJcZlxdmBHtuM1AywT8B64G ncMAmpyBemJRtB945SHX4Nd09pVpLJB1QroQvqfdzRduyXPLk7+woTUBFctpALyGfR1z qH5jTQGvwSPOP3Rxq+gNcFjM+z9N7veA5jqu/oG6cq1ZuboLCw8nz3QvsM5Q2YFRZE+R buUB1MFfEtNjaJ3sPBn3VprE5bUwWtJzT2nsCN5F4zrkaOvuSsYxpqzwcOsft93+NVtH OBdg== 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=yZfAzIb/Kba55Aw+sHVK09/x4YWKV6syg8pmtZMsJ50=; b=Cv4253a9aiYLzmsH5kGQ7LQCrSquORduTavKPOflolwLu+m3fg0HseQarO/H20FwRy 8O6QeHtrgL7oRFFZKu60OQrKXAB37vhLfaI44WSAxhkIGM+Q+zDja7goDERXpetRjSit HKRdnaY2ebxNV2dcXnEhc0pt+CC+U1y3x3TWCLyno7wWVn97rs3ZJtoV+u05rLgryo1e 6JfqJPHHXFPZrc9jqNH98XaI0VRsoGzZ8HWwXVEzPaE6wWYGyM6vILyORruzgHF0I7nV RjbMLUgkcPnwV/4U0yzqa2uyfT5NrDralvgM6jadPw7k+6COCiq075muZ84VKfTB5lTt SlZA== X-Gm-Message-State: APjAAAVoZ0I7NBnKkT8p1rNOSOSIcyMgfBESDyrXXW8gskcmnfxR745e s72Zw7J4Bw1Tw35M3usG9Uo= X-Received: by 2002:a05:600c:29a:: with SMTP id 26mr9887170wmk.127.1571433909253; Fri, 18 Oct 2019 14:25:09 -0700 (PDT) Received: from jimi ([77.138.210.146]) by smtp.gmail.com with ESMTPSA id r2sm6461653wrm.3.2019.10.18.14.25.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 14:25:08 -0700 (PDT) Date: Sat, 19 Oct 2019 00:25:02 +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: <20191019002502.0519ea9b@jimi> In-Reply-To: References: <20191012071620.8595-1-zhiyuan2048@linux.alibaba.com> <20191016151307.40f63896@jimi> 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 Fri, 18 Oct 2019 00:33:53 +0800 Zhiyuan Hou wrote: > On 2019/10/16 8:13 =E4=B8=8B=E5=8D=88, Eyal Birger wrote: > > Hi, > > > > On Wed, 16 Oct 2019 01:22:01 +0800 > > Zhiyuan Hou wrote: > > =20 > >> On 2019/10/15 1:57 =E4=B8=8A=E5=8D=88, Cong Wang wrote: =20 > >>> 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! =20 > > Indeed! Thanks for fixing this! > > =20 > >>> 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. > >> > >> 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. =20 > > On the other hand, removing the dst on ingress-to-ingress > > redirection may remove LWT information on incoming packets, which > > may be undesired. =20 > Sorry, I do not understand why lwt information is needed on > ingress-to-ingress redirection. lwt is used on output path, isn't it? > Can you please give more information? On rx path tunnelled packets parameters received on a collect_md tunnel dev= ice are kept in a metadata dst. See ip_tunnel_rcv() 'tun_dst' parameter. The rx metadata dst can be matched by a number of mechanisms like routing rules, eBPF, OVS, and netfilter. Eyal.