Re: [PATCH v7 net-next 1/9] net: bridge: add locked entry fdb flag to extend locked port feature

From: Ido Schimmel
Date: Thu Oct 13 2022 - 08:41:30 EST


On Sun, Oct 09, 2022 at 07:40:44PM +0200, Hans J. Schultz wrote:
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 74864dc46a7e..8008ceb45605 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -4035,6 +4035,7 @@ int ndo_dflt_fdb_add(struct ndmsg *ndm,
> const unsigned char *addr, u16 vid,
> u16 flags)
> {
> + __u32 ext_flags = 0;
> int err = -EINVAL;
>
> /* If aging addresses are supported device will need to
> @@ -4050,6 +4051,14 @@ int ndo_dflt_fdb_add(struct ndmsg *ndm,
> return err;
> }
>
> + if (tb[NDA_FLAGS_EXT])
> + ext_flags = nla_get_u32(tb[NDA_FLAGS_EXT]);
> +
> + if (ext_flags & NTF_EXT_LOCKED) {
> + netdev_info(dev, "invalid flags given to default FDB implementation\n");
> + return err;
> + }

I'm not sure it makes sense to deny specific flags in this case. It
might be better to just error out if NDA_FLAGS_EXT was specified.

> +
> if (is_unicast_ether_addr(addr) || is_link_local_ether_addr(addr))
> err = dev_uc_add_excl(dev, addr);
> else if (is_multicast_ether_addr(addr))
> --
> 2.34.1
>