From patchwork Fri Dec 1 04:00:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13475323 Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.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 0BD2B5384 for ; Fri, 1 Dec 2023 04:01:10 +0000 (UTC) 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="lZHFJsY4" Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-58dd3528497so963847eaf.3 for ; Thu, 30 Nov 2023 20:01:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701403270; x=1702008070; 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=L+v5VBIiaB37xH0jA0zADP47MnQyOipE3OWhzinZU5w=; b=lZHFJsY4gHHF5UM8i6p6WQew7eK4dqTpztBiNrzWqIrQtUUb7Jd7qQoZ10twswqMAs 7/0I0wsTgXBWSdKRKQ2CRXzRHBPePifMFLjaS8lzMBbGPhfEnCCQBb9ukb4T039cJhAR 2/TT2DD8/3fTWPm81JiYjgFwJgRX8Lfzx8GXvB24l6qfLV1cPLLQ1OXbB/YjFllgnQdw OVuWCtbL0O95vKs03mI+QRU7jrg3Vej6W8tRp3b6jgK/7sLGQULn9ZqKRTmnTFvpw0dL RUxvHTJmfMlmjbhTFlklBormO60pB4AI6jk5T0/pN9GtUuyIwXmA/mhRE8KFM9F1CHlT 1a4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701403270; x=1702008070; 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=L+v5VBIiaB37xH0jA0zADP47MnQyOipE3OWhzinZU5w=; b=wEukxiinQNyer/4x8o0ZBMGLANu2Dm/xRKtEOVdlMU3Fd5jg2/itx0fkoI9q03EoKx HD0yihkKLvqRBQ/IORbwCXn+2G/7CTnILoQKzzmCVPGDXRKw+ZbDkwmTMuYEXGGEUCJk MPQRoMxs2oJNvvSl2U2RCHmF/QJhpXO3HHw5krTzoXiETaIOs9B0KNYjKnsIOQPnsux/ QeupKnubD3BRxoLI9Q3cPgQA3dh0ale9cI++cK/AZq+i1l8fP0itrVVatYgsOsLOl1nU XryImPjCbF5aY5m3eg5hojTCio7mzonE++nN86QyCeO1pX0wH3L3+4J3bRSuaGTEogTn AZQg== X-Gm-Message-State: AOJu0Yy1ZUo6Op1Qb/nWR9S6oqHIeCG9p8aelmCzfNlFmF4vsmrx4pe+ fvbyzwkKWdfk/Ivjkk8s4RVBUlKi9JE= X-Google-Smtp-Source: AGHT+IH/Que1pfoiMx3OdQ6H8QLs2qY17TwKxP3XJRj9M0bRBsOPpCHC/gQuJddVxUb+Fx0CpBtl+w== X-Received: by 2002:a05:6820:1692:b0:589:db63:bfd1 with SMTP id bc18-20020a056820169200b00589db63bfd1mr2217639oob.8.1701403269746; Thu, 30 Nov 2023 20:01:09 -0800 (PST) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id o3-20020a4ad143000000b0058ab906ae38sm404005oor.2.2023.11.30.20.01.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 20:01:08 -0800 (PST) From: Denis Kenzior To: iwd@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 1/7] handshake: Add cleanup function for handshake_state Date: Thu, 30 Nov 2023 22:00:01 -0600 Message-ID: <20231201040020.161143-1-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To allow _auto_(handshake_state_free) variables to be used. --- src/handshake.c | 7 ++++++- src/handshake.h | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/handshake.c b/src/handshake.c index 6b93774ab137..1c5ed2c9bc12 100644 --- a/src/handshake.c +++ b/src/handshake.c @@ -105,7 +105,12 @@ void __handshake_set_install_ext_tk_func(handshake_install_ext_tk_func_t func) void handshake_state_free(struct handshake_state *s) { - __typeof__(s->free) destroy = s->free; + __typeof__(s->free) destroy; + + if (!s) + return; + + destroy = s->free; if (s->in_event) { s->in_event = false; diff --git a/src/handshake.h b/src/handshake.h index 7200c3617b8e..815eb44ff6ba 100644 --- a/src/handshake.h +++ b/src/handshake.h @@ -24,6 +24,7 @@ #include #include #include +#include struct handshake_state; enum crypto_cipher; @@ -298,3 +299,5 @@ const uint8_t *handshake_util_find_pmkid_kde(const uint8_t *data, size_t data_len); void handshake_util_build_gtk_kde(enum crypto_cipher cipher, const uint8_t *key, unsigned int key_index, uint8_t *to); + +DEFINE_CLEANUP_FUNC(handshake_state_free); From patchwork Fri Dec 1 04:00:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13475324 Received: from mail-oo1-f53.google.com (mail-oo1-f53.google.com [209.85.161.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 9C23A5388 for ; Fri, 1 Dec 2023 04:01:11 +0000 (UTC) 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="ldbYetKX" Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-58d9a4e9464so859823eaf.0 for ; Thu, 30 Nov 2023 20:01:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701403270; x=1702008070; 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=RQ5YhLfDEuWDFPniwXZVE5AbyeNPpLG0QRLsYCodl8M=; b=ldbYetKXFefh+v64Q7KeuEwRRfrLrC/lLDkCuJB10OqyZJzPLMvnBETHBkc+qpOJF0 s4XqdNj/Dfbj/CImTAVfRMi5yb+taOqyH/3Cyt5kBGZeMPecJ5ak0ePkYrtXzXYwkaSi tI2uZX098KfvmH291h4vP7yFuQWmUJ3sQ9xjJRIoEvVUZiPlVY3GHZABbAVkx4FLeCz5 OG3o1sc/RLlarYGJ/5/YDjAo9jkhwvG5O3TAgcSLhrUqV98O9yR9OzB6QXF7IA7f73YN uLtE3gC4AyQjgZmPBMcnOp3gDfZ3JSp7Y0y8j0sPVvVxFB6LmsvxGDidq1PdTjw9ME07 Yz8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701403270; x=1702008070; 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=RQ5YhLfDEuWDFPniwXZVE5AbyeNPpLG0QRLsYCodl8M=; b=bwYBk97I5Edf736RyFeXqGctsxA9YgGOhhRSEh6Wo9XEgDo515AVnmPwDZHqH3QoMT DNeyziLBpG/wqBkiUEYNeLN5EsTY+megbZNO+D1U4+ZRvyC1Wo/TTj9AG/8urcsVgrui mZ2nAlZMS/zrFDDKIO2OF/eNDjtSKlyepDSAnS1o7uc91KszS6n/ZfDYRKd5P74C/U30 FfYmnkpro0aC60NuRJ3tL4B19f7XhtydBoCZm4zVxssanDmr1iwQhMyBKZcORXt8v02I z0zxvHZONLmlp6vduHmbxBFNhlGYjy9Jix59jo1nZyjdiFJBlFh9aa3oS2jhNRt258XC s9oQ== X-Gm-Message-State: AOJu0YyiuZ7ET4f3ZHbkVReIcIi31vASb12TEZWIZFFB86ipB3OmIH1X /H3EPkedGPGR14fxMAPg401v/ZsOit0= X-Google-Smtp-Source: AGHT+IFk7SsQCYcjJh2aynQ7e/XkxgbLsHfN1apnzE2Q9WL0QmfhiWj6KDN18clgjzFQUf9E2RAVUA== X-Received: by 2002:a4a:e0c4:0:b0:58d:d938:26ac with SMTP id e4-20020a4ae0c4000000b0058dd93826acmr1509178oot.8.1701403270558; Thu, 30 Nov 2023 20:01:10 -0800 (PST) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id o3-20020a4ad143000000b0058ab906ae38sm404005oor.2.2023.11.30.20.01.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 20:01:10 -0800 (PST) From: Denis Kenzior To: iwd@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 2/7] p2p: Simplify handshake_state cleanup Date: Thu, 30 Nov 2023 22:00:02 -0600 Message-ID: <20231201040020.161143-2-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231201040020.161143-1-denkenz@gmail.com> References: <20231201040020.161143-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 --- src/p2p.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/p2p.c b/src/p2p.c index 5d96e6825e1a..c823b2b134dd 100644 --- a/src/p2p.c +++ b/src/p2p.c @@ -1496,7 +1496,7 @@ static void p2p_handshake_event(struct handshake_state *hs, static void p2p_try_connect_group(struct p2p_device *dev) { struct scan_bss *bss = dev->conn_wsc_bss; - struct handshake_state *hs = NULL; + _auto_(handshake_state_free) struct handshake_state *hs = NULL; struct iovec ie_iov[16]; int ie_num = 0; int r; @@ -1562,6 +1562,7 @@ static void p2p_try_connect_group(struct p2p_device *dev) goto error; } + l_steal_ptr(hs); dev->conn_retry_count++; done: @@ -1570,9 +1571,6 @@ done: error: not_supported: - if (hs) - handshake_state_free(hs); - p2p_connect_failed(dev); goto done; } From patchwork Fri Dec 1 04:00:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13475325 Received: from mail-oo1-f48.google.com (mail-oo1-f48.google.com [209.85.161.48]) (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 5E1B15393 for ; Fri, 1 Dec 2023 04:01:12 +0000 (UTC) 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="RDsAItis" Received: by mail-oo1-f48.google.com with SMTP id 006d021491bc7-58dd3528497so963853eaf.3 for ; Thu, 30 Nov 2023 20:01:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701403271; x=1702008071; 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=3eILKpuDg7r0TljykUlpQ2QKhq2g0nlqOdwBJvQ0OAA=; b=RDsAItisoe6fwprB4FmhaRsCyQqhAxj3bdCnr4RGQWK03Ufs1rmBIfrUa3oSHqjQmO GvjfTfBlRpuAR73LKp6gLcqRz07l4givdue5fHelHq6lKTqqfzhzhRrI2AxCJ9nflFi8 +a+xxnZA0kp3AuqNGggqLngGLLIMZr4HRtT7IDixFV4KcRf85NrXDmDWA8qu15vEMJ0G cn2jIGiaZUG7HxAR6PdIsbZQsYUGHwOVGNAsi+IrCfmC6JwspTUt0HhIjfPfDXlzgzi5 BDcDbS9GBzNkT4xhupwUFjxKOl7WJDtHNfAupDwIbyazgNn6rUWi/rx8W7CjRjekWFyw Vyzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701403271; x=1702008071; 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=3eILKpuDg7r0TljykUlpQ2QKhq2g0nlqOdwBJvQ0OAA=; b=KLM5YTFU3ZHSmatA23asQnw5K6JHbrxkoIzI78+yNxSzWEZu6an1KF2RPf6/Sgm/xH IWMIEZ0fA1PKN0LJL3EID8Vx64dHL7j/tEECJBKmmBBtwFU5ZnYQJiVSNC5DjWQQiSXU F3EoYe3f3KMZz8lyndgIBeSzUEvAOZSjcUyevRkaxzhLz7kmWUSjlxTwNGmYgLGrtRrC t3D8r42NMJfsz2VlvExUqPw+dLfEyThAH1NJ2UJa4UcjfmhbPbNfo6NEnA/47PdGAUn5 ONN21fJr6PjgjhbK9n7WpU2m3LLvcSPlfHXScvoxYvPP5lKNgF3guuIJ/TH3modtJdXj JzhA== X-Gm-Message-State: AOJu0YxohkOWN5eOf+CwEJnHA36yhLgX1ccivMjUKtplYTWE4e+fCf14 PwbOdVrdHtDQBXnKQFDQXLrUdVnnjFg= X-Google-Smtp-Source: AGHT+IEmTveNyNfi8Q36Kj1ws+MhVh+fM2KN5hni+eZjimUYfwQMwaMfHq3t6yV1GvlU0o0rENK/LA== X-Received: by 2002:a05:6820:54e:b0:58d:1fe0:b2a0 with SMTP id n14-20020a056820054e00b0058d1fe0b2a0mr2028039ooj.5.1701403271299; Thu, 30 Nov 2023 20:01:11 -0800 (PST) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id o3-20020a4ad143000000b0058ab906ae38sm404005oor.2.2023.11.30.20.01.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 20:01:11 -0800 (PST) From: Denis Kenzior To: iwd@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 3/7] p2p: Simplify cleanup of ies Date: Thu, 30 Nov 2023 22:00:03 -0600 Message-ID: <20231201040020.161143-3-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231201040020.161143-1-denkenz@gmail.com> References: <20231201040020.161143-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use an _auto_ variable to cleanup IEs allocated by p2p_build_association_req(). While here, take out unneeded L_WARN_ON since p2p_build_association_req cannot fail. --- src/p2p.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/p2p.c b/src/p2p.c index c823b2b134dd..b66a45cc0bcd 100644 --- a/src/p2p.c +++ b/src/p2p.c @@ -1500,19 +1500,18 @@ static void p2p_try_connect_group(struct p2p_device *dev) struct iovec ie_iov[16]; int ie_num = 0; int r; - struct p2p_association_req info = {}; + struct p2p_association_req info = { + .capability = dev->capability, + .device_info = dev->device_info, + }; struct ie_rsn_info bss_info = {}; struct ie_rsn_info rsn_info = {}; uint8_t rsne_buf[256]; uint8_t wfd_ie[32]; + _auto_(l_free) uint8_t *req_ie = + p2p_build_association_req(&info, &ie_iov[ie_num].iov_len); - info.capability = dev->capability; - info.device_info = dev->device_info; - - ie_iov[0].iov_base = p2p_build_association_req(&info, - &ie_iov[0].iov_len); - L_WARN_ON(!ie_iov[0].iov_base); - ie_num = 1; + ie_iov[ie_num++].iov_base = req_ie; if (dev->conn_own_wfd) { ie_iov[ie_num].iov_base = wfd_ie; @@ -1564,15 +1563,11 @@ static void p2p_try_connect_group(struct p2p_device *dev) l_steal_ptr(hs); dev->conn_retry_count++; - -done: - l_free(ie_iov[0].iov_base); return; error: not_supported: p2p_connect_failed(dev); - goto done; } static void p2p_peer_provision_done(int err, struct wsc_credentials_info *creds, From patchwork Fri Dec 1 04:00:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13475326 Received: from mail-oo1-f43.google.com (mail-oo1-f43.google.com [209.85.161.43]) (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 468E35384 for ; Fri, 1 Dec 2023 04:01:12 +0000 (UTC) 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="PDKdut2X" Received: by mail-oo1-f43.google.com with SMTP id 006d021491bc7-58d3c9badf5so996849eaf.1 for ; Thu, 30 Nov 2023 20:01:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701403272; x=1702008072; 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=t0ObB9cs7ZSZzFHH4EJDzZR47P3cvts9XS1f2MUt2Ao=; b=PDKdut2XDnSrVlw0d5ArIbBLTnlN8ma/yM5zkw1ESkyffBYVMkgeIkL7DbnNFe3FzS Gym4gWJ8f7WCiDUsg5QQMmHtut7AF6/Wirc2UyVPa7pA9QQlG2xJPDFXWV4m7otO3WkZ zSbbNsJhdDj8jex5aWVsVkXQ8S3MrmamDU5Q/nkpSpQZZ9Nj6eS9HOd4l3MPXK+Dy6T7 /XszKC0JmYpkOi5nrb1WX5LTb2fjNk23AKrg8zK+uMd6vFi/5nqdAUAgbW7xUmuQZA0M ErukQBLhWjWHStt4N0pnQhT9S+ilwU3XVDb/eeRbdqDPnvXl/yl7vbleiQtOoAYaPS1P atzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701403272; x=1702008072; 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=t0ObB9cs7ZSZzFHH4EJDzZR47P3cvts9XS1f2MUt2Ao=; b=W5BNKpA+Ip8aMVBUFvKpKUfp1xNh8Xc3NsLE5LNpvwBj+RYwaEYwQ2cKjPVtGOrkq5 Vrxb8PeV4/8l1APVTJl1GQ8nK5svfOA4gkH/YxIXflkgX96x6WUBOdvG/ffZbLcujZys Mjq85rMU2Pm/zgpR9DTY7zU7Zc5CX+hQK+TBtArGjTGpzTY6klPK34zInkEBwK7t7JjX 7zT/p7gsbwp8jbFyfcnA6NVUA4DxIQBUTsujQE/GHS9F3Rtat3iZDyiLAa+Obj7Yl298 i0oAVU7dT+dZaIlwkhwOOPUwzKM7WdvDyCNkMGUmITyKrDkXlPuBPwLSwG52uWvmKoNh q95g== X-Gm-Message-State: AOJu0YyUDB/ZjSGoCNtVCAKfIy64TpFqTiQnXe4pTXDOui7mYl6Lkmoa djRBA35+q+JKgA3pFHtLGbA5C/26xM8= X-Google-Smtp-Source: AGHT+IGnXxO7Zzbzg4KUt4W9p20GerdfYSatdG3/pjlzfSzhIHchrvOMbPMD0s8PqTHiHdZ5uH94kg== X-Received: by 2002:a05:6820:626:b0:58d:7320:1ba0 with SMTP id e38-20020a056820062600b0058d73201ba0mr1826402oow.0.1701403272057; Thu, 30 Nov 2023 20:01:12 -0800 (PST) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id o3-20020a4ad143000000b0058ab906ae38sm404005oor.2.2023.11.30.20.01.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 20:01:11 -0800 (PST) From: Denis Kenzior To: iwd@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 4/7] netdev: iov_ie_append: Support iovecs with multiple IEs Date: Thu, 30 Nov 2023 22:00:04 -0600 Message-ID: <20231201040020.161143-4-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231201040020.161143-1-denkenz@gmail.com> References: <20231201040020.161143-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 iov_ie_append assumed that a single IE was being added and thus the length of the IE could be extracted directly from the element. However, iov_ie_append was used on buffers which could contain multiple IEs concatenated together, for example in handshake_state::vendor_ies. Most of the time this was safe since vendor_ies was NULL or contained a single element, but would result in incorrect behavior in the general case. Fix that by changing iov_ie_append signature to take an explicit length argument and have the caller specify whether the element is a single IE or multiple. Fixes: 7e9971661bcb ("netdev: Append any vendor IEs from the handshake") --- src/netdev.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/netdev.c b/src/netdev.c index 208a15b94507..eb408447224c 100644 --- a/src/netdev.c +++ b/src/netdev.c @@ -209,7 +209,7 @@ static bool mac_per_ssid; static unsigned int iov_ie_append(struct iovec *iov, unsigned int n_iov, unsigned int c, - const uint8_t *ie) + const uint8_t *ie, size_t len) { if (L_WARN_ON(c >= n_iov)) return n_iov; @@ -218,7 +218,7 @@ static unsigned int iov_ie_append(struct iovec *iov, return c; iov[c].iov_base = (void *) ie; - iov[c].iov_len = ie[1] + 2; + iov[c].iov_len = len; return c + 1u; } @@ -286,19 +286,22 @@ static unsigned int netdev_populate_common_ies(struct netdev *netdev, extended_capabilities = wiphy_get_extended_capabilities(netdev->wiphy, netdev->type); - c_iov = iov_ie_append(iov, n_iov, c_iov, extended_capabilities); + c_iov = iov_ie_append(iov, n_iov, c_iov, extended_capabilities, + IE_LEN(extended_capabilities)); rm_enabled_capabilities = wiphy_get_rm_enabled_capabilities(netdev->wiphy); - c_iov = iov_ie_append(iov, n_iov, c_iov, rm_enabled_capabilities); + c_iov = iov_ie_append(iov, n_iov, c_iov, rm_enabled_capabilities, + IE_LEN(rm_enabled_capabilities)); if (rm_enabled_capabilities) l_genl_msg_append_attr(msg, NL80211_ATTR_USE_RRM, 0, NULL); - c_iov = iov_ie_append(iov, n_iov, c_iov, hs->vendor_ies); + c_iov = iov_ie_append(iov, n_iov, c_iov, + hs->vendor_ies, hs->vendor_ies_len); - if (hs->fils_ip_req_ie) - c_iov = iov_ie_append(iov, n_iov, c_iov, hs->fils_ip_req_ie); + c_iov = iov_ie_append(iov, n_iov, c_iov, hs->fils_ip_req_ie, + IE_LEN(hs->fils_ip_req_ie)); return c_iov; } @@ -2502,7 +2505,8 @@ static struct l_genl_msg *netdev_build_cmd_connect(struct netdev *netdev, if (is_rsn) { nl80211_append_rsn_attributes(msg, hs); - c_iov = iov_ie_append(iov, n_iov, c_iov, hs->supplicant_ie); + c_iov = iov_ie_append(iov, n_iov, c_iov, hs->supplicant_ie, + IE_LEN(hs->supplicant_ie)); } if (is_rsn || hs->settings_8021x) { @@ -2517,10 +2521,10 @@ static struct l_genl_msg *netdev_build_cmd_connect(struct netdev *netdev, if (netdev->owe_sm) { owe_build_dh_ie(netdev->owe_sm, owe_dh_ie, &dh_ie_len); - c_iov = iov_ie_append(iov, n_iov, c_iov, owe_dh_ie); + c_iov = iov_ie_append(iov, n_iov, c_iov, owe_dh_ie, dh_ie_len); } - c_iov = iov_ie_append(iov, n_iov, c_iov, hs->mde); + c_iov = iov_ie_append(iov, n_iov, c_iov, hs->mde, IE_LEN(hs->mde)); c_iov = netdev_populate_common_ies(netdev, hs, msg, iov, n_iov, c_iov); mpdu_sort_ies(subtype, iov, c_iov); @@ -3267,9 +3271,11 @@ static void netdev_sae_tx_associate(void *user_data) msg = netdev_build_cmd_associate_common(netdev); - n_used = iov_ie_append(iov, n_iov, n_used, hs->supplicant_ie); - n_used = iov_ie_append(iov, n_iov, n_used, hs->mde); - n_used = iov_ie_append(iov, n_iov, n_used, hs->supplicant_rsnxe); + n_used = iov_ie_append(iov, n_iov, n_used, hs->supplicant_ie, + IE_LEN(hs->supplicant_ie)); + n_used = iov_ie_append(iov, n_iov, n_used, hs->mde, IE_LEN(hs->mde)); + n_used = iov_ie_append(iov, n_iov, n_used, hs->supplicant_rsnxe, + IE_LEN(hs->supplicant_rsnxe)); n_used = netdev_populate_common_ies(netdev, hs, msg, iov, n_iov, n_used); mpdu_sort_ies(subtype, iov, n_used); From patchwork Fri Dec 1 04:00:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13475327 Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.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 CF0EC63D1 for ; Fri, 1 Dec 2023 04:01:13 +0000 (UTC) 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="d2boNIDn" Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-587b1231dbeso914737eaf.3 for ; Thu, 30 Nov 2023 20:01:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701403272; x=1702008072; 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=1JZ04H0KHd/7CRdIBe8MKFs7HTyUfBrZorKfXbyThMU=; b=d2boNIDnnNF7zzX2YyvvaO6EXnrCrqN7lfCJF0CPTPK8S/GYxP25CeF/x2npupHgc2 JrNP08DXOH2Aj+0/iT2i42miQmJpgu3JHOCb+eZ6NtEWcrEoKG3rgLzqY3OCZUZthwgQ lP4L/PHItzZdrWzk+RHWMfXuTzpToCs3HddEG10EQ9MngZDHMkpEldtQ3/jtC7AtffaG 3CjhoLkqT/RzBljAB2dVs/zLoxFWeBwH1MA6ijtRHjpya+59opU/wyZL0m4QV3MNYKwH 3mjIuT4etixU2WOPLbCarxz1X57UC3Po1Br2a2n5Txzw9nCznS9S4km8cfg2cL+gF1h1 q5TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701403272; x=1702008072; 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=1JZ04H0KHd/7CRdIBe8MKFs7HTyUfBrZorKfXbyThMU=; b=IGgTZ7nGSN8M1FBBmC3kWSvP1Ct6kjZ3nD3+6GOQkDy524aDANMDkA7ApQSj/M0wCy haZA/sMCqcOTABpEoYdw1T4r4tHINaAGo0uiY6QXuSnne5/Xh4uRzo2rwMVf9gXdz36W NmRIBiC3RBPuu9JajGVdRUP+6msCnVYWCHqCZ5RDL30GoMGTQRevzftGe4N1raUYwJeo xznRuGJd9xzIry52tXJbj7GYm0fmPjeVIPDR2MB6kjDEFVm/FRwp2dawXo44N/wyfpWJ tyjEl7sOpWxJrYyFlQUnzFxdepB+Mx8nuLiGJbBMAZxDST2WdHEy+elgc46r4C093OaV PPDg== X-Gm-Message-State: AOJu0Yy5GAdVvhVa3n4VuECLX62c4j7oCHd0vzZpm8k+lSYcknFbzzPV 1z2mZkLS669vPQnEgncJ23IAUipjJV0= X-Google-Smtp-Source: AGHT+IEbCHiRbHLFFDQIVd9ArXNmwrbrgA5TdiHalA/9o8Slcnb+bgI8FEeRlNgKqxdmE8PmWZFfIg== X-Received: by 2002:a05:6820:62a:b0:58a:67b5:2df1 with SMTP id e42-20020a056820062a00b0058a67b52df1mr1815574oow.0.1701403272688; Thu, 30 Nov 2023 20:01:12 -0800 (PST) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id o3-20020a4ad143000000b0058ab906ae38sm404005oor.2.2023.11.30.20.01.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 20:01:12 -0800 (PST) From: Denis Kenzior To: iwd@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 5/7] p2p: Use handshake to pass vendor ies Date: Thu, 30 Nov 2023 22:00:05 -0600 Message-ID: <20231201040020.161143-5-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231201040020.161143-1-denkenz@gmail.com> References: <20231201040020.161143-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Instead of passing them directly via netdev_connect --- src/p2p.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p2p.c b/src/p2p.c index b66a45cc0bcd..e2d752776cb8 100644 --- a/src/p2p.c +++ b/src/p2p.c @@ -1550,11 +1550,12 @@ static void p2p_try_connect_group(struct p2p_device *dev) handshake_state_set_event_func(hs, p2p_handshake_event, dev); handshake_state_set_ssid(hs, bss->ssid, bss->ssid_len); handshake_state_set_pmk(hs, dev->conn_psk, 32); + handshake_state_set_vendor_ies(hs, ie_iov, ie_num); if (dev->conn_peer_capability.group_caps & P2P_GROUP_CAP_IP_ALLOCATION) hs->support_ip_allocation = true; - r = netdev_connect(dev->conn_netdev, bss, hs, ie_iov, ie_num, + r = netdev_connect(dev->conn_netdev, bss, hs, NULL, 0, p2p_netdev_event, p2p_netdev_connect_cb, dev); if (r < 0) { l_error("netdev_connect error: %s (%i)", strerror(-r), -r); From patchwork Fri Dec 1 04:00:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13475328 Received: from mail-oo1-f46.google.com (mail-oo1-f46.google.com [209.85.161.46]) (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 734766D3F for ; Fri, 1 Dec 2023 04:01:14 +0000 (UTC) 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="kRS1vlja" Received: by mail-oo1-f46.google.com with SMTP id 006d021491bc7-58d521f12ebso952023eaf.2 for ; Thu, 30 Nov 2023 20:01:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701403273; x=1702008073; 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=x5rs4fqmuY15Ww23hL1mdIl/7uXBy1DIKUhPEOMYB/8=; b=kRS1vljauRtcikS6f4bgWlLSb/krxsZMyrBKuWIDjf2wvf0VGYRt0r34yajsoPKBQb wt9HANTME8YQay3JG5TTa7A7MQeaVQXAz+IppgqWqEDWidLuhkUqhCxrpt82vDwXXlch AkispkShZ9m/uJdpN9gfg0RrSboeKjMcPdwkyKkTR8SU+QAt0NPg2cgvYA/JkZbBfRWD 3eNdn7y3wUuf22nHFI/gCwUMqQF+1xLQfP4cq6WwRB7eYifIm5JGj2Z1IOJTYgXWOhcy yhHyBjXHXr8/h5/R8ScZsRBUt5ZbM0TWwxf9TxN224HVv3BX+20q8U2/azvwfK7ninfm jMWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701403273; x=1702008073; 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=x5rs4fqmuY15Ww23hL1mdIl/7uXBy1DIKUhPEOMYB/8=; b=NuXL7s2r/OKmvF+6cayaWVf6zPiuvamKF9cQmhsOkapc7Td1g+SepjT0nKOd+c/cpv uL/ErdA3l8tgRc2noUGZCDuFWAK++2WlagKKS17QFcZWMLG7OT79Xa66IhjzmfuEiN9V zAg/M7vvKAihtRVASCRQDZ7xXFoxYA3EdZSGcp/ikgrYgIfvXnzO57naj+iwznPXQtEf BBLRrpmCcEBtBs1vDBDqXgv2/QM89pTvaJOKiUKQgZdxN6ZMqI7kHQotj4XPN8KsKC4n hl+/KF57ldKDke5wJQySL+at/vPNhIk+PkutkPC0T0P+AMqdFNg1aOITbNwXCT5bsJkM OdSg== X-Gm-Message-State: AOJu0Yx3i0ploCo+plpSKjJK+24N0j1GL1TEKZ8KD2iZUderp3P8JuwH lC8R13g7vrDHztoq1SJG32tnCKwrsTM= X-Google-Smtp-Source: AGHT+IEyzP3tEkn3+WsBKlILMWH/XAB+h682m3PGgObWZGMDzz5DqyNAS/cgAYR8uCATw5WRmtLuvQ== X-Received: by 2002:a05:6820:2202:b0:581:ea96:f800 with SMTP id cj2-20020a056820220200b00581ea96f800mr1677102oob.6.1701403273449; Thu, 30 Nov 2023 20:01:13 -0800 (PST) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id o3-20020a4ad143000000b0058ab906ae38sm404005oor.2.2023.11.30.20.01.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 20:01:13 -0800 (PST) From: Denis Kenzior To: iwd@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 6/7] wsc: Use handshake to pass vendor ies Date: Thu, 30 Nov 2023 22:00:06 -0600 Message-ID: <20231201040020.161143-6-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231201040020.161143-1-denkenz@gmail.com> References: <20231201040020.161143-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Instead of passing them directly via netdev_connect --- src/wsc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wsc.c b/src/wsc.c index cb2e2c3e2ad0..b063313ac6dc 100644 --- a/src/wsc.c +++ b/src/wsc.c @@ -382,7 +382,9 @@ static int wsc_enrollee_connect(struct wsc_enrollee *wsce, struct scan_bss *bss, if (ies_num) memcpy(ie_iov + 1, ies, sizeof(struct iovec) * ies_num); - r = netdev_connect(wsce->netdev, bss, hs, ie_iov, 1 + ies_num, + handshake_state_set_vendor_ies(hs, ie_iov, 1 + ies_num); + + r = netdev_connect(wsce->netdev, bss, hs, NULL, 0, wsc_enrollee_netdev_event, wsc_enrollee_connect_cb, wsce); l_free(ie_iov[0].iov_base); From patchwork Fri Dec 1 04:00:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denis Kenzior X-Patchwork-Id: 13475329 Received: from mail-oo1-f49.google.com (mail-oo1-f49.google.com [209.85.161.49]) (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 2C3365393 for ; Fri, 1 Dec 2023 04:01:14 +0000 (UTC) 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="IsghTnmz" Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-58d08497aa1so1010814eaf.0 for ; Thu, 30 Nov 2023 20:01:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701403274; x=1702008074; 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=F+8N2Pg3MbO0Hi4W4LqvqhLAAc8XlJ2BzmXyJu8JYgU=; b=IsghTnmzD8SpNChgVMBUj1xYtogplHgqlnSG5cP8EyTTVKKNSA2J3YTm3NROFLHadV IU3DkzKcPulCpJ1PiX4zSvQ7jcI9GV+0MydRYL4ZF5DYXvASrIXOW4Cc5+C1zWCXbnRm I6qpJw73BQrUmRKI/i2zMsOE/TiTerrZ12HoK9QuJwWkToQcho75mzj3wJzPl6SOQcXk vmE2hEyKgTiPqunS59E3Ho5P162geeMQgdCOeisYK0W7S6UW0EYKk/rYF+KNlP10QPPL 06dlOsNRx68HbnHWyil0MvF6/YSNEgI5cmmxiU8Btusd6dBWq/aoVvoHLWimkK8NQfja 524Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701403274; x=1702008074; 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=F+8N2Pg3MbO0Hi4W4LqvqhLAAc8XlJ2BzmXyJu8JYgU=; b=Mj8Nf+P8Ttl1Q53MS2zkSkkcMammirrun32GbpdgPuaSmYb7KLv+9wVL+z1OClITvf 2OhVqoqLgKwf6tiUBv9TxBXaR6dK280Sk3cmxVpgbPqVH8UZi2qbxCMHKcfkWTr/a5oZ A3t0jgeOwLhQw3JPcXfgEEfGFT0fJJzwt4R6HgYZTjI7gOVrMfNzQGPXeZ8O+3H08GTE RV/D/6arRLv36IQAbJF68IG6zd0KnfwhqViq1skTpdSK1VVfhEupeNniooCAhMWKsOV2 XnJEgivdN2EfJANzwRkNfUoCIpaH+bItdGY72HUZ2vo3qKBQN55hhShd8n3w6e5MZUUi 6WQw== X-Gm-Message-State: AOJu0YxoT+ifxDN1Rg+s0y36/c+AL5+U8yuPAyFvZHCGZL1uuN3G99gb mw79nVqA9ntMEHNzASIpmxDQXY4uBVM= X-Google-Smtp-Source: AGHT+IH1e9QNPQm/uctaJpCfiMpCPK9mqX9rDafBXBPoEIDIrtDWEvDuXCeU1uKwslbpw8vLU3KBYw== X-Received: by 2002:a05:6820:502:b0:58d:6c99:fddb with SMTP id m2-20020a056820050200b0058d6c99fddbmr2158898ooj.8.1701403274059; Thu, 30 Nov 2023 20:01:14 -0800 (PST) Received: from localhost.localdomain (070-114-247-242.res.spectrum.com. [70.114.247.242]) by smtp.gmail.com with ESMTPSA id o3-20020a4ad143000000b0058ab906ae38sm404005oor.2.2023.11.30.20.01.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 20:01:13 -0800 (PST) From: Denis Kenzior To: iwd@lists.linux.dev Cc: Denis Kenzior Subject: [PATCH 7/7] netdev: Remove vendor_ies from netdev_connect signature Date: Thu, 30 Nov 2023 22:00:07 -0600 Message-ID: <20231201040020.161143-7-denkenz@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231201040020.161143-1-denkenz@gmail.com> References: <20231201040020.161143-1-denkenz@gmail.com> Precedence: bulk X-Mailing-List: iwd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The vendor IEs are now passed in the handshake_state object instead. --- src/netdev.c | 27 ++++++--------------------- src/netdev.h | 2 -- src/p2p.c | 2 +- src/station.c | 2 +- src/wsc.c | 2 +- 5 files changed, 9 insertions(+), 26 deletions(-) diff --git a/src/netdev.c b/src/netdev.c index eb408447224c..f2e887b4d70b 100644 --- a/src/netdev.c +++ b/src/netdev.c @@ -2450,9 +2450,7 @@ static void netdev_driver_connected(struct netdev *netdev) static struct l_genl_msg *netdev_build_cmd_connect(struct netdev *netdev, struct handshake_state *hs, - const uint8_t *prev_bssid, - const struct iovec *vendor_ies, - size_t num_vendor_ies) + const uint8_t *prev_bssid) { struct netdev_handshake_state *nhs = l_container_of(hs, struct netdev_handshake_state, super); @@ -2529,12 +2527,6 @@ static struct l_genl_msg *netdev_build_cmd_connect(struct netdev *netdev, mpdu_sort_ies(subtype, iov, c_iov); - if (vendor_ies && !L_WARN_ON(n_iov - c_iov < num_vendor_ies)) { - memcpy(iov + c_iov, vendor_ies, - sizeof(*vendor_ies) * num_vendor_ies); - c_iov += num_vendor_ies; - } - if (c_iov) l_genl_msg_append_attrv(msg, NL80211_ATTR_IE, iov, c_iov); @@ -2570,8 +2562,7 @@ static bool netdev_retry_owe(struct netdev *netdev) if (!owe_next_group(netdev->owe_sm)) return false; - connect_cmd = netdev_build_cmd_connect(netdev, - netdev->handshake, NULL, NULL, 0); + connect_cmd = netdev_build_cmd_connect(netdev, netdev->handshake, NULL); netdev->connect_cmd_id = l_genl_family_send(nl80211, connect_cmd, netdev_cmd_connect_cb, netdev, @@ -3807,8 +3798,6 @@ static void netdev_connect_common(struct netdev *netdev, const struct scan_bss *bss, const struct scan_bss *prev_bss, struct handshake_state *hs, - const struct iovec *vendor_ies, - size_t num_vendor_ies, netdev_event_func_t event_filter, netdev_connect_cb_t cb, void *user_data) { @@ -3866,8 +3855,7 @@ static void netdev_connect_common(struct netdev *netdev, break; default: build_cmd_connect: - cmd_connect = netdev_build_cmd_connect(netdev, hs, prev_bssid, - vendor_ies, num_vendor_ies); + cmd_connect = netdev_build_cmd_connect(netdev, hs, prev_bssid); if (!is_offload(hs) && (is_rsn || hs->settings_8021x)) { sm = eapol_sm_new(hs); @@ -3900,8 +3888,6 @@ build_cmd_connect: int netdev_connect(struct netdev *netdev, const struct scan_bss *bss, struct handshake_state *hs, - const struct iovec *vendor_ies, - size_t num_vendor_ies, netdev_event_func_t event_filter, netdev_connect_cb_t cb, void *user_data) { @@ -3918,9 +3904,8 @@ int netdev_connect(struct netdev *netdev, const struct scan_bss *bss, if (netdev_handshake_state_setup_connection_type(hs) < 0) return -ENOTSUP; - netdev_connect_common(netdev, bss, NULL, hs, vendor_ies, - num_vendor_ies, event_filter, cb, - user_data); + netdev_connect_common(netdev, bss, NULL, hs, + event_filter, cb, user_data); return 0; } @@ -4025,7 +4010,7 @@ int netdev_reassociate(struct netdev *netdev, const struct scan_bss *target_bss, netdev->connected = false; netdev->in_reassoc = true; - netdev_connect_common(netdev, target_bss, orig_bss, hs, NULL, 0, + netdev_connect_common(netdev, target_bss, orig_bss, hs, event_filter, cb, user_data); if (netdev->ap) diff --git a/src/netdev.h b/src/netdev.h index f27130f14e56..03d1b6e94dd4 100644 --- a/src/netdev.h +++ b/src/netdev.h @@ -155,8 +155,6 @@ struct handshake_state *netdev_get_handshake(struct netdev *netdev); int netdev_connect(struct netdev *netdev, const struct scan_bss *bss, struct handshake_state *hs, - const struct iovec *vendor_ies, - size_t num_vendor_ies, netdev_event_func_t event_filter, netdev_connect_cb_t cb, void *user_data); int netdev_disconnect(struct netdev *netdev, diff --git a/src/p2p.c b/src/p2p.c index e2d752776cb8..08fe8444fbb9 100644 --- a/src/p2p.c +++ b/src/p2p.c @@ -1555,7 +1555,7 @@ static void p2p_try_connect_group(struct p2p_device *dev) if (dev->conn_peer_capability.group_caps & P2P_GROUP_CAP_IP_ALLOCATION) hs->support_ip_allocation = true; - r = netdev_connect(dev->conn_netdev, bss, hs, NULL, 0, + r = netdev_connect(dev->conn_netdev, bss, hs, p2p_netdev_event, p2p_netdev_connect_cb, dev); if (r < 0) { l_error("netdev_connect error: %s (%i)", strerror(-r), -r); diff --git a/src/station.c b/src/station.c index 49cad135eaf0..48a595dcd340 100644 --- a/src/station.c +++ b/src/station.c @@ -3453,7 +3453,7 @@ int __station_connect_network(struct station *station, struct network *network, if (!hs) return -ENOTSUP; - r = netdev_connect(station->netdev, bss, hs, NULL, 0, + r = netdev_connect(station->netdev, bss, hs, station_netdev_event, station_connect_cb, station); if (r < 0) { diff --git a/src/wsc.c b/src/wsc.c index b063313ac6dc..cda877cf7e6d 100644 --- a/src/wsc.c +++ b/src/wsc.c @@ -384,7 +384,7 @@ static int wsc_enrollee_connect(struct wsc_enrollee *wsce, struct scan_bss *bss, handshake_state_set_vendor_ies(hs, ie_iov, 1 + ies_num); - r = netdev_connect(wsce->netdev, bss, hs, NULL, 0, + r = netdev_connect(wsce->netdev, bss, hs, wsc_enrollee_netdev_event, wsc_enrollee_connect_cb, wsce); l_free(ie_iov[0].iov_base);