From patchwork Thu Aug 1 16:34:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Kumar Singh X-Patchwork-Id: 1967918 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=y+kggUoI; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=quicinc.com header.i=@quicinc.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=Ms+IjWQh; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::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 [IPv6:2607:7c80:54:3::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 4WZZMS5QLLz1ybV for ; Fri, 2 Aug 2024 02:35:32 +1000 (AEST) 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=S8E5CW2g49whucz2npbPnklgtYhPTL2e160JsCUmDHs=; b=y+kggUoI93om+K H3BqADUvNVlMnLrLQ6rLNx0HxowIbc79oJc96P2exuHy0RQzbSlDfgq2MhzWQZXuZdZ+noHwj3qT4 VnueP51lMKMamRvY83MNWOQrYoZwTmsX2ZaHmBmz5SEbssSSHBclZfcAIp0qoUxNZKYYpVlZyJor0 n1wogBCUu3xOnbaIECTJwpmMKxSYNWEJgJoY0r0gGhBb4dcoyurQ9Acv3QjfXHg3RDBWYGQFK6fyA WlHtm+P5P7uhiMUDB+U/Tk86VqTuqm6ED24BQVON42bqVLZRpd2mHijUWusyYZBMKU8/h4JR1rXJb fdjkkYQ+bcu1+0V5wXAQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZYln-000000064YK-0fBt; Thu, 01 Aug 2024 16:35:15 +0000 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZYlh-000000064UJ-3cOI for hostap@lists.infradead.org; Thu, 01 Aug 2024 16:35:11 +0000 Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 471Db6jv018281 for ; Thu, 1 Aug 2024 16:35:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= UWHZnlXdku45oRXG2b8qmaakAD/dZPBuT9ZVoVsDLrk=; b=Ms+IjWQhJpwqGmds XAoKN8vsQUULBrgbBKj64G4j5MGTt1+7sZ23aD3uNq9qVdcqQBqeOKzqLf95v5MS wGXWTbaZ2hdmv+8buVl3AlPkASgrc46u9kHZ1wP6YmRs694EiKFI184l+gDm/UR4 kfdcrY5FeY+6dFvUvPz3xJ534VpDPrXgCD/oxxtzAOCrs+rUR+OG2cIT9Vg12YB3 Fw2+WY1fdwCqEHfEVqzomphKuIbT5rPvVbOAbicbZ8LiBJeGAM6JuklFjwK8Dc5r 2B8qB2XMAGFnDQDO7AiTddrsw7g/cGOCRv13eFyvoHJnrXBKlDJV0Svgz0HZpDyV Gkgn6A== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 40msnefgyw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 01 Aug 2024 16:35:09 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.19/8.17.1.19) with ESMTPS id 471GZ8aG006503 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 1 Aug 2024 16:35:08 GMT Received: from hu-adisi-blr.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Thu, 1 Aug 2024 09:35:07 -0700 From: Aditya Kumar Singh To: CC: Aditya Kumar Singh Subject: [PATCH v2 3/6] hostapd_cli: MLO: pass 'LINKID' in the command Date: Thu, 1 Aug 2024 22:04:44 +0530 Message-ID: <20240801163447.3202440-4-quic_adisi@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240801163447.3202440-1-quic_adisi@quicinc.com> References: <20240801163447.3202440-1-quic_adisi@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: jXmBx7V-gyUZH7nPdgLAg5gca4yiADFu X-Proofpoint-ORIG-GUID: jXmBx7V-gyUZH7nPdgLAg5gca4yiADFu X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-08-01_15,2024-08-01_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 lowpriorityscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 bulkscore=0 suspectscore=0 impostorscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2408010109 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240801_093509_970606_E7D72A39 X-CRM114-Status: GOOD ( 21.89 ) X-Spam-Score: -2.1 (--) 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: MLD level socket can take 'LINKID '. Add changes to pass this via hostapd_cli. User needs to give "link_id=" in post fix fashion in the command in order to pass this link_id from cli [...] Content analysis details: (-2.1 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_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.1 DKIM_VALID Message has at least one valid DKIM or DK signature -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [205.220.168.131 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [205.220.168.131 listed in sa-accredit.habeas.com] 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [205.220.168.131 listed in bl.score.senderscore.com] 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 MLD level socket can take 'LINKID '. Add changes to pass this via hostapd_cli. User needs to give "link_id=" in post fix fashion in the command in order to pass this link_id from cli. For example - $ hostapd_cli -i wlan0 status link_id=0 | grep freq= freq=2437 $ hostapd_cli -i wlan0 ... Interactive mode > ping PONG > > status link_id=0 Command for 'LINKID 0' state=ENABLED phy=phy0 freq=2437 Signed-off-by: Aditya Kumar Singh --- hostapd/hostapd_cli.c | 39 +++++++++++++++++++++++++++++++ src/common/wpa_ctrl.c | 54 +++++++++++++++++++++++++++++++++++++++++++ src/common/wpa_ctrl.h | 3 +++ 3 files changed, 96 insertions(+) diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c index f05a734fea90..d695255027ba 100644 --- a/hostapd/hostapd_cli.c +++ b/hostapd/hostapd_cli.c @@ -1962,6 +1962,45 @@ static void wpa_request(struct wpa_ctrl *ctrl, int argc, char *argv[]) } else if (count == 0) { printf("Unknown command '%s'\n", argv[0]); } else { +#ifdef CONFIG_IEEE80211BE + char *pos, *end; + int i, j, link_id; + bool link_found = false; + + wpa_ctrl_reset_mld_link(ctrl); + i = 0; + + while (i < argc) { + pos = os_strstr(argv[i], "link_id="); + if (!pos) { + i++; + continue; + } + + pos = pos + 8; + link_id = strtol(pos, &end, 10); + + if (link_id < 0 || link_id >= 15) { + printf("Invalid link ID '%d'\n", link_id); + return; + } + + link_found = true; + + /* remove this link_id= from the arguements */ + for (j = i + 1; j < argc; j++) + argv[j - 1] = argv[j]; + + argc--; + i = 0; + } + + if (link_found) { + wpa_ctrl_set_mld_link(ctrl, link_id); + printf("Command for '%s'\n", + wpa_ctrl_get_mld_link(ctrl)); + } +#endif /* CONFIG_IEEE80211BE */ match->handler(ctrl, argc - 1, &argv[1]); } } diff --git a/src/common/wpa_ctrl.c b/src/common/wpa_ctrl.c index 7e197f094fd1..d0c174c05d48 100644 --- a/src/common/wpa_ctrl.c +++ b/src/common/wpa_ctrl.c @@ -72,6 +72,13 @@ struct wpa_ctrl { #ifdef CONFIG_CTRL_IFACE_NAMED_PIPE HANDLE pipe; #endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */ +#ifdef CONFIG_IEEE80211BE + /* 'LINKID ' - 7 chars including space + * 'XX' - Two chars max for link id + * Total required 10 chars at least + */ + char link_id_str[10]; +#endif /* CONFIG_IEEE80211BE */ }; @@ -488,6 +495,7 @@ int wpa_ctrl_request(struct wpa_ctrl *ctrl, const char *cmd, size_t cmd_len, fd_set rfds; const char *_cmd; char *cmd_buf = NULL; + char *link_cmd_buf = NULL; size_t _cmd_len; #ifdef CONFIG_CTRL_IFACE_UDP @@ -510,6 +518,28 @@ int wpa_ctrl_request(struct wpa_ctrl *ctrl, const char *cmd, size_t cmd_len, _cmd_len = cmd_len; } +#ifdef CONFIG_IEEE80211BE + if (os_strlen(ctrl->link_id_str)) { + char *pos; + + _cmd_len = _cmd_len + 1 + os_strlen(ctrl->link_id_str); + link_cmd_buf = os_malloc(_cmd_len); + if (link_cmd_buf == NULL) { + if (cmd_buf) + os_free(cmd_buf); + return -1; + } + + pos = link_cmd_buf; + os_strlcpy(pos, _cmd, _cmd_len); + pos += os_strlen(_cmd); + *pos++ = ' '; + os_memcpy(pos, ctrl->link_id_str, os_strlen(ctrl->link_id_str)); + _cmd = link_cmd_buf; + wpa_ctrl_reset_mld_link(ctrl); + } +#endif /* CONFIG_IEEE80211BE */ + errno = 0; started_at.sec = 0; started_at.usec = 0; @@ -535,9 +565,11 @@ retry_send: } send_err: os_free(cmd_buf); + os_free(link_cmd_buf); return -1; } os_free(cmd_buf); + os_free(link_cmd_buf); os_get_reltime(&ending_at); ending_at.sec += 10; @@ -773,4 +805,26 @@ int wpa_ctrl_get_fd(struct wpa_ctrl *ctrl) #endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */ + +#ifdef CONFIG_IEEE80211BE +void wpa_ctrl_reset_mld_link(struct wpa_ctrl *ctrl) +{ + os_memset(ctrl->link_id_str, '\0', sizeof(ctrl->link_id_str)); +} + + +void wpa_ctrl_set_mld_link(struct wpa_ctrl *ctrl, int link_id) +{ + os_snprintf(ctrl->link_id_str, sizeof(ctrl->link_id_str), + "LINKID %d", link_id); +} + + +char *wpa_ctrl_get_mld_link(struct wpa_ctrl *ctrl) +{ + return ctrl->link_id_str; +} +#endif /* CONFIG_IEEE80211BE */ + + #endif /* CONFIG_CTRL_IFACE */ diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h index 865ac6d91052..d1ce1dd299f4 100644 --- a/src/common/wpa_ctrl.h +++ b/src/common/wpa_ctrl.h @@ -676,6 +676,9 @@ char * wpa_ctrl_get_remote_ifname(struct wpa_ctrl *ctrl); #ifdef CONFIG_IEEE80211BE #define WPA_CTRL_IFACE_LINK_NAME "link" +void wpa_ctrl_reset_mld_link(struct wpa_ctrl *ctrl); +void wpa_ctrl_set_mld_link(struct wpa_ctrl *ctrl, int link_id); +char *wpa_ctrl_get_mld_link(struct wpa_ctrl *ctrl); #endif /* CONFIG_IEEE80211BE */ #endif /* WPA_CTRL_H */