Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1907705ybg; Thu, 24 Oct 2019 01:53:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMFfHq/EfHzG11B0QwkzL1+WAtNAZALKYWeJYdctJHX3xQM1AhP6ehCyKVO4RZSFb6zewO X-Received: by 2002:a17:907:366:: with SMTP id rs6mr36379689ejb.232.1571907189277; Thu, 24 Oct 2019 01:53:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571907189; cv=none; d=google.com; s=arc-20160816; b=0LlNyYULlVP97KhyFwo4ypG/M15ZSM5hUQ/q6IcSwIg50bl3cs6jLmBTZS+U9d26RO Ak0YxCwilzDFX/eiqXoarHFp9FK/bHlUOYkEJZjuZrxOUhQEPUw0wPavHtS85kzYZi+w BUnH31jbqNuaGV4bjjz7qpTMyyEJCAh4MsCUhjXyfhefDar1xk1s5pArseuewHj6hJFz pSv1isCSgCJ1kSVy3EMwvm3TQVNHhSY9SWXTnnA952eGzO96jU6HvsiCVuLkv2j5g6oc rxraRS8+ZzavZ1oB4AAZpPcSgz+Fd67dCD180ou+3nBYzkqMZmgeB+T4oGNhzuS4gjlu K+XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=MR7X5cmUMbAGyhVMpKWag4LE423qdgpRZ6IdJUs55wA=; b=Wpxl1FYsFB2irx/2TBu+G4d0PoqBTs7SwNU5lrAm23MlsbsOFNTPj+tnrkXngRbU7u ySovfentO6GSWw1oX6hkwZtSnVR+PXIkoWi3bdxGKzmldwd6fFJgxw8tUXFjNGDLMlJ9 58O+Qa2wgbsRhwYHzbDPvDCxBuCC24X27ogXhWBdDiULrchX7ZpGHn5GjiUrrWBZkxCd 2tVvGGp8gMBhDr3Ah4s5YqvtalPakaAtS8js5MrLh51QjjZdPIEqtisUw4buQlMmM9YI GG2pSmWMc5Yhvvn/QUiKk/LJzKBHjLUiVnTxte1+DeUjGjRlHiN28mMsvgfClko7+zs3 iDSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=uqhMc1a6; 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 8si15639630ejc.104.2019.10.24.01.52.44; Thu, 24 Oct 2019 01:53:09 -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=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=uqhMc1a6; 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 S1732389AbfJWRz3 (ORCPT + 99 others); Wed, 23 Oct 2019 13:55:29 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:39644 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731858AbfJWRz2 (ORCPT ); Wed, 23 Oct 2019 13:55:28 -0400 Received: by mail-wm1-f65.google.com with SMTP id r141so10942862wme.4 for ; Wed, 23 Oct 2019 10:55:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=MR7X5cmUMbAGyhVMpKWag4LE423qdgpRZ6IdJUs55wA=; b=uqhMc1a63bKmXWyKOABmgVPjW27vGN/zwMb4NXvxGYn8/VE1uX8grEqp+Pbe2qAV0J Zcns/FJwXGsNA120ov9re2KZ9YWZg8keiacR8VdO+UOiaT1H0jsFBFBQDJPe2Zs1crIf W4yZYqvXGMh9tSyG7k0JuSX0mQrcrncOl06PjDp51eMJwzVB1InHOHOrHZbuJnXIREVp crB+33+IwqGkJPQSqVZ3MS+yG13myXzL4cZWEV3+xOp/9lXXCctFoNLQ1C4L56Lsegfu YwryuamkB61A0u50IbQhGE5SKKUChBnZCnmvDvXETWJlBuvoEWbNdc4VcKVN2m4750yn lADQ== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=MR7X5cmUMbAGyhVMpKWag4LE423qdgpRZ6IdJUs55wA=; b=frePQPLLhH8Qepj+a+JBomD3guWcz1uShaHiS1IU0FupB8mnZaAgo97VrNUPCeZRW9 /KS+1k0iMOVcaSWF0aO08WK0H9F8L06jVAAaQu7XoIRDVNDvzZ4kUhENRMImK4IrqSmh x2qlcxTtiySWmFeI7wkK3GWzrF/BdWKkP+BfUBxS+h/bUyLMnp8lHAUAuyvU+ABezT3D TERdfjFZWsd4BA7og2IwUp++sUUIrTcYUrj5DiNvmD2g5eEC0TDb6lM4gat6GcjQ+Drl WgTPSQ++pFCVLuSvwNFxEWHLVzzoZuQpxkBj68nVJ9Cy/W/PA1tAaP8mHxVZC36Gjjam DHtw== X-Gm-Message-State: APjAAAWtnE/cMJfJe8LHWdp6+eVSJCjSx79VvvWSi92QaCu7DuhgxnYi c/0qyLJhqosQ7wq1FeB2LMb1jA== X-Received: by 2002:a1c:dd06:: with SMTP id u6mr1069919wmg.109.1571853326343; Wed, 23 Oct 2019 10:55:26 -0700 (PDT) Received: from netronome.com (fred-musen.rivierenbuurt.horms.nl. [2001:470:7eb3:404:a2a4:c5ff:fe4c:9ce9]) by smtp.gmail.com with ESMTPSA id d8sm9238615wrr.71.2019.10.23.10.55.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 10:55:25 -0700 (PDT) Date: Wed, 23 Oct 2019 19:55:23 +0200 From: Simon Horman To: Matteo Croce Cc: netdev , Jay Vosburgh , Veaceslav Falico , Andy Gospodarek , "David S . Miller" , Stanislav Fomichev , Daniel Borkmann , Song Liu , Alexei Starovoitov , Paul Blakey , LKML Subject: Re: [PATCH net-next 3/4] flow_dissector: extract more ICMP information Message-ID: <20191023175522.GB28355@netronome.com> References: <20191021200948.23775-1-mcroce@redhat.com> <20191021200948.23775-4-mcroce@redhat.com> <20191023100009.GC8732@netronome.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 23, 2019 at 12:53:37PM +0200, Matteo Croce wrote: > On Wed, Oct 23, 2019 at 12:00 PM Simon Horman > wrote: > > On Mon, Oct 21, 2019 at 10:09:47PM +0200, Matteo Croce wrote: > > > + switch (ih->type) { > > > + case ICMP_ECHO: > > > + case ICMP_ECHOREPLY: > > > + case ICMP_TIMESTAMP: > > > + case ICMP_TIMESTAMPREPLY: > > > + case ICMPV6_ECHO_REQUEST: > > > + case ICMPV6_ECHO_REPLY: > > > + /* As we use 0 to signal that the Id field is not present, > > > + * avoid confusion with packets without such field > > > + */ > > > + key_icmp->id = ih->un.echo.id ? : 1; > > > > Its not obvious to me why the kernel should treat id-zero as a special > > value if it is not special on the wire. > > > > Perhaps a caller who needs to know if the id is present can > > check the ICMP type as this code does, say using a helper. > > > > Hi, > > The problem is that the 0-0 Type-Code pair identifies the echo replies. > So instead of adding a bool is_present value I hardcoded the info in > the ID field making it always non null, at the expense of a possible > collision, which is harmless. Sorry, I feel that I'm missing something here. My reading of the code above is that for the cased types above (echo, echo reply, ...) the id is present. Otherwise it is not. My idea would be to put a check for those types in a helper. I do agree that the override you have used is harmless enough in the context of the only user of the id which appears in the following patch of this series. Some other things I noticed in this patch on a second pass: * I think you can remove the icmp field from struct flow_dissector_key_ports * I think that adding icmp to struct flow_keys should be accompanied by adding ICMP to flow_keys_dissector_symmetric_keys. But I think this is not desirable outside of the bonding use-case and rather the bonding driver should define its own structures that includes the keys it needs - basically copies of struct flow_keys and flow_keys_dissector_symmetric_keys with some modifications. * Modifying flow_keys_have_l4 affects the behaviour of skb_get_hash_flowi6() but there is not a corresponding update to flow_keys_have_l4(). I didn't look at all the other call sites but it strikes me that this is a) a wide-spread behavioural change and b) is perhaps not required for the bond-use case.