From patchwork Fri Jun 25 22:01:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Weinelt X-Patchwork-Id: 1497449 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=tMcIiZHS; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=darmstadt.ccc.de header.i=@darmstadt.ccc.de header.a=rsa-sha256 header.s=201802 header.b=Wj3wzCbg; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GBWMy6dK7z9sVt for ; Sat, 26 Jun 2021 08:07:57 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=C6XbauMzvfuhVDhy5dZY0LxI5yl+WgPv/g3aXJd7yGI=; b=tMcIiZHSJSALFP gl1aZu8y++cqmK7JCws/WVRrCM9MjsvdOQ3SZTqUBPKJAeAAibiaMA6TKit4Re+C1f92BOeqQabwj sG/HUnW2H9dJ7ZdvrWV6gjRonD+EL/QCVTj4KI5HV4srkPwPZWdn9Nt4htCOIoL4XCz57GwxZQAf0 71iKgHynFRPKFkMgFcujCR09TJpV4pjDTzz7MnHNDE7hY62fLjxFZZ8jbdmxQVDHYNLweUdNUBckw Y6fY+EHMDE8j8kNlvOknPbZmW30TW//VrSeRHrmXC5RYQd8iwknQ85N2wcvo4heUImtyi3RvUx3RA txIhoPc1gRQOd6dMcy/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwttU-002uxO-Bx; Fri, 25 Jun 2021 22:01:48 +0000 Received: from venus.chaos.hg.tu-darmstadt.de ([2001:41b8:83f:4242::b182]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwttC-002uvz-IW for openwrt-devel@lists.openwrt.org; Fri, 25 Jun 2021 22:01:32 +0000 Received: from gaia.lossy.network (p200300d4bf148c021c16af35c57ade9a.dip0.t-ipconnect.de [IPv6:2003:d4:bf14:8c02:1c16:af35:c57a:de9a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hexa) by venus.chaos.hg.tu-darmstadt.de (Postfix) with ESMTPSA id 68770442F; Sat, 26 Jun 2021 00:01:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=darmstadt.ccc.de; s=201802; t=1624658484; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ENSosIvRyqSEzvTkUiO3SRK6C+i/VSWbKKawtQ/7FCw=; b=Wj3wzCbgVsiLDJmXFLYFBKKaJL9PfX/Wjp2A2NQhGBECUvM2AbXIgn+5ucA9N58RWWof8C ic5NncK/QQ7DVzwxB6WKJczbluE+7lBkhhdpCeLIuRX19j1NtMxiHVf86EGuZbaA2jiRG5 felhDpxI/A5V6WBC5daMjOq+sDIIgls= From: Martin Weinelt To: openwrt-devel@lists.openwrt.org Cc: David Bauer Subject: [PATCH 1/2] hostapd: report bssid, ssid and channel over ubus Date: Sat, 26 Jun 2021 00:01:07 +0200 Message-Id: <20210625220108.151779-1-hexa@darmstadt.ccc.de> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210625_150130_791991_9511D116 X-CRM114-Status: UNSURE ( 8.97 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.4 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Imports a function from iw to convert frequencies to channel numbers. Co-authored-by: David Bauer Signed-off-by: Martin Weinelt --- .../services/hostapd/src/src/ap/ubus.c | 34 +++++++++++++++++++ 1 file changed, 34 insertio [...] Content analysis details: (-2.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [2001:41b8:83f:4242:0:0:0:b182 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Imports a function from iw to convert frequencies to channel numbers. Co-authored-by: David Bauer Signed-off-by: Martin Weinelt --- .../services/hostapd/src/src/ap/ubus.c | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index 7cc2059fc1..1b605bdf0a 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -372,6 +372,32 @@ hostapd_bss_get_features(struct ubus_context *ctx, struct ubus_object *obj, return 0; } +/* Imported from iw/util.c + * https://git.kernel.org/pub/scm/linux/kernel/git/jberg/iw.git/tree/util.c?id=4b25ae3537af48dbf9d0abf94132e5ba01b32c18#n200 + */ +int ieee80211_frequency_to_channel(int freq) +{ + /* see 802.11-2007 17.3.8.3.2 and Annex J */ + if (freq == 2484) + return 14; + /* see 802.11ax D6.1 27.3.23.2 and Annex E */ + else if (freq == 5935) + return 2; + else if (freq < 2484) + return (freq - 2407) / 5; + else if (freq >= 4910 && freq <= 4980) + return (freq - 4000) / 5; + else if (freq < 5950) + return (freq - 5000) / 5; + else if (freq <= 45000) /* DMG band lower limit */ + /* see 802.11ax D6.1 27.3.23.2 */ + return (freq - 5950) / 5; + else if (freq >= 58320 && freq <= 70200) + return (freq - 56160) / 2160; + else + return 0; +} + static int hostapd_bss_get_status(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, @@ -380,12 +406,20 @@ hostapd_bss_get_status(struct ubus_context *ctx, struct ubus_object *obj, struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj); void *airtime_table, *dfs_table; struct os_reltime now; + char ssid[SSID_MAX_LEN + 1]; char phy_name[17]; char mac_buf[20]; blob_buf_init(&b, 0); blobmsg_add_string(&b, "status", hostapd_state_text(hapd->iface->state)); + blobmsg_printf(&b, "bssid", MACSTR, MAC2STR(hapd->conf->bssid)); + + memset(ssid, 0, SSID_MAX_LEN + 1); + memcpy(ssid, hapd->conf->ssid.ssid, hapd->conf->ssid.ssid_len); + blobmsg_add_string(&b, "ssid", ssid); + blobmsg_add_u32(&b, "freq", hapd->iface->freq); + blobmsg_add_u32(&b, "channel", ieee80211_frequency_to_channel(hapd->iface->freq)); snprintf(phy_name, 17, "%s", hapd->iface->phy); blobmsg_add_string(&b, "phy", phy_name); From patchwork Fri Jun 25 22:01:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Weinelt X-Patchwork-Id: 1497450 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=QOGSSijG; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=darmstadt.ccc.de header.i=@darmstadt.ccc.de header.a=rsa-sha256 header.s=201802 header.b=bYtXSc5J; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GBWPh6RF2z9sVt for ; Sat, 26 Jun 2021 08:09:28 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ufZQG7xa6HQhQkk+Vh3GZJnWmnQDb0+x/L1xVM+X2y0=; b=QOGSSijGZxSKoB uz5eSmXFQVZpZMX/K0HVgazTiVMF84V5BQGL///gU0ncyxoTNUmYu8DBZj6NeynNi9//2l+jKHVQM PFKlNvrI0yygD0ReXWBTxLWVBc7vo8+wYsmsUs9iTeY+OTT7jC5zkqDu1E5xm4c7jbHlmBsN727bZ a3Kk0c85rD9hs+WQL42d4zQZ4WnDc8Zshgt4VnXf8txdrSDmOeTkibWy+1v/ACuxCRMnPnCO9bGej OVjDQAZPHrgkjvpKGMpfkr+ad4tSgHsLMy1fS3nJIQpNG02Z1x1yzJxODgN/GnCKwqJUDAfaIrb2z XnRLQUKvezQybSdJdi+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwttI-002uwZ-UX; Fri, 25 Jun 2021 22:01:37 +0000 Received: from venus.chaos.hg.tu-darmstadt.de ([130.83.177.130]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwttC-002uw0-2J for openwrt-devel@lists.openwrt.org; Fri, 25 Jun 2021 22:01:31 +0000 Received: from gaia.lossy.network (p200300d4bf148c021c16af35c57ade9a.dip0.t-ipconnect.de [IPv6:2003:d4:bf14:8c02:1c16:af35:c57a:de9a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hexa) by venus.chaos.hg.tu-darmstadt.de (Postfix) with ESMTPSA id B7D424D42 for ; Sat, 26 Jun 2021 00:01:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=darmstadt.ccc.de; s=201802; t=1624658484; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t9uhz5PlI+oIj1v+kKV8bo51TGS0QW6U2z9bovhIoWQ=; b=bYtXSc5Jv44BXzmVI7ij58YX3qPlhPKffp1zOLXQgn54uo61ctlbMWqNuIaUCvTm+ELeyD 2ZtzNybpc+ASCCBdpz7kZC+bdZDYpCA5QXRcDdfGDv0lst3zCYwtbznOqbk07EAS4ylc6o 60J9Slrg3wRiSulJNud2ReaKWdpilIM= From: Martin Weinelt To: openwrt-devel@lists.openwrt.org Subject: [PATCH 2/2] hostapd: remove unused mac_buff allocation Date: Sat, 26 Jun 2021 00:01:08 +0200 Message-Id: <20210625220108.151779-2-hexa@darmstadt.ccc.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210625220108.151779-1-hexa@darmstadt.ccc.de> References: <20210625220108.151779-1-hexa@darmstadt.ccc.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210625_150130_474725_32B81C90 X-CRM114-Status: UNSURE ( 6.25 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.4 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Signed-off-by: Martin Weinelt --- package/network/services/hostapd/src/src/ap/ubus.c | 1 - 1 file changed, 1 deletion(-) diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index 1b605bdf0a..b0e82d457b 100644 --- a/package/network/services/hostapd/src/src/ [...] Content analysis details: (-2.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [130.83.177.130 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Signed-off-by: Martin Weinelt --- package/network/services/hostapd/src/src/ap/ubus.c | 1 - 1 file changed, 1 deletion(-) diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index 1b605bdf0a..b0e82d457b 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -408,7 +408,6 @@ hostapd_bss_get_status(struct ubus_context *ctx, struct ubus_object *obj, struct os_reltime now; char ssid[SSID_MAX_LEN + 1]; char phy_name[17]; - char mac_buf[20]; blob_buf_init(&b, 0); blobmsg_add_string(&b, "status", hostapd_state_text(hapd->iface->state));