From: David Ahern <dsahern@gmail.com>
To: Andrea Mayer <andrea.mayer@uniroma2.it>,
"David S. Miller" <davem@davemloft.net>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
David Ahern <dsahern@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Cc: Colin Ian King <colin.king@canonical.com>,
Stefano Salsano <stefano.salsano@uniroma2.it>,
Paolo Lungaroni <paolo.lungaroni@cnit.it>,
Ahmed Abdelsalam <ahabdels.dev@gmail.com>
Subject: Re: [PATCH net-next v2] seg6: fool-proof the processing of SRv6 behavior attributes
Date: Sun, 7 Feb 2021 10:24:27 -0700 [thread overview]
Message-ID: <5c51d022-a374-500c-04ca-941a4f439fab@gmail.com> (raw)
In-Reply-To: <20210206170934.5982-1-andrea.mayer@uniroma2.it>
On 2/6/21 10:09 AM, Andrea Mayer wrote:
> The set of required attributes for a given SRv6 behavior is identified
> using a bitmap stored in an unsigned long, since the initial design of SRv6
> networking in Linux. Recently the same approach has been used for
> identifying the optional attributes.
>
> However, the number of attributes supported by SRv6 behaviors depends on
> the size of the unsigned long type which changes with the architecture.
> Indeed, on a 64-bit architecture, an SRv6 behavior can support up to 64
> attributes while on a 32-bit architecture it can support at most 32
> attributes.
>
> To fool-proof the processing of SRv6 behaviors we verify, at compile time,
> that the set of all supported SRv6 attributes can be encoded into a bitmap
> stored in an unsigned long. Otherwise, kernel build fails forcing
> developers to reconsider adding a new attribute or extend the total
> number of supported attributes by the SRv6 behaviors.
>
> Moreover, we replace all patterns (1 << i) with the macro SEG6_F_ATTR(i) in
> order to address potential overflow issues caused by 32-bit signed
> arithmetic.
>
> Thanks to Colin Ian King for catching the overflow problem, providing a
> solution and inspiring this patch.
> Thanks to Jakub Kicinski for his useful suggestions during the design of
> this patch.
>
> v2:
> - remove the SEG6_LOCAL_MAX_SUPP which is not strictly needed: it can
> be derived from the unsigned long type. Thanks to David Ahern for
> pointing it out.
>
> Signed-off-by: Andrea Mayer <andrea.mayer@uniroma2.it>
> ---
> net/ipv6/seg6_local.c | 67 +++++++++++++++++++++++++------------------
> 1 file changed, 39 insertions(+), 28 deletions(-)
>
Reviewed-by: David Ahern <dsahern@kernel.org>
next prev parent reply other threads:[~2021-02-07 17:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-06 17:09 [PATCH net-next v2] seg6: fool-proof the processing of SRv6 behavior attributes Andrea Mayer
2021-02-07 17:24 ` David Ahern [this message]
2021-02-08 21:30 ` patchwork-bot+netdevbpf
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=5c51d022-a374-500c-04ca-941a4f439fab@gmail.com \
--to=dsahern@gmail.com \
--cc=ahabdels.dev@gmail.com \
--cc=andrea.mayer@uniroma2.it \
--cc=colin.king@canonical.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=paolo.lungaroni@cnit.it \
--cc=stefano.salsano@uniroma2.it \
--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