From patchwork Fri Aug 23 16:18:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13775532 Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.53]) (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 E012818B48B for ; Fri, 23 Aug 2024 16:18:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724429933; cv=none; b=jKWwIE0u3FiCsEI+ruNy/xATM0ahuPWQbbabWZWLmZQToy0PlB7lly9w8GEAdF8cRzsL4WnNy+olSyunEFuiysPNdohl343ef6hMqT+p6xIo7dVEgxtmmuaIa+r4CE8IRH5PZpI9N6BW6o3B5XAbx3SaxWx5FvvkmnBAndki4+8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724429933; c=relaxed/simple; bh=XxZkihA7tSt++eOfspFzxqcv1ptoT0fnC9vtH54dsxc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=CqyuEaaP5G2jdm5PWqgASdVNXQImjXWPT9JbTP6M24K53uJs74tkolGRJC7K9UNubY8ArynjQ0C0EXdU55GiR0ax7BEG53XG9/BD0oCONsbw8nBjKXUUti6BnzDP8eV6f2WZ/CT0gWj8gUyAAJ/900hPgPiE7xb//4R+2FHhr48= 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=Kn/Tm65l; arc=none smtp.client-ip=209.85.210.53 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="Kn/Tm65l" Received: by mail-ot1-f53.google.com with SMTP id 46e09a7af769-70943713472so1566056a34.2 for ; Fri, 23 Aug 2024 09:18:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724429931; x=1725034731; 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=mcM1bahmD4Y3M0YD3wXaAkp7HwsFE+2TZgZYp2qx/mQ=; b=Kn/Tm65lcj+mzkge6ap6a1vXzto4MSgnddMCh+m74Al9LGdcWsfRmtZcmzSBlf6d/g reqAreuL26Z3ZBsAg9GG6qygpuXICtqnwLNcReGFYzRZv+DI5Mh4/t4vgCi6SSEhw55f XR0sFv9yS3tGm2Afc+iqav/M8X7uro9tNTwYkOFcwOyazZ4hszdF3PbuKAfa7qoxFS9k ls4zowbhsSUl/qgJjRdB1DEJ8iIIfAeSqEAREnC7pU1EJfayeGBO5P9GGg/lRU+pgieM +dinqBdDt0QG0uUmEzFoRoTgaS44LPKFYVHYo+R9kdRu4DVOjs0Jf3nAMhliuZN3bUUA ExYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724429931; x=1725034731; 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=mcM1bahmD4Y3M0YD3wXaAkp7HwsFE+2TZgZYp2qx/mQ=; b=uJ+gn0BoGhBJPMKjTeRyBPtBmWen/IIHi2Lcaa986GuJF3q7um8LDFhYRPjFfukOcb bF6FkYb0wc30KqYwifsppgXHNSnQGiTXNccxqp/xWhpfZp/94Z0hG+3JtQBlIBipVUq6 xlV/VlGrn9+lGZHEnvlipOr/nMS1tFFIWbOK/CkJq7HlXLfGzUQho+0N/IQMAm7rBcMJ IygVMAcnjk6ux9vg/GYUD1LRhM8RMnyxgwZzxkgT02wBKpUXqDLbCAjxP4GHz3CKTMRw 8MyYCwY4FqSyMlSFTsIEYmtSDPdifBC3BbhCtj3gUncGm1GEy/BklMr8mFHZA2xtX32A Bn3w== X-Gm-Message-State: AOJu0YzMBkhZta2UQf2GtY+Evh1ij4u5Dd5XedT96fVxoXaHamy0ngzD eDAkt1JjOqJawH9bCLbVQiIWkVL8Himkv/vF7JfWCAotPT4XM24RPUZ2pQ== X-Google-Smtp-Source: AGHT+IED8RqxX0inj/L4pWPMVAqoHsPfW04/OpXb6l7ZsDwS0oEY1qdD3Ke1cYgrsx/x0NQmp5v+Rg== X-Received: by 2002:a05:6808:6493:b0:3db:25f6:a59c with SMTP id 5614622812f47-3de2a8348e3mr4072680b6e.6.1724429930689; Fri, 23 Aug 2024 09:18:50 -0700 (PDT) Received: from archdev.attlocal.net (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3de2256f44asm764507b6e.31.2024.08.23.09.18.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 09:18:50 -0700 (PDT) From: Denis Kenzior To: iwd@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 1/5] defs: Add defs.h to hold certain global definitions Date: Fri, 23 Aug 2024 11:18:29 -0500 Message-ID: <20240823161848.485685-1-denkenz@gmail.com> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This will help to get rid of magic number use throughout the project. The definitions should be limited to global magic numbers that are used throughout the project, for example SSID length, MAC address length, etc. --- Makefile.am | 3 ++- src/ap.c | 8 ++++---- src/crypto.c | 3 ++- src/defs.h | 13 +++++++++++++ src/dpp-util.h | 5 ++++- src/eap-wsc.c | 4 ++-- src/handshake.h | 2 +- src/ie.c | 2 +- src/ie.h | 3 ++- src/knownnetworks.h | 4 +++- src/network.c | 2 +- src/p2putil.h | 3 ++- src/rrm.c | 4 ++-- src/scan.c | 2 +- src/scan.h | 4 +++- src/station.c | 4 ++-- src/storage.c | 3 ++- src/util.c | 5 +++-- src/wsc.h | 2 +- src/wscutil.c | 2 +- src/wscutil.h | 4 +++- unit/test-util.c | 3 ++- 22 files changed, 57 insertions(+), 28 deletions(-) create mode 100644 src/defs.h diff --git a/Makefile.am b/Makefile.am index d438a5bad7e4..61d46d7dc1a5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -214,7 +214,8 @@ eap_sources = src/eap.c src/eap.h src/eap-private.h \ if DAEMON libexec_PROGRAMS += src/iwd -src_iwd_SOURCES = src/main.c linux/nl80211.h src/iwd.h src/missing.h \ +src_iwd_SOURCES = src/main.c linux/nl80211.h src/iwd.h \ + src/missing.h src/defs.h \ src/netdev.h src/netdev.c \ src/wiphy.h src/wiphy.c \ src/device.c \ diff --git a/src/ap.c b/src/ap.c index b4e7593e5eef..6650f0af6e89 100644 --- a/src/ap.c +++ b/src/ap.c @@ -67,7 +67,7 @@ struct ap_state { ap_stopped_func_t stopped_func; void *user_data; - char ssid[33]; + char ssid[SSID_MAX_SIZE + 1]; char passphrase[64]; uint8_t psk[32]; enum band_freq band; @@ -153,7 +153,7 @@ struct ap_wsc_pbc_probe_record { }; struct ap_network { - char ssid[33]; + char ssid[SSID_MAX_SIZE + 1]; int16_t signal; enum security security; }; @@ -181,7 +181,7 @@ static int network_signal_compare(const void *a, const void *b, void *user) static struct ap_network *ap_network_find(struct ap_state *ap, struct scan_bss *bss) { - char ssid[33]; + char ssid[SSID_MAX_SIZE + 1]; memcpy(ssid, bss->ssid, bss->ssid_len); ssid[bss->ssid_len] = '\0'; @@ -3629,7 +3629,7 @@ static int ap_load_config(struct ap_state *ap, const struct l_settings *config, return -ENOMSG; len = strlen(strval); - if (len < 1 || len > 32) { + if (len < 1 || len > SSID_MAX_SIZE) { l_error("AP SSID length outside the [1, 32] range"); return -EINVAL; } diff --git a/src/crypto.c b/src/crypto.c index 15a7cde784f0..35941a2e3c3c 100644 --- a/src/crypto.c +++ b/src/crypto.c @@ -35,6 +35,7 @@ #include "ell/useful.h" #include "src/missing.h" +#include "src/defs.h" #include "src/crypto.h" #define ARC4_MIN_KEY_SIZE 1 @@ -567,7 +568,7 @@ int crypto_psk_from_passphrase(const char *passphrase, if (!crypto_passphrase_is_valid(passphrase)) return -ERANGE; - if (ssid_len == 0 || ssid_len > 32) + if (ssid_len == 0 || ssid_len > SSID_MAX_SIZE) return -ERANGE; result = l_cert_pkcs5_pbkdf2(L_CHECKSUM_SHA1, passphrase, diff --git a/src/defs.h b/src/defs.h new file mode 100644 index 000000000000..b83763b85a10 --- /dev/null +++ b/src/defs.h @@ -0,0 +1,13 @@ +/* + * Wireless daemon for Linux + * Copyright (C) 2024 Cruise, LLC + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#ifndef __DEFS_H__ +#define __DEFS_H__ + +#define SSID_MAX_SIZE 32 + +#endif diff --git a/src/dpp-util.h b/src/dpp-util.h index dc8a894b2bb4..86ef36f9bb46 100644 --- a/src/dpp-util.h +++ b/src/dpp-util.h @@ -19,6 +19,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ + +#include "src/defs.h" + struct l_ecc_point; struct l_ecc_scalar; enum ie_rsn_akm_suite; @@ -112,7 +115,7 @@ enum dpp_attribute_type { }; struct dpp_configuration { - char ssid[33]; + char ssid[SSID_MAX_SIZE + 1]; size_t ssid_len; uint32_t akm_suites; char *passphrase; diff --git a/src/eap-wsc.c b/src/eap-wsc.c index 789a20f032b9..4e940bf8b668 100644 --- a/src/eap-wsc.c +++ b/src/eap-wsc.c @@ -2067,7 +2067,7 @@ static bool eap_wsc_r_load_settings(struct eap_state *eap, str = l_settings_get_string(settings, "WSC", "WPA2-SSID"); if (str) { - if (strlen(str) > 32) + if (strlen(str) > SSID_MAX_SIZE) goto bad_string; wsc->m2->auth_type_flags |= @@ -2113,7 +2113,7 @@ static bool eap_wsc_r_load_settings(struct eap_state *eap, str = l_settings_get_string(settings, "WSC", "Open-SSID"); if (str) { - if (strlen(str) > 32) + if (strlen(str) > SSID_MAX_SIZE) goto bad_string; wsc->m2->auth_type_flags |= WSC_AUTHENTICATION_TYPE_OPEN; diff --git a/src/handshake.h b/src/handshake.h index 8a356e6b71f2..d1116472b177 100644 --- a/src/handshake.h +++ b/src/handshake.h @@ -141,7 +141,7 @@ struct handshake_state { bool supplicant_ocvc : 1; bool ext_key_id_capable : 1; bool force_default_ecc_group : 1; - uint8_t ssid[32]; + uint8_t ssid[SSID_MAX_SIZE]; size_t ssid_len; char *passphrase; char *password_identifier; diff --git a/src/ie.c b/src/ie.c index b180291a686f..c8bb70b96ade 100644 --- a/src/ie.c +++ b/src/ie.c @@ -2642,7 +2642,7 @@ int ie_parse_owe_transition(const void *data, size_t len, return -ENOMSG; slen = l_get_u8(ie + 12); - if (slen > 32) + if (slen > SSID_MAX_SIZE) return -ENOMSG; /* diff --git a/src/ie.h b/src/ie.h index 82945de676a9..4498785a8b6c 100644 --- a/src/ie.h +++ b/src/ie.h @@ -23,6 +23,7 @@ #include #include #include +#include "src/defs.h" /* * Information elements, IEEE Std 802.11-2012 ch. 8.4.2 and @@ -565,7 +566,7 @@ struct ie_fils_ip_addr_response_info { struct ie_owe_transition_info { uint8_t bssid[6]; - uint8_t ssid[32]; + uint8_t ssid[SSID_MAX_SIZE]; size_t ssid_len; uint8_t oper_class; uint8_t channel; diff --git a/src/knownnetworks.h b/src/knownnetworks.h index c81bd9aaaf77..a117ded55d86 100644 --- a/src/knownnetworks.h +++ b/src/knownnetworks.h @@ -20,6 +20,8 @@ * */ +#include "src/defs.h" + #define SETTINGS "Settings" #define NET_HIDDEN SETTINGS, "Hidden" #define NET_AUTOCONNECT SETTINGS, "AutoConnect" @@ -84,7 +86,7 @@ struct network_config { struct network_info { const struct network_info_ops *ops; - char ssid[33]; + char ssid[SSID_MAX_SIZE + 1]; enum security type; struct l_queue *known_frequencies; int seen_count; /* Ref count for network.info */ diff --git a/src/network.c b/src/network.c index 300e8090df29..20d9a3ddb84f 100644 --- a/src/network.c +++ b/src/network.c @@ -63,7 +63,7 @@ static uint32_t known_networks_watch; static uint32_t event_watch; struct network { - char ssid[33]; + char ssid[SSID_MAX_SIZE + 1]; enum security security; char *object_path; struct station *station; diff --git a/src/p2putil.h b/src/p2putil.h index 3a76414b04d4..7ca9fb2ec281 100644 --- a/src/p2putil.h +++ b/src/p2putil.h @@ -22,6 +22,7 @@ #include +#include "src/defs.h" #include "src/wscutil.h" struct l_queue; @@ -285,7 +286,7 @@ struct p2p_client_info_descriptor { struct p2p_group_id_attr { uint8_t device_addr[6]; - char ssid[33]; + char ssid[SSID_MAX_SIZE + 1]; }; struct p2p_interface_attr { diff --git a/src/rrm.c b/src/rrm.c index 7054db36aed1..a11a653287d7 100644 --- a/src/rrm.c +++ b/src/rrm.c @@ -108,8 +108,8 @@ struct rrm_beacon_req_info { uint8_t oper_class; uint8_t channel; /* The single channel provided in request */ uint16_t duration; - uint8_t bssid[6]; /* Request filtered by BSSID */ - char ssid[33]; /* Request filtered by SSID */ + uint8_t bssid[6]; /* Request filtered by BSSID */ + char ssid[SSID_MAX_SIZE + 1]; /* Request filtered by SSID */ bool has_ssid; uint32_t scan_id; uint64_t scan_start_time; diff --git a/src/scan.c b/src/scan.c index c46ef8a00c2d..9de235a82f0f 100644 --- a/src/scan.c +++ b/src/scan.c @@ -1325,7 +1325,7 @@ static bool scan_parse_bss_information_elements(struct scan_bss *bss, switch (tag) { case IE_TYPE_SSID: - if (iter.len > 32) + if (iter.len > SSID_MAX_SIZE) return false; memcpy(bss->ssid, iter.data, iter.len); diff --git a/src/scan.h b/src/scan.h index 06753b8268c4..50adca7cdc73 100644 --- a/src/scan.h +++ b/src/scan.h @@ -20,6 +20,8 @@ * */ +#include "src/defs.h" + struct scan_freq_set; struct ie_rsn_info; struct ie_owe_transition_info; @@ -62,7 +64,7 @@ struct scan_bss { }; struct ie_owe_transition_info *owe_trans; uint8_t mde[3]; - uint8_t ssid[32]; + uint8_t ssid[SSID_MAX_SIZE]; uint8_t ssid_len; uint8_t utilization; uint8_t cc[3]; diff --git a/src/station.c b/src/station.c index 333b0fa12691..30a1232ab570 100644 --- a/src/station.c +++ b/src/station.c @@ -498,7 +498,7 @@ static struct network *station_add_seen_bss(struct station *station, struct network *network; enum security security; const char *path; - char ssid[33]; + char ssid[SSID_MAX_SIZE + 1]; station_print_scan_bss(bss); @@ -3916,7 +3916,7 @@ static struct l_dbus_message *station_dbus_connect_hidden_network( if (!l_dbus_message_get_arguments(message, "s", &ssid)) return dbus_error_invalid_args(message); - if (strlen(ssid) > 32) + if (strlen(ssid) > SSID_MAX_SIZE) return dbus_error_invalid_args(message); if (known_networks_find(ssid, SECURITY_PSK) || diff --git a/src/storage.c b/src/storage.c index 4200030ca4f9..b756b1726618 100644 --- a/src/storage.c +++ b/src/storage.c @@ -45,6 +45,7 @@ #include "ell/useful.h" #include "src/missing.h" +#include "src/defs.h" #include "src/common.h" #include "src/storage.h" #include "src/crypto.h" @@ -315,7 +316,7 @@ const char *storage_network_ssid_from_path(const char *path, return NULL; if (filename[0] != '=') { - if (end == filename || end - filename > 32) + if (end == filename || end - filename > SSID_MAX_SIZE) return NULL; for (c = filename; c < end; c++) diff --git a/src/util.c b/src/util.c index 69019dc8f712..5ce764ae6402 100644 --- a/src/util.c +++ b/src/util.c @@ -34,6 +34,7 @@ #include #include "ell/useful.h" +#include "src/defs.h" #include "src/util.h" #include "src/band.h" @@ -45,7 +46,7 @@ const char *util_ssid_to_utf8(size_t len, const uint8_t *ssid) memset(buf, 0, sizeof(buf)); - if (len > 32) + if (len > SSID_MAX_SIZE) goto no_ssid; while (i < len && !ssid[i]) @@ -84,7 +85,7 @@ no_ssid: bool util_ssid_is_utf8(size_t len, const uint8_t *ssid) { - if (len > 32) + if (len > SSID_MAX_SIZE) return false; return l_utf8_validate((const char *)ssid, len, NULL); diff --git a/src/wsc.h b/src/wsc.h index 35ce91998665..bb6ff648522a 100644 --- a/src/wsc.h +++ b/src/wsc.h @@ -21,7 +21,7 @@ */ struct wsc_credentials_info { - char ssid[33]; + char ssid[SSID_MAX_SIZE + 1]; enum security security; union { uint8_t psk[32]; diff --git a/src/wscutil.c b/src/wscutil.c index 12e2125a73b9..934deeda49b6 100644 --- a/src/wscutil.c +++ b/src/wscutil.c @@ -500,7 +500,7 @@ static bool extract_ssid(struct wsc_attr_iter *iter, void *data) unsigned int len; len = wsc_attr_iter_get_length(iter); - if (len > 32) + if (len > SSID_MAX_SIZE) return false; ssid->iov_len = len; diff --git a/src/wscutil.h b/src/wscutil.h index 1d603d8ff644..91e74a5a2d2c 100644 --- a/src/wscutil.h +++ b/src/wscutil.h @@ -20,6 +20,8 @@ * */ +#include "src/defs.h" + struct iovec; /* Wi-Fi Simple Configuration Technical Specification v2.0.5, Section 12 */ @@ -330,7 +332,7 @@ static inline unsigned int wsc_attr_iter_get_pos(struct wsc_attr_iter *iter) } struct wsc_credential { - uint8_t ssid[32]; + uint8_t ssid[SSID_MAX_SIZE]; uint8_t ssid_len; uint16_t auth_type; uint16_t encryption_type; diff --git a/unit/test-util.c b/unit/test-util.c index 3c143cd7958a..0bfd1587c008 100644 --- a/unit/test-util.c +++ b/unit/test-util.c @@ -31,11 +31,12 @@ #include #include +#include "src/defs.h" #include "src/util.h" struct ssid_test_data { size_t len; - uint8_t ssid[32]; + uint8_t ssid[SSID_MAX_SIZE]; const char *string; bool result; }; From patchwork Fri Aug 23 16:18:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13775533 Received: from mail-ot1-f44.google.com (mail-ot1-f44.google.com [209.85.210.44]) (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 6D9E318BBAE for ; Fri, 23 Aug 2024 16:18:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724429933; cv=none; b=Mk85jNjmjrveqxbYL8er3a81XwuwEX/5jV8Ea8ppT7gj3rytLvRMNxiPo4XD7/fyVqSObj2VEumXjKgWXvGT2iDrLa3dazA48cVP74ILHtsQBSoihYuiR56GRbycE6+0WN+mahYANI/zo7DWAg+1+IttwFXIkuvsoQF53qO2UfU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724429933; c=relaxed/simple; bh=Wt1L3rvUCgGk/Fmd4JyHvdnJtbAnPIzK4M1f0nWIuPg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=I2aqFKdu6HGMmZhGp55k1Uc36RHQVHTI6YZNzVSowfnqBstVNyurbBsUCyr7OOO37FFbXSy0GucEtFHMOaowjUq8stSc2LJcjuozQYkxdzcw7kEhdRUecqgVz10vT1Z5H1PFvW+1GSaZu9l2gqLEjAjmqiM8NkF5mLk1+uMuHP8= 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=F3qukC4r; arc=none smtp.client-ip=209.85.210.44 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="F3qukC4r" Received: by mail-ot1-f44.google.com with SMTP id 46e09a7af769-70949118d26so1949726a34.0 for ; Fri, 23 Aug 2024 09:18:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724429931; x=1725034731; 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=1WebbZ9lHvQZT9Sw6xHXxgzZUXxZibJ2W7RwWkA+K7k=; b=F3qukC4r4p6NwdEI5Tplq7vAbHQujTRBnddAHQiarU/Yc6shY/yYYNYzXSSb0l1D4M wYFrkTk+WNwCRJuPFPD+FWGEF1sWebzEYt4Do4roXy+2G8XZRWYsFhtMYxHvyWTLUr3F +HJF65H39yL5VLY6sNE5pwKFUSapa1xJYUn6tEfET/rk9OVNw6A6viIOCgm5SWHYWIAu l9ke8btjmdW4w322lMc1rlPUF8+Qcqgt+aFdM3iAgfuOtjm/RplyWMOF/Z11ZaXDQT0n UCfB7iGVhsb3WXmC+xwTUTz92+sj4i2GvYgGf7M6keX7EejsgSMtHWkO75Fe5OFsTRU7 GuTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724429931; x=1725034731; 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=1WebbZ9lHvQZT9Sw6xHXxgzZUXxZibJ2W7RwWkA+K7k=; b=DlGXz9aYKcQxHFeK36nJ/scy9/8PNs10MJtBIRPFjD8mmjxtKPMZ5sdHedTwi9w153 Trt1tk351FoiyNmVXn8f4AiRY6z8dJsStceJ8p8+V0iT5r9T2XuUvJcynwF1I1qqxBzu jVk4NuE4X30CSlESWNvKg3HARq6LHQ1lu10iU2/xrWzjJjIKF7XOGA+kkx/+PQxwsAFc yK53HD3KAgkqzLhfqPjSXZ9reaQYDXafCr4Iw8I7uXGTgc+p7UF5Sz2MUYpbODnlnTVJ 3Nu3DNpOIHP2b1Tbj/aMAz7Bt22A94L9v0xHmfAFIDIP+8N9kILUhwqW6xPvo7rug6+r RE+w== X-Gm-Message-State: AOJu0YzbGKpEGi+5tW2F+j5dMSdumqi/8PpE7CVwXTobl1/oGjGsMuFm uqQGAMpcESDcZZ9C/2oc1xdz23kzZiMxVjQvsB1xJHHQ8jPq9TrVPZB5hg== X-Google-Smtp-Source: AGHT+IHUAAI6weVyJxLZHZ5Pr2q5jerwXEXn8VTD3Q7ijNQAOG6ue/nKyPbA3FEwl8/EhDo/vGeHsg== X-Received: by 2002:a05:6808:1488:b0:3d9:350b:4159 with SMTP id 5614622812f47-3de2a8b92e1mr2642612b6e.31.1724429931412; Fri, 23 Aug 2024 09:18:51 -0700 (PDT) Received: from archdev.attlocal.net (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3de2256f44asm764507b6e.31.2024.08.23.09.18.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 09:18:51 -0700 (PDT) From: Denis Kenzior To: iwd@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 2/5] monitor: Don't dump survey results with noscan Date: Fri, 23 Aug 2024 11:18:30 -0500 Message-ID: <20240823161848.485685-2-denkenz@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240823161848.485685-1-denkenz@gmail.com> References: <20240823161848.485685-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Survey is used after each scan, creating quite a bit of spam. Silence survey results if noscan is set. --- monitor/nlmon.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/monitor/nlmon.c b/monitor/nlmon.c index 214246ea72c2..f0ffff90b1d7 100644 --- a/monitor/nlmon.c +++ b/monitor/nlmon.c @@ -7254,8 +7254,10 @@ static void print_message(struct nlmon *nlmon, const struct timeval *tv, if (nlmon->nowiphy && (cmd == NL80211_CMD_NEW_WIPHY)) return; - if (nlmon->noscan && ((cmd == NL80211_CMD_NEW_SCAN_RESULTS) || - (cmd == NL80211_CMD_TRIGGER_SCAN))) + if (nlmon->noscan && L_IN_SET(cmd, NL80211_CMD_NEW_SCAN_RESULTS, + NL80211_CMD_NEW_SURVEY_RESULTS, + NL80211_CMD_TRIGGER_SCAN, + NL80211_CMD_GET_SURVEY)) return; switch (type) { From patchwork Fri Aug 23 16:18:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13775534 Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) (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 3D26418892E for ; Fri, 23 Aug 2024 16:18:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724429934; cv=none; b=crAFNxDgiuB0Bsz0rk8FYi6MSOmpkZL0c1jfX6N+BGdgLE3MElPuIt+ebabvGSFricKRciIOytRqgV39qjYLRXFTdRpppjZKPNGrcbmLOPn+FBZzRP6qhPvcivV68j8iNQZpgxRJyOjKzvyZlZopdhaAKJh4l1uDpM8coQ+Ossk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724429934; c=relaxed/simple; bh=k+gwELWhCl2tT5Z+M/ozsYvIRtZ3jrG9Nmu1ZtXjmRM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=B8b7ggNgt6VaTwelC4e/14NPZcbRwZiPKeE/GhJHEXs6gMou8WwyjC+un04+IXXYPjeJAtwm+0WN+Wi027dd8UEKqLAvrqd/enu0cQIzIEe/bHJvZztDH0lblCn7+3quaL7qP5Z2eWVHQRva41Ghet/9qnTODCnozXe1fAQUFi4= 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=MskGkle/; arc=none smtp.client-ip=209.85.210.54 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="MskGkle/" Received: by mail-ot1-f54.google.com with SMTP id 46e09a7af769-7095bfd6346so2007126a34.0 for ; Fri, 23 Aug 2024 09:18:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724429932; x=1725034732; 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=oxemUu+2Rm9/aUBJQkgXC98PFHj3e83BRDwwcfPNjMA=; b=MskGkle/+6Qbx/YHflQvONpaeB8SxZnL7t5nSv6DQBiZlS6MJ9RlQzo/C5xAD5I1UW kLd/Um+wa79zx2uW0udXsFl0PktKZ+xtQYWIvN9EOIjo6UAcRurUHdRODugD3RyAfeJz uChDh0prDkuk1C7gV6fy6dkxVu9u4rII0PdtyXFBZtX/Hkv/EaMmirfv0NtCd/KP6Xso vzJmI58dBS+Rxm2DSkdqT8x4Y0EpgJwevKvPA/14F8ixCh4QZf/i7pxy9Upa7sRlW76a dks/Vajrpqzi/LSzGdXp7aFyqM5ON0wD/nHASz0rzrPuk+hnvUj9Mr+ezDDOY4dBIhrO +zXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724429932; x=1725034732; 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=oxemUu+2Rm9/aUBJQkgXC98PFHj3e83BRDwwcfPNjMA=; b=u/tEQI8hB+/18nLF0PLThULnW5P7ICDP+maxxGQSKbXWBYuIRXqLNHmiZt5+fWMf6e 0cfyvkEIN2UD0s0InzkcyoLyVOCYf+rzTpi4E3BsqUYdgk9gZGyywlMPsYvAhCN0E+V2 0/gCLwFkSVhTLVs2XILB/lkwXbZFg1b3a1SHjJDv+2YUushxpaanqeyjRbIsWPYjyrbu k74mDvCeLc1AyZtQcos6G9oSfeW4EZcZ016dHebIfRvoE99NTLR7gwnaaXN/4G9keXHp 8GQBj+MxaawLYr2XztxJoffHw35xMlDMDKvPzwaIPmnU0xl7L3F3UiK8Lk9Lurb5Ajcw 3xcA== X-Gm-Message-State: AOJu0YyPweZmFVyCJqJKVpFWYNTgwMTsn3phfMsZv+oOZCDp2GxHNcfi 7AftY3uAmMxXEqt61TjVm/36wYsVKvXRETFNosXSyxl2NCku14EsV0B3xw== X-Google-Smtp-Source: AGHT+IE2hsCkxxyRMjmiw0CnVfVRkWYK+ZEL5jModQoTbsoAoryrZlJbWEZ/fcLmPCQQ4QUiYXfp/A== X-Received: by 2002:a05:6808:1914:b0:3d5:65d5:edae with SMTP id 5614622812f47-3de2a8a0828mr3242717b6e.27.1724429932109; Fri, 23 Aug 2024 09:18:52 -0700 (PDT) Received: from archdev.attlocal.net (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3de2256f44asm764507b6e.31.2024.08.23.09.18.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 09:18:51 -0700 (PDT) From: Denis Kenzior To: iwd@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 3/5] monitor: Don't skip genl control Done,Error messages Date: Fri, 23 Aug 2024 11:18:31 -0500 Message-ID: <20240823161848.485685-3-denkenz@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240823161848.485685-1-denkenz@gmail.com> References: <20240823161848.485685-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- monitor/nlmon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/monitor/nlmon.c b/monitor/nlmon.c index f0ffff90b1d7..f7b0f9a14aa6 100644 --- a/monitor/nlmon.c +++ b/monitor/nlmon.c @@ -8312,7 +8312,8 @@ void nlmon_print_genl(struct nlmon *nlmon, const struct timeval *tv, continue; } - if (!nlmon->read && nlmsg->nlmsg_type != nlmon->id) + if (nlmsg->nlmsg_type >= NLMSG_MIN_TYPE && !nlmon->read && + nlmsg->nlmsg_type != nlmon->id) continue; nlmon_message(nlmon, tv, nlmsg); From patchwork Fri Aug 23 16:18:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13775535 Received: from mail-oo1-f42.google.com (mail-oo1-f42.google.com [209.85.161.42]) (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 EB48D18BC2C for ; Fri, 23 Aug 2024 16:18:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724429935; cv=none; b=Cp9X7lrxOxwn+VdaLq4ISIymz3VQgYOiIhaf+ymxeHbvkAg209K8GnszEWaMQONZGgeIQzC3FOLt/RKMDdrWtE6lTrKmyUJSyW3r0TwYWgrdNHTHwU3uisshu6Q3RLt/YZtbuSSp6XLGBzEOLIwhYPjaz6b4zth/MgOb/6z8XDk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724429935; c=relaxed/simple; bh=U92AUM62hUgerDyg6jMPmHUva2dTtjgjU9ht4417tNQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZxnKfbMa7dokcGEbESksuPFb+Tf4LP0Nq6HkdYxk4JSNMc8UFX3krKBKjv43QshTxIZJFforZgnww9mOBCqcsrC4MUXG3pw1cDrJuF1eVCM3lr6nzXSQfaF4ddsZs4fTS/FluuoYvZ/lzWrJkN3V4DLv0R6hJEe1acAaT51RJH8= 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=jSyY5zI8; arc=none smtp.client-ip=209.85.161.42 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="jSyY5zI8" Received: by mail-oo1-f42.google.com with SMTP id 006d021491bc7-5d5af7ae388so1734440eaf.0 for ; Fri, 23 Aug 2024 09:18:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724429933; x=1725034733; 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=aVx44lvNE2f11u250ZB26TQ6LFaGj1zgcLZ55GJstOQ=; b=jSyY5zI8UjCTILOZA+OVXZ750N2yrP5yh0JZZDp8/aDPhxBBL5tfWeHJazTFpDQio+ zS0Ib6a+HotIwTEgf8XZuq75Vw+OrBYuoE2tS3YhFEaEty+5KY02rCgHybxvZtxeIzKb 2rE7ZApGKiCCQG3H+FS4ICUdLx62azPGfp2EFlyCaBcb4ArmqHuUwJegFiAUIr4FLkKf IPT67Yw3J+dDoezft0UN6/4bCLdmHU7B+nojUGGIzugUB70AmpESCSAjDZVHiYcvng0X qHveFnHnwAnr/GswbPunru37C57rYXw1+RB8dAwCrK3Wre7rfP4h/u4zuUXQE9AclX9X EdZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724429933; x=1725034733; 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=aVx44lvNE2f11u250ZB26TQ6LFaGj1zgcLZ55GJstOQ=; b=MTFnkLoPqrlYPGziLZmgJ5VbnLEZUe3OGgL4Az3EtnoFLlaW741lrIkJF/xsOvLcsH hZGfb2gDG8yfeEiwLcXquNvf3afd7VdWXMpRnZw5Vak6j5EtnvxgX8hnSdvZe3i1syzZ DB5lHU17SDa0hr/S3asZNQPM+FqXtL2rAXVNSqtvXOXPZa62wMlKykHzzisxj2CJayzY tbmPeZFTz4rG388e73J3rfMQfMutepayO48emiWDky9CWQgEvclUCnEpznrh3mmIjU5c Q3mq2IfSsEVYJ+gmI4IU8KXac0Bi6KpXX7ou2fpNr4jtSXrQ68yMNmnufZkl9oY/jdA/ Z+4g== X-Gm-Message-State: AOJu0YzkosieVOSfhjdgeDSee+kin2+CVEqS/c1W/jhFt5P+kmL/TKy1 PxhsnNjdHM7L6fHdvz/o0cshtAKcWc2MrMk+fgjmBJzRw8Uoyhu3/4hvuQ== X-Google-Smtp-Source: AGHT+IGbclyB23CwgnYjIDNxew3tBRXj8o+Owj2J5E9KUOJkZGe7R08Ywkp/9u0RCGEQhnCx77EP0Q== X-Received: by 2002:a05:6808:1206:b0:3db:199e:bdf2 with SMTP id 5614622812f47-3de20f9b694mr2399020b6e.17.1724429932848; Fri, 23 Aug 2024 09:18:52 -0700 (PDT) Received: from archdev.attlocal.net (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3de2256f44asm764507b6e.31.2024.08.23.09.18.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 09:18:52 -0700 (PDT) From: Denis Kenzior To: iwd@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 4/5] nl80211util: support attributes in CMD_EXTERNAL_AUTH Date: Fri, 23 Aug 2024 11:18:32 -0500 Message-ID: <20240823161848.485685-4-denkenz@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240823161848.485685-1-denkenz@gmail.com> References: <20240823161848.485685-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- src/nl80211util.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/nl80211util.c b/src/nl80211util.c index eaf9f610fc5f..c1218c21fcd2 100644 --- a/src/nl80211util.c +++ b/src/nl80211util.c @@ -132,6 +132,14 @@ static bool extract_iovec(const void *data, uint16_t len, void *o) return true; } +static bool extract_ssid(const void *data, uint16_t len, void *o) +{ + if (!len || len > SSID_MAX_SIZE) + return false; + + return extract_iovec(data, len, o); +} + static bool extract_nested(const void *data, uint16_t len, void *o) { const struct l_genl_attr *outer = data; @@ -170,6 +178,7 @@ static attr_handler handler_for_nl80211(int type) case NL80211_ATTR_REG_ALPHA2: return extract_2_chars; case NL80211_ATTR_MAC: + case NL80211_ATTR_BSSID: return extract_mac; case NL80211_ATTR_ACK: return extract_flag; @@ -179,9 +188,13 @@ static attr_handler handler_for_nl80211(int type) case NL80211_ATTR_CHANNEL_WIDTH: case NL80211_ATTR_CENTER_FREQ1: case NL80211_ATTR_CENTER_FREQ2: + case NL80211_ATTR_AKM_SUITES: + case NL80211_ATTR_EXTERNAL_AUTH_ACTION: return extract_uint32; case NL80211_ATTR_FRAME: return extract_iovec; + case NL80211_ATTR_SSID: + return extract_ssid; case NL80211_ATTR_WIPHY_BANDS: case NL80211_ATTR_SURVEY_INFO: case NL80211_ATTR_KEY: From patchwork Fri Aug 23 16:18:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13775536 Received: from mail-ot1-f41.google.com (mail-ot1-f41.google.com [209.85.210.41]) (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 A591018B48B for ; Fri, 23 Aug 2024 16:18:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724429936; cv=none; b=c3MvdAGYW2uVnQvTz38Jd5f43CEwVtValV62vbszxIFKdPcdZlC8+WnRAxgY/sHbtVyGTTYS5Py9fFXu94DQwVI/GjXd1WkZm+JY9SH6jjsPAX8zxMBE5+/zGTzPZ7pt4xrROMjLPmnC4/ZDPKhyWsKsfPnLJryfngo6xnsqWQA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724429936; c=relaxed/simple; bh=TnFBnC6JW5XNKr3dIDga1stJFWwrWTgGay6+3pfKYTY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dn2nxwJ8IozH58Tgs/VYTYrXLm10GnBMniHWx5XcH6QYgZhy22DZTG9HJcraL5LDWciHQtfFxX1DA/DtYMwiN+DuSNkOqNISPqfBOqX7CwJzUCj9zxq+pyekROlFZoYobqbch0kHXt1RFt0KDCrjFpGmZbqwS4HWQ52oOGyVqz4= 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=H8roGn2S; arc=none smtp.client-ip=209.85.210.41 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="H8roGn2S" Received: by mail-ot1-f41.google.com with SMTP id 46e09a7af769-7094641d4e6so1130392a34.3 for ; Fri, 23 Aug 2024 09:18:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724429933; x=1725034733; 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=u3OCMrURtXx4pgY9lNgxDG5feWxitvjNiBazB79y9Mc=; b=H8roGn2SByyL3+9HeAqxEzHhADR5EQccPqOtskjq5KjjN4j3MoxxK1PVCtleMD8JFW SkTIE8L2x6wyHpMHoyoNCx/ruiFKnivsXS1ObE8a+fJz/zKYmD9Z5pzYZK8Nj5Ln1/vm +Rdxs9fI/DS+l3dKxLRmwMw0P+A6G/IYdmue1CtBLJozleSsbmSLTAA31iJ7z7/By3WO odcbQx92BE119XNIcp4xDqCLamSgUvdcsDUwR66DXGhSSY3HIsFH3jUVifCz/EzKKiu7 XH5pTpy+bIOJlSy6ha6nG1ctEmA2Z+QN39IyQ59JFmWA5nxOUZ3xGlzbN/NM7E4zI+l4 hdrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724429933; x=1725034733; 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=u3OCMrURtXx4pgY9lNgxDG5feWxitvjNiBazB79y9Mc=; b=p5tBugkz+Kz+WU4lJUCRpVhKMd/76uer7XCMMas2WYAX/VjtZJr9YVejhGBK4LHO+O A10FoVZqNfUIgiNq8nTVtP0txu80jz8QcK88ChmCmTiaO+ngh1WOkx+E04dYeAoXClE4 Luawt/ggZMq+zr5ZnQBdu62rYNkeLz39JghWTJFoH96P23Vbr4h1jqBxLZJZpopTOpHP M0jTZNyN8cbgZCaNFh8me6i4RIMnSjPZd6jJVMcudOFylGGMMmWdQFC+b5NRj23Zd+Iu sHevUnZh7liiquniWZW5L69v5Av2BHRdrIxL5qn0FgefDIvuBp7/2FRPY1+IK6ZdZqcQ CK/Q== X-Gm-Message-State: AOJu0YxUEQBC7afacxmDlRFgiVPQETqLGENaDDhQq0/TWPtpzWipRLiA IIUfI624KRXgvHUxmm1uYhIzxewr/Yo8dfc8bR/ZonFHWNOinuVl/NiRUg== X-Google-Smtp-Source: AGHT+IEC9E9Gz2ppvpF7U7+oQJ0bICIHAqf9hamG8NcGOL/pHjpmdcVRR1+vlh+G0modczVTNs4Vfw== X-Received: by 2002:a05:6808:1704:b0:3d9:2e2e:1ace with SMTP id 5614622812f47-3de2a90117emr3030559b6e.42.1724429933584; Fri, 23 Aug 2024 09:18:53 -0700 (PDT) Received: from archdev.attlocal.net (syn-070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3de2256f44asm764507b6e.31.2024.08.23.09.18.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 09:18:53 -0700 (PDT) From: Denis Kenzior To: iwd@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 5/5] nl80211util: Add builder for CMD_EXTERNAL_AUTH Date: Fri, 23 Aug 2024 11:18:33 -0500 Message-ID: <20240823161848.485685-5-denkenz@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240823161848.485685-1-denkenz@gmail.com> References: <20240823161848.485685-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This is for sending status from the STA to the driver --- src/nl80211util.c | 15 +++++++++++++++ src/nl80211util.h | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/src/nl80211util.c b/src/nl80211util.c index c1218c21fcd2..fcf70b9f1740 100644 --- a/src/nl80211util.c +++ b/src/nl80211util.c @@ -654,6 +654,21 @@ struct l_genl_msg *nl80211_build_cmd_frame(uint32_t ifindex, return msg; } +struct l_genl_msg *nl80211_build_external_auth(uint32_t ifindex, + uint16_t status_code, + const uint8_t *ssid, size_t ssid_len, + const uint8_t bssid[static 6]) +{ + struct l_genl_msg *msg = l_genl_msg_new(NL80211_CMD_EXTERNAL_AUTH); + + l_genl_msg_append_attr(msg, NL80211_ATTR_IFINDEX, 4, &ifindex); + l_genl_msg_append_attr(msg, NL80211_ATTR_STATUS_CODE, 2, &status_code); + l_genl_msg_append_attr(msg, NL80211_ATTR_SSID, ssid_len, ssid); + l_genl_msg_append_attr(msg, NL80211_ATTR_BSSID, 6, bssid); + + return msg; +} + int nl80211_parse_chandef(struct l_genl_msg *msg, struct band_chandef *out) { struct band_chandef t; diff --git a/src/nl80211util.h b/src/nl80211util.h index d966e04978c9..67fd7d7bdaa6 100644 --- a/src/nl80211util.h +++ b/src/nl80211util.h @@ -87,6 +87,11 @@ struct l_genl_msg *nl80211_build_cmd_frame(uint32_t ifindex, struct iovec *iov, size_t iov_len); +struct l_genl_msg *nl80211_build_external_auth(uint32_t ifindex, + uint16_t status_code, + const uint8_t *ssid, size_t ssid_len, + const uint8_t bssid[static 6]); + 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,