netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Jan Engelhardt <jengelh@inai.de>
Cc: netfilter-devel@vger.kernel.org, Amelia Downs <adowns@vmware.com>
Subject: Re: [iptables PATCH 1/3] extensions: libipt_icmp: Fix confusion between 255/255 and any
Date: Thu, 3 Aug 2023 14:57:38 +0200	[thread overview]
Message-ID: <ZMukQr8GYFVLyAGa@orbyte.nwl.cc> (raw)
In-Reply-To: <s4402816-ros7-qqoq-73r0-147po5s5862p@vanv.qr>

On Wed, Aug 02, 2023 at 10:31:16AM +0200, Jan Engelhardt wrote:
> On Wednesday 2023-08-02 04:05, Phil Sutter wrote:
> >
> >It is not entirely clear what the fixed commit was trying to establish,
> >but the save output is certainly not correct (especially since print
> >callback gets things right).
> >
> >Fixes: fc9237da4e845 ("Fix '-p icmp -m icmp' issue (Closes: #37)")
> 
> """(libipt_icmp.c):
>  * Up to kernel <=2.4.20 the problem was:
>  * '-p icmp ' matches all icmp packets
>  * '-p icmp -m icmp' matches _only_ ICMP type 0 :(
>  * This is now fixed by initializing the field * to icmp type 0xFF
> """
> 
> But also:
> 
> v1.2.7a-35-gfc9237da missed touching *libip6t_icmp6.c*, so
> it was never updated with the same "bug".
> 
> In icmp6, --icmpv6-type was (and still is to this date) mandatory, which means
> `-p icmp6 -m icmp6` would *not* implicitly go match ICMP(v6) type 0 like its
> IPv4 counterpart.
> 
> Then, in v1.4.10-115-g1b8db4f4, libipt_icmp.c more or less accidentally gained
> XTOPT_MAND (possible spill from IPv6 code), therefore `-p icmp -m icmp` would
> also stop implicitly doing ICMP type "any".

Thanks for the forensics.

One could extend icmp6 match (in kernel and user space) to support this
"any" type, though it seems not guaranteed the value 255 won't be used
for a real message at some point. So a proper solution was to support type
ranges like ebtables does. Then "any" type is 0:255/0:255.

Apart from the above, the three patches of this series should be fine,
right?

Thanks, Phil

  reply	other threads:[~2023-08-03 12:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-02  2:05 [iptables PATCH 1/3] extensions: libipt_icmp: Fix confusion between 255/255 and any Phil Sutter
2023-08-02  2:05 ` [iptables PATCH 2/3] extensions: libipt_icmp: --icmp-type is not mandatory Phil Sutter
2023-08-02  2:05 ` [iptables PATCH 3/3] tests: libipt_icmp.t: Enable tests with numeric output Phil Sutter
2023-08-02  8:31 ` [iptables PATCH 1/3] extensions: libipt_icmp: Fix confusion between 255/255 and any Jan Engelhardt
2023-08-03 12:57   ` Phil Sutter [this message]
2023-08-03 19:38     ` Jan Engelhardt
2023-08-04 13:56       ` Phil Sutter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZMukQr8GYFVLyAGa@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --cc=adowns@vmware.com \
    --cc=jengelh@inai.de \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).