netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rick van Rein <rick@openfortress.nl>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: Extensions for ICMP[6] with sport, dport
Date: Tue, 09 Jun 2020 12:46:18 +0200	[thread overview]
Message-ID: <5EDF687A.6020801@openfortress.nl> (raw)
In-Reply-To: <20200609094159.GA21317@breakpoint.cc>

Hey Florian,

You are generalising ICMP matching to tunnel matching, and then conclude that it is quite complex.

Yes, there is some overlap, but ICMP is also quite different:

 - Encapsulated traffic travels in reverse compared to a tunnel
 - ICMP-contained content must be NAT-reversed, unlike tunnel content
 - ICMP carries cut-off headers: IP header + 8 bytes of its payload
 - In practice, the contents of interest would be ip|ip6 and th
 - References "icmp ip" and "icmp th" are simple-yet-enough
 - General tunnel logic may be less efficient?

I originally proposed to treat ICMP as a side-case to TCP et al, but that won't fly.  There's also an embedded saddr/daddr pair to be treated.  This also means that the silent reversal of sport/dport is not needed, which is a relief.

> I think instead of this specific use case it would be preferrable to
> tackle this in a more general way, via more generic "ip - in foo"
> matching.

Given the differences above, do you still think so?

I would argue that these provide (not 100% hard) reasons to treat ICMP differently from tunnels.  Possibly syntaxes, in line with what "nft" does now, could say things like

ip protocol icmp
icmp protocol { tcp, udp, sctp, dccp }
icmp th daddr set
   icmp th dport map @my-nat-map

This looks like an extension of the nft command, under my assumption that it computes fixed offsets.  There may be more trouble with two-variable comparisons, which would cover paranoid checks like

icmp daddr = saddr
icmp saddr = daddr
icmp th dport = sport
icmp th sport = dport


If this ends up being kernel work, then I'm afraid I will have to let go.


Thanks,
 -Rick

  reply	other threads:[~2020-06-09 10:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-08 17:31 Extensions for ICMP[6] with sport, dport Rick van Rein
2020-06-09  4:53 ` Duncan Roe
2020-06-09  9:41 ` Florian Westphal
2020-06-09 10:46   ` Rick van Rein [this message]
2020-06-12 16:34     ` Florian Westphal
2020-06-12 18:42       ` Rick van Rein

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=5EDF687A.6020801@openfortress.nl \
    --to=rick@openfortress.nl \
    --cc=fw@strlen.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).