From: Jakub Kicinski <kuba@kernel.org>
To: Mathias Lark <mathiaslark@gmail.com>
Cc: davem@davemloft.net, yoshfuji@linux-ipv6.org, dsahern@kernel.org,
pabeni@redhat.com, pablo@netfilter.org, kadlec@netfilter.org,
fw@strlen.de, netdev@vger.kernel.org,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org
Subject: Re: [PATCH net-next] improve handling of ICMP_EXT_ECHO icmp type
Date: Thu, 14 Jul 2022 21:51:32 -0700 [thread overview]
Message-ID: <20220714215132.058a1d4e@kernel.org> (raw)
In-Reply-To: <20220714151358.GA16615@debian>
On Thu, 14 Jul 2022 17:13:58 +0200 Mathias Lark wrote:
> Introduce a helper for icmp type checking - icmp_is_valid_type.
>
> There is a number of code paths handling ICMP packets. To check
> icmp type validity, some of those code paths perform the check
> `type <= NR_ICMP_TYPES`. Since the introduction of ICMP_EXT_ECHO
> and ICMP_EXT_ECHOREPLY (RFC 8335), this check is no longer correct.
>
> To fix this inconsistency and avoid further problems with future
> ICMP types, the patch inserts the icmp_is_valid_type helper
> wherever it is required.
Would be good to note in the commit message why we can't bump
NR_ICMP_TYPES to include all the types. What are the types between
18 and 42?
> diff --git a/include/uapi/linux/icmp.h b/include/uapi/linux/icmp.h
> index 163c0998aec9..ad736a24f0c8 100644
> --- a/include/uapi/linux/icmp.h
> +++ b/include/uapi/linux/icmp.h
> @@ -159,4 +159,9 @@ struct icmp_ext_echo_iio {
> } addr;
> } ident;
> };
> +
> +static inline bool icmp_is_valid_type(__u8 type)
> +{
> + return type <= NR_ICMP_TYPES || type == ICMP_EXT_ECHO || type == ICMP_EXT_ECHOREPLY;
> +}
This doesn't look related to uAPI, include/linux/icmp.h or
include/net/icmp.h seems like a better place for it.
next prev parent reply other threads:[~2022-07-15 4:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-14 15:13 [PATCH net-next] improve handling of ICMP_EXT_ECHO icmp type Mathias Lark
2022-07-15 4:51 ` Jakub Kicinski [this message]
2022-07-15 21:35 ` kernel test robot
2022-07-17 3:06 ` kernel test robot
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=20220714215132.058a1d4e@kernel.org \
--to=kuba@kernel.org \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=fw@strlen.de \
--cc=kadlec@netfilter.org \
--cc=mathiaslark@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.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).