Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp6718524rwb; Wed, 18 Jan 2023 08:32:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXvtfQiydIlJb+BWDmQG56U02c5gC2qBsLgj2koijUXOPM1W/4lkEoPO6YQuK3JdlfIb0Z+L X-Received: by 2002:a05:6a20:3a8f:b0:af:74f5:93a3 with SMTP id d15-20020a056a203a8f00b000af74f593a3mr6887603pzh.61.1674059559556; Wed, 18 Jan 2023 08:32:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674059559; cv=none; d=google.com; s=arc-20160816; b=hgUJIMWZMNBl2p1h796tZK5YLu+kJEOvGzbrJkqcPrY5QpQWMDXuofEN2qaGCXrU8K eWvGbPgheb9AwjvnUccHJI/Y+PUCtouTH2dTqHM3MbCv+JcIC3taHviMvFtZnQ+CUpzm L+bFefBeaxbW5BpXWBYADLGV0kVf1mHtjBsImZBUg0XUbqDr+ODWNo3HnDZU1mhI6kPF ctuKKPp1/SZMQjawmVr95O/8FBNHjN+aK8q34nAqBxjZoX2SaAX3POSOZHwx6bSxyQb7 0q/Y30zw42MO2TZC0m/AbLrWWFWDxbyb9265rSf3n3KrUOeQVlcnV2mQQOZD4Sh9EZzi gM7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=daHAY+DebOZfhDvBIyF627C8PzCUTWvqdFX/bjJDLm0=; b=xuMtDOWcsM1d4xneYk6hraaw2bEriK8eHt1FRN8PRrV/LwwCq4s53WDh+F/ieh5mLm X0jtb0sUP6q3x62jacsVsfVY2dryadxLe1+lz/bDVG+4c62UKN6l3HVhv7Iacy3F/sgl vsEl2edSTD9KEeF6WFw/ec17GvV5gi7PU5VL4l3DqnFAseAuGr1BoBonTrHlLYHYFE2F NdHNDGThp9qX8826Klt5lMY5WdlheNYNyJIfzjRltb9ICdXmoHt4uoZegMXqw1rPmRil J6iM2HRaZ/+tp4VYEZdyCJKWRP+bpq6ye6jB0afhRV+4Kp5IvnVayyHDKbmVcJofV9xf n9Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=sNNQ8oeI; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u1-20020a63d341000000b004792b08adabsi36126848pgi.750.2023.01.18.08.32.31; Wed, 18 Jan 2023 08:32:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=sNNQ8oeI; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=sipsolutions.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230373AbjARQ3M (ORCPT + 63 others); Wed, 18 Jan 2023 11:29:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230246AbjARQ2z (ORCPT ); Wed, 18 Jan 2023 11:28:55 -0500 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8493259E63; Wed, 18 Jan 2023 08:26:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=MIME-Version:Content-Transfer-Encoding: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=daHAY+DebOZfhDvBIyF627C8PzCUTWvqdFX/bjJDLm0=; t=1674059189; x=1675268789; b=sNNQ8oeIrM5h1QIu3XyOdGocibYdVzHlyQImpgljf8mKlnS X/TJlypvgvgkTjUs1dGnOFwvyEodD99f20hFEzamWGPTc0Pb7GqTtPlCELOUM0rviQP+v8Nt+Nl1+ CZcZG8ppVgJaQBibwpfx5cd/MaKmOOY+cUy+6xs/QCxQ8MRfX00AyhQCbiSelJjmj1ExTXAyuj7yA j4mqiIRK5w1vPC3AzcbBbqrXiFTPZSjlZICHMoy3rF5pt0JU4JdXyPPHgOQ43rya+oZYQlOtTOprc EBLhjHDLxgDmsLFLCq6we44ByG3q3ZMrcYkT8OADmULUo4MjGxR4KhLVuoed3BFw==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1pIBGW-005fj9-0Y; Wed, 18 Jan 2023 17:26:20 +0100 Message-ID: Subject: Re: [PATCH next] wifi: nl80211: emit CMD_START_AP on multicast group when an AP is started From: Johannes Berg To: Alvin =?UTF-8?Q?=C5=A0ipraga?= , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Alvin =?UTF-8?Q?=C5=A0ipraga?= , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 18 Jan 2023 17:26:19 +0100 In-Reply-To: <20221209152836.1667196-1-alvin@pqrs.dk> References: <20221209152836.1667196-1-alvin@pqrs.dk> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.3 (3.46.3-1.fc37) MIME-Version: 1.0 X-malware-bazaar: not-scanned X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Fri, 2022-12-09 at 16:28 +0100, Alvin =C5=A0ipraga wrote: >=20 > 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=3D 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". >=20 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 =3D wdev->wiphy; > + struct cfg80211_registered_device *rdev =3D wiphy_to_rdev(wiphy); > + struct sk_buff *msg; > + void *hdr; > + > + msg =3D nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); > + if (!msg) > + return; > + > + hdr =3D 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 =3D info->user_ptr[0]; > @@ -6050,6 +6083,8 @@ static int nl80211_start_ap(struct sk_buff *skb, st= ruct genl_info *info) > =20 > if (info->attrs[NL80211_ATTR_SOCKET_OWNER]) > wdev->conn_owner_nlportid =3D 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