br_fill_ifinfo() leaves IFLA_BRIDGE_CFM out when the bridge has no
MEPs. For a dump that is fine, but a notification sent after the last
MEP is deleted then looks like any other RTM_NEWLINK for the bridge,
and a listener can't tell that the CFM config is now empty.

Put an empty IFLA_BRIDGE_CFM nest in the message instead when CFM is
asked for and the bridge has no MEPs. Ports still get none, as before.

Signed-off-by: Abdul Wasey <[email protected]>
---
 net/bridge/br_netlink.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 5160e801d..68ec4529f 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -603,7 +603,10 @@ static int br_fill_ifinfo(struct sk_buff *skb,
                struct nlattr *cfm_nest = NULL;
                int err;
 
-               if (!br_cfm_created(br) || port)
+               /* A bridge with no MEPs gets an empty IFLA_BRIDGE_CFM, so a
+                * listener can tell that the last MEP is gone.
+                */
+               if (!IS_ENABLED(CONFIG_BRIDGE_CFM) || port)
                        goto done;
 
                cfm_nest = nla_nest_start(skb, IFLA_BRIDGE_CFM);
-- 
2.53.0


Reply via email to