From patchwork Mon Jan 29 12:26: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: 1892202 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=XUPnxrNb; 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=C9W6SarH; 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 4TNnc45ZY7z23dQ for ; Mon, 29 Jan 2024 23:27:00 +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=qM9HsRXfLq6J8UGD39jbswYWzId75YDMIFS7PlzDBmM=; b=XUPnxrNbDZYskd SXlJXBnk77YgVpHjeQ2fBrohT19XYoAyz7hZRUgaiT2/PRVldgdLgEjL2yt81rfNsokKTZvntHbxK 2NV5JE3pE96jLYNQaU341QnetO1ulZh/jlFlmYxqXEACpzBU0QTwuBwfoem1Y7FiuRmYgMaWvcfUL w1hIVfGYdVnuVji60k4dDyMQsBF/1IRHAvF0Q0VfLdX+vBQU++XwJR9Qz0jTPVrsxYkETtQ1AriAf fCpLB3sjauskyP1/frS44xjbjL5YjFKe1MsKcOrOQ3UvtcHkndquOBTZgAgIUu678xDdXJYq7c/Ee grlKWGqEFWSAmxVQt5qQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUQiX-0000000CbHC-0QjM; Mon, 29 Jan 2024 12:26:25 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUQiV-0000000CbGI-16zA for hostap@lists.infradead.org; Mon, 29 Jan 2024 12:26:24 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40e913e3f03so33587115e9.3 for ; Mon, 29 Jan 2024 04:26:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706531180; x=1707135980; 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=8qRbojhMbJ+pO1DZ1BQw0MmEe++wPUKhgSSRY83IBjc=; b=C9W6SarHGriRpjsc7BdXJJQRPtK6JMDS7uNzzMwZEntgyKfk0/Nc2mlg92YhehhB/2 awGaO0c1l8wLftI+ydEgXUVLDmiS7fUzDRmImg7mfyGrgIUwdt5iHaDhWSl2e//V8NUp roIcyyku8KsMte5MDQE/bgU81DV7mQJxW6OhSB0c7NoKBRon+NYcIj+7ETy5y8szQkug pPFAWOEJFYsHZQNyw+bF5JnRZos+Lo+XJlqokrcSPW+ACvInHv3ArrvxkWaHwnOGuhwk xi8gehc8xAE1JTwJhlHqSuYoNiHmp9/Vw/IyH12Dr3uCX+GpfKZthnSB5uPkbF7pGWwH j+4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706531180; x=1707135980; 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=8qRbojhMbJ+pO1DZ1BQw0MmEe++wPUKhgSSRY83IBjc=; b=LEAGyYJE1o7SdaWVm8Q1CD2xUaItpgr6tY6LozzUx8YbOXC8wDMu14mBPwRVPBFsCe nXrQXOK5rgayefMEGZ0DA9Ln6ty6Hg6EcuDduFSAJF1ZFUGfmZfazBkogFriIr9lH571 3kZyel/9nqzeVqGVJ7MaejGrlbw8r7ggyR3P8zqMFVsAma2q8RSCbE8RYn/YjzCsjEXJ jr9r70eF4lkEv1ZWB36cRrmgm+nUaEwyOWigudmUVu7KIigGlCNGXSY+ShrD1/wJkD3B +e/KV525DvpnuXT8jYGHVaGFcuWViZkD7lzwpGTtkm8mzBhGhXAj70qnE+F6cyC/M6vY jjsw== X-Gm-Message-State: AOJu0YwiAQY+mW3CQrR1Vi8At2lphl+SpdtLF/JBIk6ZauEWluP+sQMv GzvmkDK7Yj3QL/RDx+YOjLsJnjb2qTD5X0uRjYbUQXf4Ria3FKE/TOOh7hB/ X-Google-Smtp-Source: AGHT+IEWLuzWS4q1HHvubYKReXCouxSovwZaUpm2aj0q5hV3zH+HOzXBhEsxk8hhlYVjPhA27Vf42A== X-Received: by 2002:a5d:4048:0:b0:33a:f431:3489 with SMTP id w8-20020a5d4048000000b0033af4313489mr905707wrp.56.1706531179766; Mon, 29 Jan 2024 04:26:19 -0800 (PST) Received: from sah1lpt685.home (2a01cb000b6bf000d53bbee0a7fe58a3.ipv6.abo.wanadoo.fr. [2a01:cb00:b6b:f000:d53b:bee0:a7fe:58a3]) by smtp.gmail.com with ESMTPSA id co28-20020a0560000a1c00b0033af0cb2a35sm1770509wrb.108.2024.01.29.04.26.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 04:26:19 -0800 (PST) From: Baligh Gasmi To: hostap@lists.infradead.org Cc: Baligh Gasmi Subject: [PATCH v4] do not perform CSA on disabled BSS. Date: Mon, 29 Jan 2024 13:26:17 +0100 Message-Id: <20240129122617.3605470-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_042623_348054_CEDD7157 X-CRM114-Status: GOOD ( 18.21 ) 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/ap/drv_callbacks.c | 6 ++++-- src/drivers/driver_nl80211.c | 25 +++++++++++++++ 3 files changed, 21 insertions(+), 14 dele [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 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 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:334 listed in] [list.dnswl.org] 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/ap/drv_callbacks.c | 6 ++++-- src/drivers/driver_nl80211.c | 25 +++++++++++++++---------- 3 files changed, 21 insertions(+), 14 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/ap/drv_callbacks.c b/src/ap/drv_callbacks.c index 39deacd3d..e41c2567a 100644 --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c @@ -2493,9 +2493,11 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, } break; case EVENT_INTERFACE_DISABLED: - hostapd_free_stas(hapd); wpa_msg(hapd->msg_ctx, MSG_INFO, INTERFACE_DISABLED); - hapd->disabled = 1; + if (!hapd->disabled) { + hostapd_free_stas(hapd); + hapd->disabled = 1; + } break; #ifdef CONFIG_ACS case EVENT_ACS_CHANNEL_SELECTED: 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);