From patchwork Sun Nov 15 22:53:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1400601 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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=merlin.20170209 header.b=Qd+6QcmY; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=vMBJxFoK; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (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 4CZ6x76Dmqz9s1l for ; Mon, 16 Nov 2020 09:55:23 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject: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=RVOkQdoZGznISTnoNc4qPNZZnRqB5gmPK3J3fyBQDTg=; b=Qd+6QcmYhXpWR1zB+1k96u+pfu n0EF+6e/MXG+GRttoqMp9cI5vHAHCnyMac9cWiElkbqe1j7OaA21rfxVCwuD2tfzs0VkzQ4CSQrLP kSAfVrWT3SMKkESoq1nXg+WLCRXDbtH2ZUc6wcIbNt44AXGGwh6SKHqze6x3aEB3uyO110dlX+UDE pH5edw+VyQ6dCOM3BGf2Iekze6OaSzV2ax8EwKw6r/Pe4CXXsQUEI7c/vhkjyxQ8cAZkDqDUdL5M6 q+Q0OyAcLiy+nljpZSFaVlxZcw0fk+IkFxaV3OM72UrKIiMhMGjoBZD//Qe4ZZABP29xvgmXwWAXO +QZNHFbw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1keQts-0005fy-SJ; Sun, 15 Nov 2020 22:53:36 +0000 Received: from mail-ed1-x543.google.com ([2a00:1450:4864:20::543]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1keQtp-0005ei-QI for openwrt-devel@lists.openwrt.org; Sun, 15 Nov 2020 22:53:35 +0000 Received: by mail-ed1-x543.google.com with SMTP id d18so3943508edt.7 for ; Sun, 15 Nov 2020 14:53:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=59uZJBesWA5Mg5Bzj15E7BHEfKR3jmRME6fFd4YCDKM=; b=vMBJxFoKJHd6CzaR0alm/HRQterRpmx35njeFUZ0uzR1ARXWHr10auytIqAb76Yt45 cGD0cGeLSuUy48QdPYP31IrpP7+48QIgypNRVeuXvrUvySMTp7aioM17B3X2FeMwNbP/ lh3q/edGCJq5N1OUTCY/cqaDZatPlXm3OveLPBIRETWSA+zJ7Co2PURIyzd7hoCGNCjS sheKLsvQ6Hn8JbF+CDSHFK6gAb1ACYVIgGlw75zKf5fDzGyVwAhVK9pDPv7kumh0cjGv FP/dI06qhpO2LgdAhLGzxT0xHEJAvsDbth06wKrg6cCDfCv+zaPs0ezU+MTAhZW9b3JU ZPZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=59uZJBesWA5Mg5Bzj15E7BHEfKR3jmRME6fFd4YCDKM=; b=P1pes3/52rVHABQVJwlYPDG//GknMAUEFvBYh4V/r9QyznAhdIunjElfS13vnjN70Z UdjZ4ZDbayXve1M5gjJfrIUzVpnLxWPTNTgnihFHpqk/6TOuveFTc4pTyMYixysUQOXC orVSdRwjLlIYGyKXYMtkTrmyvhrMx+mVDG7Vtt0NTyuDqC66HoaGa834QItZ7VEeRvcv dwnH8mZXyiTGgmAzvfWTP14dxvDf4HAhKRdK2fhZoDqAJEtCHrY3Mfo1tvDJNeGBZXC+ xeWmLW26SeYuUtubhzAu4fCmZBwD9+dZe0zX7SCM1hLvpegiqOjqsVkPPLBorWuf73Yz 28Ww== X-Gm-Message-State: AOAM532XHWDCNEnt8So0gXdUE1uitZtb2LqurT8EM0FtuMkMrf2uhj0d ozh+jxsEyR+kXV4BNYzvDI6CY+FBUD8= X-Google-Smtp-Source: ABdhPJzMd9BG+ZNAD4iwWBQfD3AGE/+UX7ysxhx7jq6gjGs/fWSBtTVTwEi08iDMQCsMhd5raXU1Mg== X-Received: by 2002:a05:6402:1c8e:: with SMTP id cy14mr13569546edb.39.1605480810691; Sun, 15 Nov 2020 14:53:30 -0800 (PST) Received: from ansuel-xps20.localdomain (93-39-149-95.ip76.fastwebnet.it. [93.39.149.95]) by smtp.googlemail.com with ESMTPSA id f9sm9461728ejd.85.2020.11.15.14.53.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Nov 2020 14:53:29 -0800 (PST) From: Ansuel Smith To: openwrt-devel@lists.openwrt.org Subject: [RPCD RFC PATCH 2/2] iwinfo: add ht and vht operation info to wifi scan Date: Sun, 15 Nov 2020 23:53:20 +0100 Message-Id: <20201115225321.31277-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201115_175333_956514_F339EF4D X-CRM114-Status: GOOD ( 12.33 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:543 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [ansuelsmth[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ansuel Smith Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Iwinfo exports ht and vht operation info useful to get channel info of nearby stations. Add these new info to ubus output. Signed-off-by: Ansuel Smith --- iwinfo.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/iwinfo.c b/iwinfo.c index 7780e69..182db2d 100644 --- a/iwinfo.c +++ b/iwinfo.c @@ -403,11 +403,30 @@ rpc_iwinfo_scan(struct ubus_context *ctx, struct ubus_object *obj, struct blob_attr *msg) { int i, rv, len; - void *c, *d; + void *c, *d, *t; char mac[18]; char res[IWINFO_BUFSIZE]; struct iwinfo_scanlist_entry *e; + const char *ht_secondary_offset[4] = { + "no secondary", + "above", + "[reserved!]", + "below", + }; + + const char *ht_chan_width[2] = { + "20 MHz", + "any", + }; + + const char *vht_chan_width[] = { + [0] = "20 or 40 MHz", + [1] = "80 MHz", + [3] = "80+80 MHz", + [2] = "160 MHz", + }; + rv = rpc_iwinfo_open(msg); if (rv) @@ -441,6 +460,20 @@ rpc_iwinfo_scan(struct ubus_context *ctx, struct ubus_object *obj, blobmsg_add_u32(&buf, "quality", e->quality); blobmsg_add_u32(&buf, "quality_max", e->quality_max); + t = blobmsg_open_table(&buf, "ht_operation"); + blobmsg_add_u32(&buf, "primary_channel", e->ht_chan_info.primary_chan); + blobmsg_add_string(&buf, "secondary_channel_offset", ht_secondary_offset[e->ht_chan_info.secondary_chan_off]); + blobmsg_add_string(&buf, "channel_width", ht_chan_width[e->ht_chan_info.chan_width]); + blobmsg_close_table(&buf, t); + + if (e->vht_chan_info.center_chan_1) { + t = blobmsg_open_table(&buf, "vht_operation"); + blobmsg_add_string(&buf, "channel_width", vht_chan_width[e->vht_chan_info.chan_width]); + blobmsg_add_u32(&buf, "center_freq_1", e->vht_chan_info.center_chan_1); + blobmsg_add_u32(&buf, "center_freq_2", e->vht_chan_info.center_chan_2); + blobmsg_close_table(&buf, t); + } + rpc_iwinfo_add_encryption("encryption", &e->crypto); blobmsg_close_table(&buf, d);