From: David Miller <davem@davemloft.net>
To: willemdebruijn.kernel@gmail.com
Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com,
tom@herbertland.com, willemb@google.com
Subject: Re: [PATCH net-next v2] icmp: support rfc 4884
Date: Sun, 19 Jul 2020 19:20:38 -0700 (PDT) [thread overview]
Message-ID: <20200719.192038.2300519017333591083.davem@davemloft.net> (raw)
In-Reply-To: <20200710132902.1957784-1-willemdebruijn.kernel@gmail.com>
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: Fri, 10 Jul 2020 09:29:02 -0400
> From: Willem de Bruijn <willemb@google.com>
>
> Add setsockopt SOL_IP/IP_RECVERR_4884 to return the offset to an
> extension struct if present.
>
> ICMP messages may include an extension structure after the original
> datagram. RFC 4884 standardized this behavior. It stores the offset
> in words to the extension header in u8 icmphdr.un.reserved[1].
>
> The field is valid only for ICMP types destination unreachable, time
> exceeded and parameter problem, if length is at least 128 bytes and
> entire packet does not exceed 576 bytes.
>
> Return the offset to the start of the extension struct when reading an
> ICMP error from the error queue, if it matches the above constraints.
>
> Do not return the raw u8 field. Return the offset from the start of
> the user buffer, in bytes. The kernel does not return the network and
> transport headers, so subtract those.
>
> Also validate the headers. Return the offset regardless of validation,
> as an invalid extension must still not be misinterpreted as part of
> the original datagram. Note that !invalid does not imply valid. If
> the extension version does not match, no validation can take place,
> for instance.
>
> For backward compatibility, make this optional, set by setsockopt
> SOL_IP/IP_RECVERR_RFC4884. For API example and feature test, see
> github.com/wdebruij/kerneltools/blob/master/tests/recv_icmp_v2.c
>
> For forward compatibility, reserve only setsockopt value 1, leaving
> other bits for additional icmp extensions.
>
> Changes
> v1->v2:
> - convert word offset to byte offset from start of user buffer
> - return in ee_data as u8 may be insufficient
> - define extension struct and object header structs
> - return len only if constraints met
> - if returning len, also validate
>
> Signed-off-by: Willem de Bruijn <willemb@google.com>
Applied, thanks Willem.
prev parent reply other threads:[~2020-07-20 2:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-10 13:29 [PATCH net-next v2] icmp: support rfc 4884 Willem de Bruijn
2020-07-16 14:09 ` Willem de Bruijn
2020-07-20 2:20 ` David Miller [this message]
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=20200719.192038.2300519017333591083.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=tom@herbertland.com \
--cc=willemb@google.com \
--cc=willemdebruijn.kernel@gmail.com \
/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).