From patchwork Wed Oct 27 13:10:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jpt.7196@gmail.com X-Patchwork-Id: 1546920 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=rwNSjk1J; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=FBYO3zzm; dkim-atps=neutral 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=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4HfThf30trz9sS8 for ; Thu, 28 Oct 2021 00:15:46 +1100 (AEDT) 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:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id: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=IbEMbcrCXj1CUQciBTMWSVsgU7dVRngc8Z8wD34las8=; b=rwNSjk1JbwMK/E uQTRLx6CicdL/AM2Kdl0l8yHrJMn3JAwRlgKBBrLKvTNU627h/y63JKyEzvdCzgMGjeE5rk6hBxCV Yt1mCQEWWfyZAqpI7nqJHFwuTCe5buMOmQmhCS5mwGTsZjs2IimAY4a9g+5Xs7fDXTTvG3pLatxjb n21KXvduLsrzixWEKLJSfMR9LUm9NxDmUFChTBajgJokBei6+hdTS+4zilv3TVzKnR6SMjznkxxTX OQEXoo6e9Kmg1DNSD2L4dDLCzCgjLFY41y2PsemnRHuEH2dUjATKIeaHaLzt2eQ5hTuC+KXW6Q+63 tLgK/ze9whLXAj9cfs9w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfiiR-004wqV-7o; Wed, 27 Oct 2021 13:11:39 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfiiM-004wpz-4w for openwrt-devel@lists.openwrt.org; Wed, 27 Oct 2021 13:11:36 +0000 Received: by mail-wm1-x32f.google.com with SMTP id v127so2559478wme.5 for ; Wed, 27 Oct 2021 06:11:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id; bh=VHR4jhzBDntFNdHh0L6l6O1qiKD8br4fzuLUv0o68FE=; b=FBYO3zzm5EzhnVRslbB5Z6dKIXFncEUmUxjdIc/TKVObsjLytwtdNUXPPJi24HIlk6 +WGVc8HMBiwscJYfdbdRf5trFG+bfAfFn+tSeXCdTL3gUbwFBTnZH9uP8TGKqqOguwhf xsF1x7CR1hOW5cbddjsiAeiO0gBgsHyuEWGudPoFYqV4HIO/vI0zzT3wf9bLPvX7EPBh EaWcqz2IQizyx0TF9yYiW84+wk2uD+GEfsYpRTX8nywfjoslvIrLD841LoWiSugpbBXB BHWq+XYQiJyBXf6uUuKntzhRIU05UPjAvrP/Yw7uhfJxls+64IqXaWyiIbEybgwLhOeT ZyBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=VHR4jhzBDntFNdHh0L6l6O1qiKD8br4fzuLUv0o68FE=; b=5YtuUbYnX7HItMvfg/ka2irvwJLN8+shp15t0zPNFN/hLtoXI3FfCcUFpByXHcz38c 8lEUASR7bVYI+6RwWTneWN+Jgemc+82FfQdO+zbteMDnCT+/cHVcwebFROAxgKidAV5e 8pUB26euv9OFKJ/5aNh/ppO5DTQXVS53ai+8SSXJllG16cWW0mtDuCw8vnggIcboXHk0 vNq63d+MPSovBa2DO3Mmo68+XCN95jDXJZdfmNWesjMngxbslI/zIIN+qjSdT/sAShv+ bScF/wZMSQrR9e/mhPJo25ys99QH6Yw8V3YDyOq7WcXOGOPcdHoTIMSNEQBSdgv5J/Nr S04Q== X-Gm-Message-State: AOAM531ZTI/tzGb4nxqqN0tFP4NuKe9H2GtRNbyN3urNhwYuj1vRR4xn dwS4B53m+pX8beJL6pk+vdjc12KkQaU= X-Google-Smtp-Source: ABdhPJzVh39+XDvUW5aDs4UGZncK1E2iHDp+OQb6oT/qeO31kXGhuPHcRcJNfm/xJVGC806M9ul13g== X-Received: by 2002:a05:600c:21c5:: with SMTP id x5mr5653423wmj.27.1635340292444; Wed, 27 Oct 2021 06:11:32 -0700 (PDT) Received: from localhost.localdomain ([81.255.64.235]) by smtp.gmail.com with ESMTPSA id f9sm11471993wrx.31.2021.10.27.06.11.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Oct 2021 06:11:32 -0700 (PDT) From: jpt.7196@gmail.com X-Google-Original-From: jp.tosoni@acksys.fr To: openwrt-devel@lists.openwrt.org Cc: Jean-Pierre Tosoni Subject: [PATCH] wireless: fix mode checking in for_each_interface Date: Wed, 27 Oct 2021 15:10:46 +0200 Message-Id: <20211027131046.19252-1-jp.tosoni@acksys.fr> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211027_061134_228470_A62A95C3 X-CRM114-Status: GOOD ( 11.76 ) X-Spam-Score: 0.1 (/) 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: From: Jean-Pierre Tosoni When searching through wifi-ifaces for specific modes, the mode string must be compared as a full word. Else, adding a future new mode like "newap" or "apdetector" which embed an existing "ap" mode string, will end in detecting the wrong interface. Content analysis details: (0.1 points, 5.0 required) 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:32f 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.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [jpt.7196[at]gmail.com] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit [jpt.7196[at]gmail.com] -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 -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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: , MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Jean-Pierre Tosoni When searching through wifi-ifaces for specific modes, the mode string must be compared as a full word. Else, adding a future new mode like "newap" or "apdetector" which embed an existing "ap" mode string, will end in detecting the wrong interface. This was found while trying to create a new detection service for WIDS. Signed-off-by: Jean-Pierre Tosoni --- scripts/netifd-wireless.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/netifd-wireless.sh b/scripts/netifd-wireless.sh index 80fbf75..9dd5431 100644 --- a/scripts/netifd-wireless.sh +++ b/scripts/netifd-wireless.sh @@ -321,7 +321,7 @@ for_each_interface() { json_get_var _w_type mode json_select .. _w_types=" $_w_types " - [[ "${_w_types%$_w_type*}" = "$_w_types" ]] && { + [[ "${_w_types% $_w_type *}" = "$_w_types" ]] && { json_select .. continue }