From patchwork Thu Nov 9 09:40:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 10050659 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 319AF60381 for ; Thu, 9 Nov 2017 09:41:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2236B2AB2B for ; Thu, 9 Nov 2017 09:41:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 167912AB5C; Thu, 9 Nov 2017 09:41:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8179D2AB2B for ; Thu, 9 Nov 2017 09:41:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753469AbdKIJlR (ORCPT ); Thu, 9 Nov 2017 04:41:17 -0500 Received: from mail-by2nam01on0049.outbound.protection.outlook.com ([104.47.34.49]:8992 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752902AbdKIJkz (ORCPT ); Thu, 9 Nov 2017 04:40:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quantenna.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=gb5X0+Da1VvtoidVWb8jK5T9932cEvTLaAzwuKRN5IY=; b=KG66vFvgiBqaOmQnq1mxXEz4o3pNLsZ+frqAqRwsQJluSbVVXKZaTwozasK7qhPG5Cgb876WvUQ3syPS4qiPQxhzfT5b23rZKjCRUGPVAbCyKkfow+zhJEYH5Cqe08UhpGd3sOJNldoJ+pRa8+dljtYV/u0bi1EyEB2WEu81Cog= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=sergey.matyukevich.os@quantenna.com; Received: from bars.quantenna.com (195.182.157.78) by BY2PR05MB1927.namprd05.prod.outlook.com (10.163.32.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.218.6; Thu, 9 Nov 2017 09:40:52 +0000 From: Sergey Matyukevich To: linux-wireless@vger.kernel.org, Johannes Berg Cc: Igor Mitsyanko , Avinash Patil , Vasily Ulyanov , Sergey Matyukevich Subject: [RFC PATCH 2/2] nl80211: implement beacon change notifier Date: Thu, 9 Nov 2017 12:40:24 +0300 Message-Id: <20171109094024.9085-2-sergey.matyukevich.os@quantenna.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171109094024.9085-1-sergey.matyukevich.os@quantenna.com> References: <20171109094024.9085-1-sergey.matyukevich.os@quantenna.com> MIME-Version: 1.0 X-Originating-IP: [195.182.157.78] X-ClientProxiedBy: DB6PR0301CA0065.eurprd03.prod.outlook.com (10.168.69.33) To BY2PR05MB1927.namprd05.prod.outlook.com (10.163.32.141) X-MS-Office365-Filtering-Correlation-Id: 68e26984-6afd-48f2-f1b8-08d52755f8a4 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603199); SRVR:BY2PR05MB1927; X-Microsoft-Exchange-Diagnostics: 1; BY2PR05MB1927; 3:emDrqOvhZ+T3XqCyT5ehxWnaJljmINWwuNiWClLLSXKTM2jSw2X0a9X96ixJp1/Fwjl7JbhrBVr+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sbIXNn7VW+ijnh/xnjKliBlLupmbg3yHpLVhu+64A1khXn3ohDHIDWkfG3yXXNpGxP8ynC4OldLSEhlKgCLB+rM+NHLRcEjL3FDuQHD7ggFliLIupwatJvet2t3k9YFaAyeRmjQi+EUGhrNxuuJxvyWhG5ZVSe5Sisj25TUz5lwo4WS+Ri5gaO4j/5HBG1w498KIXrQUPL/PfCY49l6s9zkCDOnERqEt8iYxr9iPTMmr3Igdw9WXrBzp94I9/Ksi4yui1Obv4/vO6MLxXGzePeqtYIRZ1k31F0Tsc43W; 4:4XmsIq6N6oVFWGdNSZVBd5f0mlKeg7sPoEvOdB9bGKf1/3fz8f8pmaJP7CEb6qJGjIutFULjWnzt2t1Oeo3xY/A5dukwDSnzqMzB2ejDF6dwiQG8GyTVCjTxPhFiwNESHZmbEMqtghZRMXczi6fsyuxsuCtBWZ2mWBQirDZw6ykMwgg13+l+M5SdfIz47JbEdHAn5E+JYZxJ6g6iQ3YuciygmBEzIDYjZ4o6PXHKMb0OJt2TSL4jvLDg8UceqZoKgTzO8xpMuMLd7iSLCxU3qg== X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(3231021)(100000703101)(100105400095)(93006095)(93001095)(10201501046)(3002001)(6041248)(20161123560025)(20161123562025)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR05MB1927; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR05MB1927; X-Forefront-PRVS: 0486A0CB86 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(39830400002)(376002)(346002)(189002)(199003)(316002)(105586002)(101416001)(4326008)(103116003)(7736002)(1076002)(68736007)(189998001)(106356001)(53936002)(69596002)(76176999)(6486002)(50986999)(53416004)(478600001)(33646002)(16526018)(107886003)(2950100002)(6116002)(305945005)(6666003)(25786009)(66066001)(5660300001)(36756003)(2906002)(81156014)(6916009)(8676002)(47776003)(86362001)(48376002)(50226002)(97736004)(50466002)(5003940100001)(54906003)(3846002)(16586007)(8936002)(81166006)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR05MB1927; H:bars.quantenna.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: quantenna.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR05MB1927; 23:t6Uhbj0mzD1laBONZ6OExjQB+k7bKaoKDZrcx3RZf?= =?us-ascii?Q?wGA4kM8Exwz180UsQ5rsvz0v4yUPDLw7zP1kvF6BgQkT3s6hmkUZwufNmJEv?= =?us-ascii?Q?Z9g8te7V92NxOA6R3YQv1MaD8RkOs4J3jYuk40Rtj87Mc2BfC1UerqVmVDL7?= =?us-ascii?Q?ijTMosWYjKPETjJ+LysYlE+E0OxwQo1vL3YDM/zWKH02ZSaOclVBNGxcMJjx?= =?us-ascii?Q?gukThe7M9awTAlbZNuQYeP1ptmEUY54rY4GkA5WGedHLJBsFxq+OMtyJtCt7?= =?us-ascii?Q?UAnE4TGVDE8M1AlS0LEleB1RMKKKIGsqoGIEmpEGQuNQSyKR5/8E5UtHnapF?= =?us-ascii?Q?rAwR0iLuVtthyxCBGhCPyCWO522Con+9yo/VfTzTgZkvkRRmOIQUX5g9Xhwh?= =?us-ascii?Q?msZYQIjSH7jA+6TUZ9gEGAVdhkRI5EWj+l/sJ3tYbM/oQFerx/UNVa+2+FjR?= =?us-ascii?Q?mUCiy013hTZm6ibAXreAWKAW5gDtA08IZBwp4E2Ne4yOzb/yC4QtlaiSM0yb?= =?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W5SGzov1ty351GutkGaypHY6TuVChr5WwuvxLJ5BlTHiza9AJS2p6RmG2UQiY29yX1Hwx//Pj5Fo5hoKqu9rIA8DjVfsBhKLl3MFb5mezEpo1CFa4ypuhkZv7kvFWVtf9lTZ7mYfoi7AjMl7GABa/krbUC0tByK37/q3tkfpLkZMm6QdSdrgLk=; 5:vocJQutV9UhxQ6+laQCp1zJHFVSBV4L+sD41Yeg8EjBaomquHb5q9uym9tY7XBAAR+bjfsp2xrOYzO9oUZtlDThHRS8cWgiwiP+f1DCpbuNjYUSRGdv65Bp9hbPTQ8sjvSmZv27ZFbMJNc6e0vLvRaBl1s5deyaiN5VGwyJjWs8=; 24:WkC4gogU7uVSowKNtDhQFOewOUt/CDuvFW3gbPcasw2ZDt7xREKOfwAeflelzeWgIN3XlmUw4EVr2CfNRASi3vxU3bwbHRVMLGISSkhmEIs=; 7:2invwdIoxqc04whY/BCo70rNHVm/H0BOfNx7SeOSwRKDYP+dyOcSP1hcDhje/IQN7prCr++SFIXxIoFQZYDW/+X8i3rGzkSWWoiBBFXK3v7kEKEF3QD6GiPZhGmFkEumRsB9qI6DwypkOXkvG0d3M6vvQgwhJYLJStKJJUfWijx6DcqYncHaeXqoseXIxklmOSpZYOlsRuV3KK7JQQ/HBCU1B4Z7IQ6mIEgEZFAMNIwGDhD7ZVpnlv7tETUlqCC8 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: quantenna.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2017 09:40:52.3140 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 68e26984-6afd-48f2-f1b8-08d52755f8a4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a355dbce-62b4-4789-9446-c1d5582180ff X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR05MB1927 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Vasily Ulyanov Notify user-space listeners about beacon data change. Signed-off-by: Vasily Ulyanov --- net/wireless/nl80211.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index f03f9989efbc..98e52e5ffc13 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -3950,6 +3950,26 @@ static int nl80211_send_beacon(struct sk_buff *msg, u32 portid, return -EMSGSIZE; } +static void nl80211_notify_beacon_change(struct net_device *dev, + enum nl80211_commands cmd, + struct cfg80211_beacon_data *bcn) +{ + struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; + struct sk_buff *msg; + + msg = nlmsg_new(nl80211_beacon_size(bcn), GFP_KERNEL); + if (!msg) + return; + + if (nl80211_send_beacon(msg, cmd, 0, 0, 0, bcn) < 0) { + nlmsg_free(msg); + return; + } + + genlmsg_multicast_netns(&nl80211_fam, wiphy_net(wiphy), msg, 0, + NL80211_MCGRP_MLME, GFP_KERNEL); +} + static void nl80211_check_ap_rate_selectors(struct cfg80211_ap_settings *params, const u8 *rates) { @@ -4250,6 +4270,8 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) wdev->ssid_len = params.ssid_len; memcpy(wdev->ssid, params.ssid, wdev->ssid_len); nl80211_assign_beacon(&wdev->beacon, &new_bcn); + nl80211_notify_beacon_change(dev, NL80211_CMD_START_AP, + &wdev->beacon); } wdev_unlock(wdev); @@ -4317,8 +4339,11 @@ static int nl80211_set_beacon(struct sk_buff *skb, struct genl_info *info) wdev_lock(wdev); err = rdev_change_beacon(rdev, dev, ¶ms); - if (!err) + if (!err) { nl80211_assign_beacon(&wdev->beacon, &merged_bcn); + nl80211_notify_beacon_change(dev, NL80211_CMD_SET_BEACON, + &wdev->beacon); + } wdev_unlock(wdev); if (err)