[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iKwwfUzh23+dwS5iUCy1vybQ17TqNFbuKc_D2V-RD-i4g@mail.gmail.com>
Date: Wed, 6 Dec 2023 15:17:58 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: Maciej Żenczykowski <maze@...gle.com>
Cc: Maciej Żenczykowski <zenczykowski@...il.com>,
Linux Network Development Mailing List <netdev@...r.kernel.org>, "David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Shirley Ma <mashirle@...ibm.com>,
David Ahern <dsahern@...nel.org>, Lorenzo Colitti <lorenzo@...gle.com>
Subject: Re: [PATCH net v2] net: ipv6: support reporting otherwise unknown
prefix flags in RTM_NEWPREFIX
On Wed, Dec 6, 2023 at 3:10 PM Maciej Żenczykowski <maze@...gle.com> wrote:
>
> Lorenzo points out that we effectively clear all unknown
> flags from PIO when copying them to userspace in the netlink
> RTM_NEWPREFIX notification.
>
> We could fix this one at a time as new flags are defined,
> or in one fell swoop - I choose the latter.
>
> We could either define 6 new reserved flags (reserved1..6) and handle
> them individually (and rename them as new flags are defined), or we
> could simply copy the entire unmodified byte over - I choose the latter.
>
> This unfortunately requires some anonymous union/struct magic,
> so we add a static assert on the struct size for a little extra safety.
>
> Cc: Shirley Ma <mashirle@...ibm.com>
> Cc: David Ahern <dsahern@...nel.org>
> Cc: Lorenzo Colitti <lorenzo@...gle.com>
> Fixes: 60872d54d963 ("[IPV6]: Add notification for MIB:ipv6Prefix events.")
> Signed-off-by: Maciej Żenczykowski <maze@...gle.com>
> ---
> include/net/addrconf.h | 12 ++++++++++--
> include/net/if_inet6.h | 4 ----
> net/ipv6/addrconf.c | 6 +-----
> 3 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/include/net/addrconf.h b/include/net/addrconf.h
> index 82da55101b5a..8e308c2662d7 100644
> --- a/include/net/addrconf.h
> +++ b/include/net/addrconf.h
> @@ -31,17 +31,22 @@ struct prefix_info {
> __u8 length;
> __u8 prefix_len;
>
> + union __attribute__((packed)) {
> + __u8 flags;
> + struct __attribute__((packed)) {
For non uapi, it is recommended to use __packed instead of
__attribute__((packed))
Powered by blists - more mailing lists