From patchwork Mon Jan 29 10:10:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Baligh Gasmi gasmibal@gmail.com" X-Patchwork-Id: 1892162 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=u2DpFzKO; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=dfHMV7m0; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=198.137.202.133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TNkZx2q3Cz23dQ for ; Mon, 29 Jan 2024 21:10:49 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=o78CUdoYX31P2V1DlcfAYoec4fVqS0i4WcZEnE88TZA=; b=u2DpFzKOcjnwgV w3235/cXHRgq7ThXbY03bLjJbhVHVT42bpUy9OVi6dUv5DmlKGfu4COGQbC4LgPnDFNU4OveW3iPN gceXd8Q2uM0HfAP3rOlQa/dTzI5BGLPT+zpq6FrH/jfX//lhBzDsHlPl4PamIdlfDjxUkALqJDFQD I7wVLu47IU/tvSF3apVthb+g9uYZ3l+7XSrnbWjWmvSAMK2dKah1UCTRSWPEBVhxhsVyxHCH4dTUW yzoA1WnIwlT3zSlZnI5NR2vwxt/ProiZHFEVTNWlBmpUrx3OoT/FfMm3cTvXpJHA0NvDdEtZOMGrg Q/r9i1D7krkeBR2r8Mcg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUOay-0000000CAev-1y8T; Mon, 29 Jan 2024 10:10:28 +0000 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUOat-0000000CAbu-1uF6 for hostap@lists.infradead.org; Mon, 29 Jan 2024 10:10:26 +0000 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-337d05b8942so2438806f8f.3 for ; Mon, 29 Jan 2024 02:10:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706523020; x=1707127820; darn=lists.infradead.org; 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=6Bg/z5uFy1A+dM5/IHOOTR47u+69kC0izi2JKn0EU00=; b=dfHMV7m0gSFvuz4nol0BPfntcWsoKZgAYhToJz2NYtZyz5fTI8NRTHC3BdPkGLItJP x+kQ8KE7px8xoVCubcX4OgnwQG1a/2yCeUcNqmTVQOipufSNDV0T+9ong3AV7i4tLyyl i7xi3IUdMzGAXTvTWqltckbFtRe8B7Apz5hezdcDHTuf+DgNDVrg/qEkjTyqi9rIUPn3 va/FUKgNCAWvINEI0FAnlvUrGMQi/U1B2u4Qbne8CliNpouXRweao2k1b/NbIcaUy+Qd 7zPzVBJUvZMDyOSo7pRaxrsVRZ8f6aQWbAjHmJM6NcTCXVNKrYidVe/Zijm6kOUqeuK7 PMBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706523020; x=1707127820; 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=6Bg/z5uFy1A+dM5/IHOOTR47u+69kC0izi2JKn0EU00=; b=TQEoSsSuoFuvI39w9ArwICpN4wZdNK/5HRvKN6eRAft1Pi3283B7NGFIhNMWLOOdPP w8l8MFt/b9uLkjhmaRiyA6/x3l0+sHLwQWYf0TGAYFISDUOE9yFgszPAa7cU6nYhbsM8 nhiFIpgx0T2Zw2pO2f/aLpISoS2pD2GvGTCpp4eJy5Sdu/fIbT2JGkMR9z+XJJiCLqr+ OfKhAIr+aIA6/uiyzONs27M9LPRc8sdersVx8I58rLQBEMEUrAwC7Ic7L/nNhSiQ7o0Q 4A1ZTY0D8vl2Js7Rw681r5o5nV2w43pT6VOyTAv2VsLjeaNfN3uMzjlxhNT4laugjdtn rtIA== X-Gm-Message-State: AOJu0YzvXTfLmecxFc4L9Xf+vGZQb6CTrE8LUmVmHgfSu6bThpth7Q0n +R5UATMo69Ngt8Fhgl6ED0kKLo6VPencejK86UnxQ1IpIajB7EZTEtwFCCQh X-Google-Smtp-Source: AGHT+IHE2OMVpR5eWbOOESNN44tXKR1BMhVhOmJrFhhRNt262iX9lzo56egjzol25Qvpi2GGSBedIQ== X-Received: by 2002:a05:6000:1565:b0:33a:f0c5:2a00 with SMTP id 5-20020a056000156500b0033af0c52a00mr1164001wrz.61.1706523019909; Mon, 29 Jan 2024 02:10:19 -0800 (PST) Received: from sah1lpt685.home (2a01cb000b6bf0005ea3d462978c9d88.ipv6.abo.wanadoo.fr. [2a01:cb00:b6b:f000:5ea3:d462:978c:9d88]) by smtp.gmail.com with ESMTPSA id o7-20020a5d6847000000b00339272c885csm7646411wrw.87.2024.01.29.02.10.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 02:10:19 -0800 (PST) From: Baligh Gasmi To: hostap@lists.infradead.org Cc: Baligh Gasmi Subject: [PATCH v3] do not perform CSA on disabled BSS. Date: Mon, 29 Jan 2024 11:10:17 +0100 Message-Id: <20240129101017.3455285-1-gasmibal@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240128170809.308101-1-gasmibal@gmail.com> References: <20240128170809.308101-1-gasmibal@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240129_021023_930004_674E90AF X-CRM114-Status: GOOD ( 18.17 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: It is useless to perform a channel switch, by announcing the new channel information: CSA (Channel Switch Announcement), if the BSS is not running. Signed-off-by: Baligh Gasmi --- hostapd/ctrl_iface.c | 4 ++-- src/drivers/driver_nl80211.c | 25 +++++++++++++++ 2 files changed, 17 insertions(+), 12 deletions(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:42c listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [gasmibal(at)gmail.com] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org It is useless to perform a channel switch, by announcing the new channel information: CSA (Channel Switch Announcement), if the BSS is not running. Signed-off-by: Baligh Gasmi --- hostapd/ctrl_iface.c | 4 ++-- src/drivers/driver_nl80211.c | 25 +++++++++++++++---------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index 2ba9856b4..4001462bb 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -2720,14 +2720,14 @@ static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface, &settings.freq_params); ret = hostapd_switch_channel(iface->bss[i], &settings); - if (ret) { + if (ret && !iface->bss[i]->disabled) { /* FIX: What do we do if CSA fails in the middle of * submitting multi-BSS CSA requests? */ return ret; } } - return 0; + return !hostapd_csa_in_progress(iface); #else /* NEED_AP_MLME */ return -1; #endif /* NEED_AP_MLME */ diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 70adaca54..5e2d8b207 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -1293,6 +1293,7 @@ static void wpa_driver_nl80211_event_rtm_newlink(void *ctx, char ifname[IFNAMSIZ + 1]; char extra[100], *pos, *end; int init_failed; + struct i802_bss* bss = NULL; extra[0] = '\0'; pos = extra; @@ -1343,7 +1344,7 @@ static void wpa_driver_nl80211_event_rtm_newlink(void *ctx, if (init_failed) return; /* do not update interface state */ - if (!drv->if_disabled && !(ifi->ifi_flags & IFF_UP)) { + if (!(ifi->ifi_flags & IFF_UP)) { namebuf[0] = '\0'; if (if_indextoname(ifi->ifi_index, namebuf) && linux_iface_up(drv->global->ioctl_sock, namebuf) > 0) { @@ -1357,14 +1358,16 @@ static void wpa_driver_nl80211_event_rtm_newlink(void *ctx, wpa_printf(MSG_DEBUG, "nl80211: Interface down (%s/%s)", namebuf, ifname); if (os_strcmp(drv->first_bss->ifname, ifname) != 0) { - wpa_printf(MSG_DEBUG, - "nl80211: Not the main interface (%s) - do not indicate interface down", - drv->first_bss->ifname); + bss = get_bss_ifindex(drv, ifi->ifi_index); + if(bss) { + wpa_supplicant_event(bss->ctx, EVENT_INTERFACE_DISABLED, + NULL); + } } else if (drv->ignore_if_down_event) { wpa_printf(MSG_DEBUG, "nl80211: Ignore interface down " "event generated by mode change"); drv->ignore_if_down_event = 0; - } else { + } else if(!drv->if_disabled) { drv->if_disabled = 1; wpa_supplicant_event(drv->ctx, EVENT_INTERFACE_DISABLED, NULL); @@ -1381,7 +1384,7 @@ static void wpa_driver_nl80211_event_rtm_newlink(void *ctx, } } - if (drv->if_disabled && (ifi->ifi_flags & IFF_UP)) { + if (ifi->ifi_flags & IFF_UP) { namebuf[0] = '\0'; if (if_indextoname(ifi->ifi_index, namebuf) && linux_iface_up(drv->global->ioctl_sock, namebuf) == 0) { @@ -1393,9 +1396,11 @@ static void wpa_driver_nl80211_event_rtm_newlink(void *ctx, wpa_printf(MSG_DEBUG, "nl80211: Interface up (%s/%s)", namebuf, ifname); if (os_strcmp(drv->first_bss->ifname, ifname) != 0) { - wpa_printf(MSG_DEBUG, - "nl80211: Not the main interface (%s) - do not indicate interface up", - drv->first_bss->ifname); + bss = get_bss_ifindex(drv, ifi->ifi_index); + if(bss) { + wpa_supplicant_event(bss->ctx, EVENT_INTERFACE_ENABLED, + NULL); + } } else if (if_nametoindex(drv->first_bss->ifname) == 0) { wpa_printf(MSG_DEBUG, "nl80211: Ignore interface up " "event since interface %s does not exist", @@ -1404,7 +1409,7 @@ static void wpa_driver_nl80211_event_rtm_newlink(void *ctx, wpa_printf(MSG_DEBUG, "nl80211: Ignore interface up " "event since interface %s is marked " "removed", drv->first_bss->ifname); - } else { + } else if(drv->if_disabled) { /* Re-read MAC address as it may have changed */ nl80211_refresh_mac(drv, ifi->ifi_index, 0);