[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGnkfhxg1sXkmiNS-+H184omQaKbp_+_Sy7Vi-9W9qLwGGPU6g@mail.gmail.com>
Date: Wed, 23 Oct 2019 12:53:37 +0200
From: Matteo Croce <mcroce@...hat.com>
To: Simon Horman <simon.horman@...ronome.com>
Cc: netdev <netdev@...r.kernel.org>,
Jay Vosburgh <j.vosburgh@...il.com>,
Veaceslav Falico <vfalico@...il.com>,
Andy Gospodarek <andy@...yhouse.net>,
"David S . Miller" <davem@...emloft.net>,
Stanislav Fomichev <sdf@...gle.com>,
Daniel Borkmann <daniel@...earbox.net>,
Song Liu <songliubraving@...com>,
Alexei Starovoitov <ast@...nel.org>,
Paul Blakey <paulb@...lanox.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next 3/4] flow_dissector: extract more ICMP information
On Wed, Oct 23, 2019 at 12:00 PM Simon Horman
<simon.horman@...ronome.com> 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.
--
Matteo Croce
per aspera ad upstream
Powered by blists - more mailing lists