wifi: nl80211: expose link information for interfaces
authorJohannes Berg <johannes.berg@intel.com>
Mon, 13 Jun 2022 14:51:27 +0000 (16:51 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 20 Jun 2022 10:57:08 +0000 (12:57 +0200)
When getting/dumping an interface, expose information about
valid links.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/nl80211.c

index 0a69a5a6b74d102274d47c65bd1a6427c9f5e667..64934dd923ce5eceb860a0366bb1c351db0f05fd 100644 (file)
@@ -3800,6 +3800,28 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag
                        goto nla_put_failure;
        }
 
+       if (wdev->valid_links) {
+               unsigned int link_id;
+               struct nlattr *links = nla_nest_start(msg,
+                                                     NL80211_ATTR_MLO_LINKS);
+
+               if (!links)
+                       goto nla_put_failure;
+
+               for_each_valid_link(wdev, link_id) {
+                       struct nlattr *link = nla_nest_start(msg, link_id + 1);
+
+                       if (nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, link_id))
+                               goto nla_put_failure;
+                       if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN,
+                                   wdev->links[link_id].addr))
+                               goto nla_put_failure;
+                       nla_nest_end(msg, link);
+               }
+
+               nla_nest_end(msg, links);
+       }
+
        genlmsg_end(msg, hdr);
        return 0;