From patchwork Thu Oct 24 16:46:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13849400 Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 913E549652 for ; Thu, 24 Oct 2024 16:46:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729788402; cv=none; b=slBaRSBz8oUj+aaV6XNtKycD725lGNFCm9oAM4Lej2xglnnR7r1IN+2PvUK7ERG4f3OgDARVHygEJk5vwOQq5n3LzrYiYzUUzsRlGLiM5gSfde/9xX47uM7dSFtWL2kLZeH/pzfjMHQx/Am4Y75VyUOiFBeHDA43uns1GBd7H9o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729788402; c=relaxed/simple; bh=IhL2zv0AcQlomJBD2wCPsazNDogCOglhE1riBuNflEE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=nbl/UWd4DNNHj3/uEyBDA7hlC5vOTQ4ipjSa3Np4BtnPBlJxoleJkjVlpDkMqBfDq5AGUeU++MjHSsirCxNchrU4hJcBRwnh49c8q8/MbcShpG1FtgRFnagZZUOYPLuK1AbCTJG6EBLHOavdx0nTGTD52zLI/E5JiaRkL0ueuDE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IwhAdVj9; arc=none smtp.client-ip=209.85.160.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IwhAdVj9" Received: by mail-qt1-f172.google.com with SMTP id d75a77b69052e-460dce6fff9so7536361cf.1 for ; Thu, 24 Oct 2024 09:46:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729788399; x=1730393199; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=1FevfuVyxuZ1qPPZzJ7wX/yreqxQXzM7LyohybtWB90=; b=IwhAdVj94iVUA0vHCve3vTR5lu27G/ccVvpJtCAUCyP7e2SqPAZsYpNxXWv4dYSvlk nZ9dMq822y4hcBFcs4yWjpXBfUc9eTsDTJpC4JDf5e4O/7aasVu3fgjPeChQQk2Inmm9 8GpYAMT/ASQwQSVQzuRsnmgnLTXgbR3vWkPozvZv91P6IM1tpyiUmmmFWevJkhXqJC2Z jnqt7jFyt0x0IuixaV7mKrA4CYEsryBBPX4vO5U7mvBamkZqC4EHKTdAeNeX5b7cHCae /Z71qedoJIiXXddYObN/vzIZQzFsNh6OyKL/Qn0V60znXkyl6N4JQe5a0cutlMkPddFo D/VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729788399; x=1730393199; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1FevfuVyxuZ1qPPZzJ7wX/yreqxQXzM7LyohybtWB90=; b=GA92A4frEIueXZ+ovxlNUG46EOrWIIalF737tmwP+gRy+jwkoyyfhPMgUcd/gsNVJD L9nfhRkbiacmlN/xbuPjkhaHw7lsmqW7TFpn5PAtq59/ECSsdvxkg4Gyc2/yCpSNEouO HGGlPfBCuhx4X3T3hM3UZfUMPbt6NH7o44Tlixpx+ZML4ptGo9lb22rxLFtMCph30jsU GYH6bN5SB+dKHV7H5PqaEe1G90eUplh4bgNBkPB4LM9c0xlpluimWvv00qpIGuMyqzds nCH++ze3Hjjf2DetMnklP5OXS6PxGNq4/r6fDAymhOnsGeZeupJihQvcndpLELXa0gFW 4FNQ== X-Gm-Message-State: AOJu0Ywu7JpmCKHQjrKs4iyXcUV6lXfw0fK1ETyV845HCzLk9TnNW7wD rW/S6W2GvPl4OOWlPMznZKPLPnGU8aS8psr3egJkvf2SKTLvjp+7p2BB/g== X-Google-Smtp-Source: AGHT+IHcuOeqaZygevGjHT290k79xBx0/bFOEtvwyBZ6WuBaoaVFKxGetB7I0le2JQMzS+jjmvDkgg== X-Received: by 2002:a05:622a:c6:b0:460:4027:601 with SMTP id d75a77b69052e-461145aae23mr110725151cf.6.1729788399122; Thu, 24 Oct 2024 09:46:39 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4611a19be2csm16893901cf.70.2024.10.24.09.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 09:46:38 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 1/5] band: correct oper class 136 starting frequency Date: Thu, 24 Oct 2024 09:46:31 -0700 Message-Id: <20241024164635.176631-1-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This should be 5925, not 5950 --- src/band.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/band.c b/src/band.c index 14daeb37..4e8eb9b0 100644 --- a/src/band.c +++ b/src/band.c @@ -896,7 +896,7 @@ static const struct operating_class_info e4_operating_classes[] = { }, { .operating_class = 136, - .starting_frequency = 5950, + .starting_frequency = 5925, .channel_spacing = 20, .center_frequencies = { 2 }, } From patchwork Thu Oct 24 16:46:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13849401 Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A9B32146D6B for ; Thu, 24 Oct 2024 16:46:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729788403; cv=none; b=mfBsP5JV6YeOvskZNFYYWa5glO6BlhifcDhS8MmeBdNRr1oZBAO5zKqCNj5tGSKDWxsqOZzshMnH50HTiYrC3szM6e2vgbTLl0F8ExkOBYnfVfi5OrOZfopImEaXz/ldi5dUFd3tKfgAlXjAsgaiOO3YfOHO9GGhai8cWUM6dmI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729788403; c=relaxed/simple; bh=8FhNKcp2yYtADPiPblTSNPjSCdsWWfUNmRESfk0qHjU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lXRSWoaq+YwV4JBleGYBVlq8PWEp/P2m4JTFoxwk7r+DCf9sW7Lr51tvm0ewne4ueUNRI1XGEWiz5VsWIOZM4Q4W7A/8/4Dy+HAfhePnTdtmgAHOina4eSI/5JjWKTGZ+U8msddFgJTymv+qJCEdye5mbiyh8Ny3/7Z/UySAev0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fQScGp8W; arc=none smtp.client-ip=209.85.160.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fQScGp8W" Received: by mail-qt1-f180.google.com with SMTP id d75a77b69052e-4609beb631aso6897631cf.2 for ; Thu, 24 Oct 2024 09:46:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729788400; x=1730393200; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=khiGYbzWNTkEvqgnakMZwWnE+0L7jJKY2aEROv4oWEg=; b=fQScGp8WK24g7EnMA5q4MFvZzBBYoWetTFxB5ESJ5XtLWlm8cdgRqvNrsAry8BOeN5 LompaiVhTxLiR29fazzg801D9DVp2IrUXQo1wGJ3a1Sia0AfrWu7gciD9U3SIQF9UaSA XCTgdoBk03wXefG72v+X3zksxpbsAyNru0eJiL1TXu36kyimHBycm8FSfcyeW10M+PLB zcN4Ux77wYU+yLcuZdnpIn/wZTbjdem8JkegYpeyDFB0lT4ihIjs8SBCJDz9QYHjrotU LmSuDCwj2LpWHC/iy2xS9m7yKDOj4LR3K//0WItdqfeKzQBWvIJbfDILYmux9vqycEUv r8vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729788400; x=1730393200; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=khiGYbzWNTkEvqgnakMZwWnE+0L7jJKY2aEROv4oWEg=; b=B0hdzps8fAL5nxWsI74yNx1oM3zZT+Co7UvwbK2lJTEHK6rgreHdXIgX2NrhtRGHIK BLoeyVqL3FhZO0g3CImt4iH6w3P7UE0C32Cfrh/NHKnue00VYgZD0Fs7ZmX6+No1aWN8 N5dWjxyC7IGIfPFKVYfsNVCnBF4mSO/TgB4OxKp01P9dcqgo7Q2T01BAohy1clbdfVfJ yCvCzjXbdwWn+xrfLQp9y5cbWoxZ1kWRFXNC5ze3RLhtnMd81RDswhB4RM0tYkbWaQff 0NZ4Y3qVlnR3L1KimPG2iKF8pOSTHODRlbBT2gdDzd9etD+8kPsdwW53+O5+Vc0tO04k 6Vzg== X-Gm-Message-State: AOJu0YyyH1wQLUgFpwg5nT19RBueWCmMl/X60HFjH/Iu81gJ8+RIF13O 5fhlBl2meuAfaKW/30UMkqP55ny/adqoyDJeScNFqgWqA5K3DQ8bLxYbBA== X-Google-Smtp-Source: AGHT+IGQY0ztRhk/s9Sm34YrRuKbe6C8dPdEVlQrYnfGzZM1Bbjze2gnZI+axyMBdEY8mf/rHtYfpQ== X-Received: by 2002:a05:622a:1992:b0:460:a730:3176 with SMTP id d75a77b69052e-461145afd8dmr96355461cf.11.1729788400271; Thu, 24 Oct 2024 09:46:40 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4611a19be2csm16893901cf.70.2024.10.24.09.46.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 09:46:39 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 2/5] nl80211util: check band when parsing supported frequencies Date: Thu, 24 Oct 2024 09:46:32 -0700 Message-Id: <20241024164635.176631-2-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241024164635.176631-1-prestwoj@gmail.com> References: <20241024164635.176631-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When the frequencies/channels were parsed there was no check that the resulting band matched what was expected. Now, pass the band object itself in which has the band set to what is expected. --- src/nl80211util.c | 13 ++++++++----- src/nl80211util.h | 4 ++-- src/wiphy.c | 7 ++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/nl80211util.c b/src/nl80211util.c index 7590f90c..0fdefddf 100644 --- a/src/nl80211util.c +++ b/src/nl80211util.c @@ -697,8 +697,7 @@ int nl80211_parse_chandef(struct l_genl_msg *msg, struct band_chandef *out) int nl80211_parse_supported_frequencies(struct l_genl_attr *band_freqs, struct scan_freq_set *supported_list, - struct band_freq_attrs *list, - size_t num_channels) + struct band *band) { uint16_t type, len; const void *data; @@ -712,6 +711,7 @@ int nl80211_parse_supported_frequencies(struct l_genl_attr *band_freqs, while (l_genl_attr_next(&nested, NULL, NULL, NULL)) { uint32_t freq = 0; struct band_freq_attrs freq_attr = { 0 }; + enum band_freq out_band; if (!l_genl_attr_recurse(&nested, &attr)) continue; @@ -752,17 +752,20 @@ int nl80211_parse_supported_frequencies(struct l_genl_attr *band_freqs, if (!freq) continue; - channel = band_freq_to_channel(freq, NULL); + channel = band_freq_to_channel(freq, &out_band); if (!channel) continue; - if (L_WARN_ON(channel > num_channels)) + if (L_WARN_ON(out_band != band->freq)) + continue; + + if (L_WARN_ON(channel > band->freqs_len)) continue; if (supported_list) scan_freq_set_add(supported_list, freq); - list[channel] = freq_attr; + band->freq_attrs[channel] = freq_attr; } return 0; diff --git a/src/nl80211util.h b/src/nl80211util.h index 67fd7d7b..9f28b089 100644 --- a/src/nl80211util.h +++ b/src/nl80211util.h @@ -26,6 +26,7 @@ struct band_chandef; struct scan_freq_set; struct band_freq_attrs; struct handshake_state; +struct band; int nl80211_parse_attrs(struct l_genl_msg *msg, int tag, ...); int nl80211_parse_nested(struct l_genl_attr *attr, int type, int tag, ...); @@ -95,8 +96,7 @@ struct l_genl_msg *nl80211_build_external_auth(uint32_t ifindex, int nl80211_parse_chandef(struct l_genl_msg *msg, struct band_chandef *out); int nl80211_parse_supported_frequencies(struct l_genl_attr *band_freqs, struct scan_freq_set *supported_list, - struct band_freq_attrs *list, - size_t num_channels); + struct band *band); void nl80211_append_rsn_attributes(struct l_genl_msg *msg, struct handshake_state *hs); diff --git a/src/wiphy.c b/src/wiphy.c index d57d657a..d2793491 100644 --- a/src/wiphy.c +++ b/src/wiphy.c @@ -1706,8 +1706,7 @@ static void parse_supported_bands(struct wiphy *wiphy, case NL80211_BAND_ATTR_FREQS: nl80211_parse_supported_frequencies(&attr, wiphy->supported_freqs, - band->freq_attrs, - band->freqs_len); + band); break; case NL80211_BAND_ATTR_RATES: @@ -2288,9 +2287,7 @@ static void wiphy_dump_callback(struct l_genl_msg *msg, * theory no new frequencies should be added so there * should never be any stale values. */ - nl80211_parse_supported_frequencies(&attr, NULL, - band->freq_attrs, - band->freqs_len); + nl80211_parse_supported_frequencies(&attr, NULL, band); } } } From patchwork Thu Oct 24 16:46:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13849402 Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C83E149652 for ; Thu, 24 Oct 2024 16:46:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729788404; cv=none; b=ay5WTOzXZQrGvnVmiIXX6Nt8q1Ywd8zsXMxHlZhrE2DKAIcn58vKUnu+3riimB0WdMr+etO91zVygI6C/W/DbIwr9qs4sO3fHJEASv6VM2GeM30vGOZkspgWGLPaQCv7jQdZdAAyqYkDzeyj/iHl1GlDcgQ0oHX8jW685Kqsw/o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729788404; c=relaxed/simple; bh=dHn7jSGLThaoMbEx/QzezbLNldawWtMqhWny1o1znV4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HQDFyr0dClRVnv8epey2ZafSitTsT0SYUK1zhbiDHjh6LOjX55/F5xTrpOP4+qWHBUONQKjm2FWR7fsRw6mLUGDLmwYzwFOS8BCGfShVtyDvx0yx8WKrzD6H99nUGALhLxk/Zv3PdwNNjr9gUD4mE1FrYXmDteFO/88xcqzF3p0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OSzu55z+; arc=none smtp.client-ip=209.85.160.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OSzu55z+" Received: by mail-qt1-f171.google.com with SMTP id d75a77b69052e-460ad98b031so6824371cf.0 for ; Thu, 24 Oct 2024 09:46:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729788401; x=1730393201; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=krpm8+olZZXBeM7oyucCBvFCqNhi/NWwQdLZGCjDOtQ=; b=OSzu55z+LL5jBmTcn8YGQdBL1jr0zP1g1VsMZePG+5OSWc8p9n6liGqATVaLw5avSQ dtOpI4ELmd3njZu+O61riKMYitBsRLBli3magw2/epudvG3HP2wDjz/Cc7LYir0Auqz/ ZtdyOoaS+/rPhj/EqeCr3MTEgqcbjHp1GR5TnRjYPY4AgFNL6FeHZQ4+YMD+bQL7mNe3 52sJJWbLZPmwtvcz4gMBHyJmwv1zzTbq78Y0f+rBUT7ejF0+rD6QWRXqIWW1CDP7phHJ 5f9vnxK/HeKLSgMss81FySkNGC7Cl4wwUpsQlc+DZzIdJxH9NH18c/h+UGjL28N/pbCW b8Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729788401; x=1730393201; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=krpm8+olZZXBeM7oyucCBvFCqNhi/NWwQdLZGCjDOtQ=; b=gLel4/B8O9gSA90aoOUGvLCTj3co/SbrBKJN8R/4I/KNx03PrnQTwfS8DR7+2X5LFr eQuXK06Zvr3cPzQpnBsY6JDlFMpQnTahmvMm+S6BJHEBFl5MHilBcZPvyck53fxk5rCf 5nxxnwXBw7R9kYuQtvZi6JZqy3VtazfA3uU+SrB4xpg6asvG1zggysXfnOgGKnpDVqNw ugsJbSXl3GQWX4bOCpljTi2UYnocjI7JZDYYSLXSb+zbH1God+k8Ml/MEBMsB7sMJAub PML+U6tVLsbiIc+Ysa6DS6UAEFdGgHb/nz5YUm1hxXCyig/TMxf2VMkSJWDI4oEmAzpR tupQ== X-Gm-Message-State: AOJu0YxA3dXAEVTLgEa0BivlnGJui48y3xgcT+eVBnxploqwXx15T/ay JlQh9iCSWPz0ZkNohywvUzZQYKpu8RdVnD0DWES1Jq3j0Je+IbRYw91dHA== X-Google-Smtp-Source: AGHT+IEofgW+Vs/hi/tkc2dAPCnJlkmvfCZsXjhBwSCSC0QnWwFm0SWHwj6APMFC/n875LHaT/Zxfw== X-Received: by 2002:ac8:7dc5:0:b0:460:9946:56af with SMTP id d75a77b69052e-461147080f6mr82953151cf.44.1729788401400; Thu, 24 Oct 2024 09:46:41 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4611a19be2csm16893901cf.70.2024.10.24.09.46.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 09:46:41 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 3/5] band: check the operating class band before checking e4 Date: Thu, 24 Oct 2024 09:46:33 -0700 Message-Id: <20241024164635.176631-3-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241024164635.176631-1-prestwoj@gmail.com> References: <20241024164635.176631-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 After the band is established we check the e4 table for the channel that matches. The problem here is we will end up checking all the operating classes, even those that are not within the band that was determined. This could result in false positives and return a channel that doesn't make sense. --- src/band.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/band.c b/src/band.c index 4e8eb9b0..09b2d932 100644 --- a/src/band.c +++ b/src/band.c @@ -1352,6 +1352,10 @@ check_e4: const struct operating_class_info *info = &e4_operating_classes[i]; + if (band != band_oper_class_to_band(NULL, + info->operating_class)) + continue; + if (e4_has_frequency(info, freq) == 0 || e4_has_ccfi(info, freq) == 0) { if (out_band) From patchwork Thu Oct 24 16:46:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13849403 Received: from mail-oo1-f50.google.com (mail-oo1-f50.google.com [209.85.161.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D79291D9A49 for ; Thu, 24 Oct 2024 16:46:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729788405; cv=none; b=hGqs9giAmLsWsac/qraqks7Elpodxxfds78fp+PK1iYcxCbd6OSZX1ZwVZdL7shvnSOt3z43T1ySC2Gq0larmygko/y6RbcWXUopECp3jYozMsJDXBtRl7nd228jn5gXDBop0O7HpVxJFqwo+dhJ3Fb6ESBnIjlYWkn0nL5cT+U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729788405; c=relaxed/simple; bh=hu+iBkHF+G2LcA7qhUm9vgvbIUqTExPESbJJeNgdxHE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ewlmE2LX3CPwea7iBu1x0Yzb03iYh682485320l4HgTpd5TdamUO4htC6yDny8qlSMtuk38+wvJ2R+Hy9FSLnvDP2GK9u53C19JHBoIUEf17dHuF+YbNldX2y7bIiFf4t9X68wBUb/EDu/6KG2gJ9NFsAzBDWwEl/NY69yiansA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EAmA4uyt; arc=none smtp.client-ip=209.85.161.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EAmA4uyt" Received: by mail-oo1-f50.google.com with SMTP id 006d021491bc7-5ebc349204cso604483eaf.3 for ; Thu, 24 Oct 2024 09:46:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729788402; x=1730393202; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bG0HBg2wVgGue8OUx9KsA7YxbRb+qvZfore06uaKbXg=; b=EAmA4uytH6Q730cTatz7MiMRmaMHtNuGwxU411ThaTmoNqv7+kyt6hHRVXJgrUHR9r r/8emBeWI4gmWwgUAIdaRN3tcxpx/ydpVoyvk1NqYK9Cs7rhXoSokHCZpcQ6fvi7xrC5 n+w2cQegFJ15fAiS8sauRGEyYz3FWzjoIaVQI/ddjYdEKlpiZwtCRJ8ZyqltHN+iwWMd RTqSI9hSreE/N0KAFGnqXy7f56j7EtPCE+Wucf3fxIrisYb1AnbmNW1i9uA95RJfni6L zNo0pqYKhingdHhxOROwX6EnpzOHWqzp0a+YVvAoL9i9YiPA0lsWSRcuF0heu/wX5Kav wvvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729788402; x=1730393202; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bG0HBg2wVgGue8OUx9KsA7YxbRb+qvZfore06uaKbXg=; b=D3CYVtXmWlF9wBZ8Rvfra7UvXPWaAyydNDWXXh1Q90ooZggXXW9zgm0Gpwp1PgCRr1 GnJk5HZU9P8vK22lOGGibvsOLxBFHL9KtiBxKHUfL/rbX/jVGBuJJDWHmeN8AJVaUD00 S0JhZgVO3tIajvlywsGsMktdJCp4DZdUH0bOKp6jgbhDUpDSuj1OfhLlfY22xJh0Lzy9 ZZ8PJZ/wa1orMnoe6VZvT7cCyhCKEg9NcWNgUQKaAhdFAZuXaHxHwcwPhwIuW51dENq8 uUyK0a0g/ZcBpro2Hmy0pAoEOADh6neeSkExyERH7AZ3ty64jXGR2Mqqf/kAkwQLjoyi unZA== X-Gm-Message-State: AOJu0Yxbbn8/hTZ57eR8p1SJzz0pKokwWsA3JRDS0l3f0VBh2Ofw/u8g gXx5Qyd6H86qwfnRw3J4Qx6eeQfcozKEFFTbRMjoLNu/S2ctiRm5XxoqTQ== X-Google-Smtp-Source: AGHT+IFzkkIt9tiU/4W9dxZFUBtiMAepEwsCxDr+HIE0d+SPSV8SILHPW+wKu2ZWgxYmNxUBOPmVcg== X-Received: by 2002:a05:6359:4589:b0:1c3:7cbf:f124 with SMTP id e5c5f4694b2df-1c3d81b4757mr500132055d.24.1729788402563; Thu, 24 Oct 2024 09:46:42 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4611a19be2csm16893901cf.70.2024.10.24.09.46.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 09:46:42 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 4/5] scan: warn on zero frequency when adding to request Date: Thu, 24 Oct 2024 09:46:34 -0700 Message-Id: <20241024164635.176631-4-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241024164635.176631-1-prestwoj@gmail.com> References: <20241024164635.176631-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This shouldn't ever happen, but if it does we want to alert the user. --- src/scan.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/scan.c b/src/scan.c index 2ffbef6d..c1ccc234 100644 --- a/src/scan.c +++ b/src/scan.c @@ -292,6 +292,9 @@ static void scan_freq_append(uint32_t freq, void *user_data) { struct scan_freq_append_data *data = user_data; + if (L_WARN_ON(!freq)) + return; + l_genl_msg_append_attr(data->msg, data->count++, 4, &freq); } From patchwork Thu Oct 24 16:46:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Prestwood X-Patchwork-Id: 13849404 Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3383349652 for ; Thu, 24 Oct 2024 16:46:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729788407; cv=none; b=aNHoCrRWGeKSOlpZWARy35HlwrQ7U483eFnIW2uKQU4RfzxOJ9a87+P2jc2fCi1UWvip3iTcIQZRD1QGekS+BiiQWFTDwLNtEZZa1J4CqyPfoh+GjBboW0WmMyKX8IFo6y8iuCfjF9f/r80/xUm80d5EFShfHRS09xDwwH0efj4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729788407; c=relaxed/simple; bh=MR7mFNfjMKeyVOe3kundCb8YPrXlEKOF+otl2P+VVIs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jhLNqnEIbxvYiIxB8XF2E0Ji6c3cJNQ+8kg7OPQ8f4MBpnD3uADvZeowmx9a5P1lIny3YpbFswsfiO9QCnqGD+NmNxvXLaL9xmF+eXnfeub7qRJsyrvhkOWYI4Hi1aRacz5xQ8c+rkT/x2N/BSX7pZhQuDE8+6b/SDKn9pIehqk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WhERKaKf; arc=none smtp.client-ip=209.85.160.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WhERKaKf" Received: by mail-qt1-f172.google.com with SMTP id d75a77b69052e-460ad98b043so9657561cf.1 for ; Thu, 24 Oct 2024 09:46:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729788404; x=1730393204; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sjWOfCdThaJarO+6nOahot5dWDiRv1jYtrAVn4BJZLs=; b=WhERKaKfxqzcZKSshUrRlNxxMeCKDIM50DY3XEw3C31Q5sGJAo/ZphHQ8dGRxW0Tcc pI/hG27FiBUOvHZe3USUYc9+gv6aatn2q5/ytlktO++3mXs6S9cBBPUWDTdYbJqwC4PM R+7hLTNDp8l62FUwS4drnSzJd4Nm9+iF/TcymYhc5Gnwus6O25Oex3lTFO1CirldmrGP yPrhCha4eLexNrj1SN41kMq8iQokgvXM8gZj5jCPLpc0Du6fA9ZvGIiyEwTYdh/C9mPn n8XrEIrHiRhb+N/bMm884OHa98ruvgaGkGfWueooC5yvHbfSGGMfxq3KNtV2h8aVEyhZ 8NRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729788404; x=1730393204; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sjWOfCdThaJarO+6nOahot5dWDiRv1jYtrAVn4BJZLs=; b=UKXQ8xHIzckpCrxrv02/jZzmgjanmeyqItQeD54VNoPH5s/RhkmhjFMV2NivHYLaRX angKNAwE8AsYWvGqaRUknZao8bHhhH/BJj4e1w016KTezucB/yx18Wv1DGrTJWlm8AWb iBaXN6Bmma+BbVK0GFhUqDLaTVVRzK9/acMOWr6FRj0EZTluCl2K5GVCTlzwg2gUaJAE ZlK3TCXbQbtlVt5W4XL+nTp6QMfopcuLpnnqU8DmLYSaw0NKSbifuSjo9+Zv3F7t1a9t wOuWVPd1NKjTOaGwsHPLiBWqj/nTMMqaPBjFaArWMw2Q34KsIHlCI6G2+7f45foxaJXz tm/Q== X-Gm-Message-State: AOJu0Yyt0slkKffudrKKR410jP9Mo329Shz2Yj3d1KlLWTc6CAQLyWic 3w/BKbvl2/Gap0ISHjXGVnH07djwn170AW6THYczfMKO/21rBKlOnHyPJA== X-Google-Smtp-Source: AGHT+IEN0DVFiE6vXwJ5xtH6pDwBSgyUrzB2vyycVU9W8pZ0bPXgTJfrQvMfcGyupplaruISMIYrCg== X-Received: by 2002:a05:622a:19a5:b0:460:3764:2844 with SMTP id d75a77b69052e-4612526d419mr44636131cf.10.1729788403804; Thu, 24 Oct 2024 09:46:43 -0700 (PDT) Received: from LOCLAP699.localdomain ([152.193.78.90]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4611a19be2csm16893901cf.70.2024.10.24.09.46.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2024 09:46:43 -0700 (PDT) From: James Prestwood To: iwd@lists.linux.dev Cc: James Prestwood Subject: [PATCH 5/5] util: warn on invalid channels when iterating a frequency set Date: Thu, 24 Oct 2024 09:46:35 -0700 Message-Id: <20241024164635.176631-5-prestwoj@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241024164635.176631-1-prestwoj@gmail.com> References: <20241024164635.176631-1-prestwoj@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This should not happen but if it does we should alert the user. --- src/util.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/util.c b/src/util.c index 5ce764ae..8c690fc0 100644 --- a/src/util.c +++ b/src/util.c @@ -464,6 +464,11 @@ static void scan_channels_foreach(uint32_t channel, void *user_data) uint32_t freq; freq = band_channel_to_freq(channel, channels_data->band); + if (!freq) { + l_warn("invalid channel %u for band %u", channel, + channels_data->band); + return; + } channels_data->func(freq, channels_data->user_data); }