Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp5460486ybg; Tue, 22 Oct 2019 03:41:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqwgdyTyB9wtsbiBfh+7rxUSmEVct8b+ewKm6HNENOAxtPRthG/aEkRsbDtrKXmwG6BBgfxf X-Received: by 2002:a17:906:c28c:: with SMTP id r12mr6209372ejz.163.1571740862215; Tue, 22 Oct 2019 03:41:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571740862; cv=none; d=google.com; s=arc-20160816; b=yIFaeoHgpDAMZdLjruvDdecSKqvEbkbIOyYseuLAtYXvyrNftKTctmhfadg+x/M2Ax 77+L6KWHW509wef/XQyEuiSLL2olTOJge2gzSHeQg2WXy5tWWlEgSZC7QJ5uOwEfBaiA 2hH9sTFxbvFr13+4ZqztDd8OZotyIBJ9aPgoe3pdUvPv0Re7uv14Eqhki4C16AClDkJC vg+wxJiTfjpXwtXWzPV/nR+qbDmdC/3oKeqArs5+npWxSj6S3myTPY/iQjgF7WekqQyN 3OG0+/d3lcYWlj/sqyQB1mPGw6Ni902lflRKjDD4dO7Y3Hf0W6X/ocLFqdltama/07Tm jlzA== 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=G9L4o2fClACAWWCNYsMy4DkWIxVH39P4nMmUu/kqsjM=; b=goJCg/Bim8+C77xMtrwayuHNXnQjHnP/prfa7QfU/Y2i2j8D5CexHxCBaGJk1PE5EM 2eFo9iuol1Fj4ftagHituN6Fz8e2q3uVcVx/UbUUI9eBQmTVMgSg/bwwId1YGvpvXE2/ LotkI2ygLF9DfVzXIqia1tjhMerSd9P8/tpI9DZ5GDaHHy+e2lqh8l/e46ners8g5yP7 LqBs4gxIQYA6BCnNO5bixuejY23qP9bI5ngTYau4ME/AM8HW7QgDxq0Y/VtGi0DPbjFH OwXdam9BJ1hWCwiiOo5AfBpX9SjV2dUd7Dn25AvMAYiHxt7VdEBOpHp7ObRIv/qoF1F3 cr6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=l5Ps+imA; 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 c60si11465871edd.327.2019.10.22.03.40.36; Tue, 22 Oct 2019 03:41:02 -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=l5Ps+imA; 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 S2388542AbfJVKht (ORCPT + 99 others); Tue, 22 Oct 2019 06:37:49 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:46445 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388327AbfJVKht (ORCPT ); Tue, 22 Oct 2019 06:37:49 -0400 Received: by mail-wr1-f65.google.com with SMTP id n15so6667581wrw.13; Tue, 22 Oct 2019 03:37:47 -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=G9L4o2fClACAWWCNYsMy4DkWIxVH39P4nMmUu/kqsjM=; b=l5Ps+imA913Yd2xTluwoQZv3So/ZE86l5oMm0JbXAvfSHnjgo7+UZUo0u7cV56O3Df mmQ2a8Pl0KzFyutA9BrkioQWWZTVY2zgqP8rqmsrvB/UVGH/TW98zOLQSJy+V07ECI5K YgXCavMlHTR60F1zJ5ObfJT2UUlJcJExmLcgGbEVnS3OosUuw6dTmSZZfckHSqV9JlSj LlcpbfHWIOyb6iC1bFYELchtgkVem8GaI36Zy0FP3yJ9gZQ9meH61ZuJTuhkhq8PRYwh DCzRs6cgQEmIXfSeZdNIW2ulfY7Uda1RxRze4Uet7XGezWU4ojZHqbCnaHiSLmyeT4Df 7m4A== 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=G9L4o2fClACAWWCNYsMy4DkWIxVH39P4nMmUu/kqsjM=; b=gjYlIdxEtdS0r7saZY0cr0Q79bPqDnfKa3dnVQzmpL28KD4Aa2DxJgm+Kg46fEMLkf xY58bhszHgG3wpA1Fx+hdQX1DMOtivWAcOBojp8h0TGBu5SHWtVZGcD+AscsFNvbM7Mr c/OxPrExmMAmmXm7kJJOgj9osATBs2Dk0rDl7Vgz8Fu51IN2vWqoQth4WZWNRBlwXx05 FU22LNucIHT2EQaxcoCWCSKpNOjN5mqr5WfEqVwzYlTUCleUF3dB4xd+YzonwZq9sAu8 7Xq7OEdjJfbnjiS+mrDyXQF/lFQNrD/Eb2dz27FgFexmex37YN8pDDM/mQQC7OW/Bwre sGhg== X-Gm-Message-State: APjAAAVfdYvKjfDq6vFH/a5tEMIwSTUFaz05oNVYOUWLayObanRjMSFI pxiWRaNXK6WbYBjEL4eBu/A= X-Received: by 2002:adf:ea50:: with SMTP id j16mr2743215wrn.295.1571740666041; Tue, 22 Oct 2019 03:37:46 -0700 (PDT) Received: from jimi (bzq-82-81-225-244.cablep.bezeqint.net. [82.81.225.244]) by smtp.gmail.com with ESMTPSA id g69sm5111253wme.31.2019.10.22.03.37.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 03:37:45 -0700 (PDT) Date: Tue, 22 Oct 2019 13:37:39 +0300 From: Eyal Birger To: Cong Wang Cc: Zhiyuan Hou , Jamal Hadi Salim , Jiri Pirko , "David S . Miller" , Linux Kernel Network Developers , LKML , Shmulik Ladkani Subject: Re: [PATCH net] net: sched: act_mirred: drop skb's dst_entry in ingress redirection Message-ID: <20191022133739.0f255bbe@jimi> In-Reply-To: References: <20191012071620.8595-1-zhiyuan2048@linux.alibaba.com> <20191016151307.40f63896@jimi> <20191019002502.0519ea9b@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 Mon, 21 Oct 2019 13:50:13 -0700 Cong Wang wrote: > On Fri, Oct 18, 2019 at 2:25 PM Eyal Birger > wrote: > > > > 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: > > > > > > > >> 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: > > > >>>> 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); > > > >>>> + } > > > >>> 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? > > > >> 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. > > > > On the other hand, removing the dst on ingress-to-ingress > > > > redirection may remove LWT information on incoming packets, > > > > which may be undesired. > > > 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 device 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. >=20 > Should this meta information be kept when redirecting? The dest device > may be a non-tunnel device, so I don't know if it is still useful when > for non-tunnel devices. I think that on ingress-to-ingress redirect it would make sense to keep the metadata. The dest device does not have to be a tunnel device AFAICT in order to use tunnel info as skb_tunnel_info() does not observe skb->dev. I don't see why going through mirred redirect should prevent the admin from matching the packet based on LWT metadata - a packet may arrive on a collec= t_md tunnel device, be ingress-redirected to different devices based on different criteria, then routed based also on the tunnel parameters. Eyal.