From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Georg Kohmann <geokohma@cisco.com>
Cc: netdev@vger.kernel.org, kadlec@netfilter.org, fw@strlen.de,
davem@davemloft.net, kuznet@ms2.inr.ac.ru,
yoshfuji@linux-ipv6.org, kuba@kernel.org,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org
Subject: Re: [PATCH net v4] ipv6/netfilter: Discard first fragment not including all headers
Date: Sun, 15 Nov 2020 12:15:20 +0100 [thread overview]
Message-ID: <20201115111520.GA24052@salvia> (raw)
In-Reply-To: <20201111115025.28879-1-geokohma@cisco.com>
On Wed, Nov 11, 2020 at 12:50:25PM +0100, Georg Kohmann wrote:
> Packets are processed even though the first fragment don't include all
> headers through the upper layer header. This breaks TAHI IPv6 Core
> Conformance Test v6LC.1.3.6.
>
> Referring to RFC8200 SECTION 4.5: "If the first fragment does not include
> all headers through an Upper-Layer header, then that fragment should be
> discarded and an ICMP Parameter Problem, Code 3, message should be sent to
> the source of the fragment, with the Pointer field set to zero."
>
> The fragment needs to be validated the same way it is done in
> commit 2efdaaaf883a ("IPv6: reply ICMP error if the first fragment don't
> include all headers") for ipv6. Wrap the validation into a common function,
> ipv6_frag_thdr_truncated() to check for truncation in the upper layer
> header. This validation does not fullfill all aspects of RFC 8200,
> section 4.5, but is at the moment sufficient to pass mentioned TAHI test.
>
> In netfilter, utilize the fragment offset returned by find_prev_fhdr() to
> let ipv6_frag_thdr_truncated() start it's traverse from the fragment
> header.
>
> Return 0 to drop the fragment in the netfilter. This is the same behaviour
> as used on other protocol errors in this function, e.g. when
> nf_ct_frag6_queue() returns -EPROTO. The Fragment will later be picked up
> by ipv6_frag_rcv() in reassembly.c. ipv6_frag_rcv() will then send an
> appropriate ICMP Parameter Problem message back to the source.
>
> References commit 2efdaaaf883a ("IPv6: reply ICMP error if the first
> fragment don't include all headers")
>
> Signed-off-by: Georg Kohmann <geokohma@cisco.com>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
In case you would like to follow up with another patch for the IPv6
reassembly in netfilter.o
net/ipv6/netfilter/nf_conntrack_reasm.c uses pr_debug() everywhere.
net/ipv4/netfilter/nf_defrag_ipv4.c however uses ip_defrag() which is
updating IPSTATS_MIB_*, so IPv4 and IPv6 code behave differently with
regards to the stats.
It would be probably good to get them aligned, by replacing the
existing pr_debug() in the net/ipv6/netfilter/nf_conntrack_reasm.c
code by IPSTATS_MIB_*.
Thanks.
next prev parent reply other threads:[~2020-11-15 11:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-11 11:50 [PATCH net v4] ipv6/netfilter: Discard first fragment not including all headers Georg Kohmann
2020-11-14 18:57 ` Jakub Kicinski
2020-11-15 11:15 ` Pablo Neira Ayuso [this message]
2020-11-16 18:16 ` Jakub Kicinski
2020-11-18 18:16 ` Pablo Neira Ayuso
2020-11-18 22:57 ` Georg Kohmann (geokohma)
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=20201115111520.GA24052@salvia \
--to=pablo@netfilter.org \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=fw@strlen.de \
--cc=geokohma@cisco.com \
--cc=kadlec@netfilter.org \
--cc=kuba@kernel.org \
--cc=kuznet@ms2.inr.ac.ru \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.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).