[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fdc3a288-c342-1c6d-4cf0-640bbfd44f56@blackwall.org>
Date: Mon, 25 Jul 2022 10:43:00 +0300
From: Nikolay Aleksandrov <razor@...ckwall.org>
To: Benjamin Poirier <bpoirier@...dia.com>, netdev@...r.kernel.org
Cc: Roopa Prabhu <roopa@...dia.com>,
Horatiu Vultur <horatiu.vultur@...rochip.com>,
Henrik Bjoernlund <henrik.bjoernlund@...rochip.com>,
bridge@...ts.linux-foundation.org, Ido Schimmel <idosch@...dia.com>
Subject: Re: [PATCH net] bridge: Do not send empty IFLA_AF_SPEC attribute
On 25/07/2022 03:12, Benjamin Poirier wrote:
> After commit b6c02ef54913 ("bridge: Netlink interface fix."),
> br_fill_ifinfo() started to send an empty IFLA_AF_SPEC attribute when a
> bridge vlan dump is requested but an interface does not have any vlans
> configured.
>
> iproute2 ignores such an empty attribute since commit b262a9becbcb
> ("bridge: Fix output with empty vlan lists") but older iproute2 versions as
> well as other utilities have their output changed by the cited kernel
> commit, resulting in failed test cases. Regardless, emitting an empty
> attribute is pointless and inefficient.
>
> Avoid this change by canceling the attribute if no AF_SPEC data was added.
>
> Fixes: b6c02ef54913 ("bridge: Netlink interface fix.")
> Reviewed-by: Ido Schimmel <idosch@...dia.com>
> Signed-off-by: Benjamin Poirier <bpoirier@...dia.com>
> ---
> net/bridge/br_netlink.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
> index bb01776d2d88..c96509c442a5 100644
> --- a/net/bridge/br_netlink.c
> +++ b/net/bridge/br_netlink.c
> @@ -589,9 +589,13 @@ static int br_fill_ifinfo(struct sk_buff *skb,
> }
>
> done:
> + if (af) {
> + if (nlmsg_get_pos(skb) - (void *)af > nla_attr_size(0))
> + nla_nest_end(skb, af);
> + else
> + nla_nest_cancel(skb, af);
> + }
>
> - if (af)
> - nla_nest_end(skb, af);
> nlmsg_end(skb, nlh);
> return 0;
>
br_fill_ifinfo has been a mess, at some point we have to refactor it.
Anyway, thanks for the patch:
Acked-by: Nikolay Aleksandrov <razor@...ckwall.org>
Powered by blists - more mailing lists