net: ipv6: support reporting otherwise unknown prefix flags in RTM_NEWPREFIX
authorMaciej Żenczykowski <maze@google.com>
Wed, 6 Dec 2023 17:36:12 +0000 (09:36 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Dec 2023 16:01:45 +0000 (17:01 +0100)
commit92d813f73f649a32cb936583030c2edcc309eb37
tree14088b9068f56ba646c1697b6c6648e80df43f92
parent6cb39c79bca9ed05ba9b33083a6f09211d79f05e
net: ipv6: support reporting otherwise unknown prefix flags in RTM_NEWPREFIX

[ Upstream commit bd4a816752bab609dd6d65ae021387beb9e2ddbd ]

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: David Ahern <dsahern@kernel.org>
Cc: Lorenzo Colitti <lorenzo@google.com>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/net/addrconf.h
include/net/if_inet6.h
net/ipv6/addrconf.c