From: Johannes Berg <johannes@sipsolutions.net>
To: "Alvin Šipraga" <alvin@pqrs.dk>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>
Cc: "Alvin Šipraga" <alsi@bang-olufsen.dk>,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH next] wifi: nl80211: emit CMD_START_AP on multicast group when an AP is started
Date: Wed, 18 Jan 2023 17:26:19 +0100 [thread overview]
Message-ID: <c7eac35785bf672b3b9da45c41baa4149a632daa.camel@sipsolutions.net> (raw)
In-Reply-To: <20221209152836.1667196-1-alvin@pqrs.dk>
On Fri, 2022-12-09 at 16:28 +0100, Alvin Šipraga wrote:
>
> This is problematic because it is possible that the network
> configuration that should be applied is a function of the AP's
> properties such as SSID (cf. SSID= in systemd.network(5)). As
> illustrated in the above diagram, it may be that the AP with SSID "bar"
> ends up being configured as though it had SSID "foo".
>
You might not care if you want the SSID, but it still seems wrong:
> +static void nl80211_send_ap_started(struct wireless_dev *wdev)
> +{
> + struct wiphy *wiphy = wdev->wiphy;
> + struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
> + struct sk_buff *msg;
> + void *hdr;
> +
> + msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
> + if (!msg)
> + return;
> +
> + hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_START_AP);
> + if (!hdr)
> + goto out;
> +
> + if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
> + nla_put_u32(msg, NL80211_ATTR_IFINDEX, wdev->netdev->ifindex) ||
> + nla_put_u64_64bit(msg, NL80211_ATTR_WDEV, wdev_id(wdev),
> + NL80211_ATTR_PAD) ||
> + (wdev->u.ap.ssid_len &&
> + nla_put(msg, NL80211_ATTR_SSID, wdev->u.ap.ssid_len,
> + wdev->u.ap.ssid)))
> + goto out;
> +
> + genlmsg_end(msg, hdr);
> +
> + genlmsg_multicast_netns(&nl80211_fam, wiphy_net(wiphy), msg, 0,
> + NL80211_MCGRP_MLME, GFP_KERNEL);
> + return;
> +out:
> + nlmsg_free(msg);
> +}
This has no indication of the link, but with multi-link you could
actually be sending this event multiple times to userspace on the same
netdev.
> static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
> {
> struct cfg80211_registered_device *rdev = info->user_ptr[0];
> @@ -6050,6 +6083,8 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
>
> if (info->attrs[NL80211_ATTR_SOCKET_OWNER])
> wdev->conn_owner_nlportid = info->snd_portid;
> +
> + nl80211_send_ap_started(wdev);
> }
because this can be called multiple times, once for each link.
Seems like you should include the link ID or something?
johannes
next prev parent reply other threads:[~2023-01-18 16:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-09 15:28 [PATCH next] wifi: nl80211: emit CMD_START_AP on multicast group when an AP is started Alvin Šipraga
2023-01-18 16:26 ` Johannes Berg [this message]
2023-01-21 13:07 ` Alvin Šipraga
2023-01-24 9:26 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c7eac35785bf672b3b9da45c41baa4149a632daa.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=alsi@bang-olufsen.dk \
--cc=alvin@pqrs.dk \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).