On Wed, Oct 23, 2019 at 12:00 PM Simon Horman <simon.hor...@netronome.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