From patchwork Wed Feb 15 23:08:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1743180 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=) 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=pFpKjyMH; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=OsV1mJLH; dkim-atps=neutral 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PHF0r1qcbz23yD for ; Thu, 16 Feb 2023 10:39:40 +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=laojAgLiaFcEwTcr7FI2izJn7DlXKteAbWL36IGEOvA=; b=pFpKjyMHn7/qwG XpZ7oiN+VIAdnQoDXg3E8kf3D7f0cwCU9WD3bNPIvWrsIfhELY+9w/Uyp2bTMsvjyS9A/Qhr5+snY Z+kOg63NJCxOrlVC58t2YfH+eawuF+17fq6e+HLChrnVvH5TzAy01e7h8kBfrRHMaPprSDqA4whkn fTWvsmmVPE/01vAE7dr8kFuUGOf0AZLtELffXsdtUER/SAi1CWP8MElyU/He8XYOejtj+HRvW6lzP X9RqbuXZIiVfhZmTg7CRjom93muqqRt+I+flNw06evbrHH+og4ye6IIeqSS1kP6YN497otEi/Bx18 /pAlSqJA9sB8FiCtGKCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSRMO-007ut0-5X; Wed, 15 Feb 2023 23:38:48 +0000 Received: from mga03.intel.com ([134.134.136.65]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSQuh-007lWG-GA for hostap@lists.infradead.org; Wed, 15 Feb 2023 23:10:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676502611; x=1708038611; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yTLO27Bj24G2Z/Q25bDRzRbi505yfQ/7ZWnZJLq5AWY=; b=OsV1mJLHGo7JMX4sq0zLax3IDnmT83brQPhgNWWxqUr8Vbi9Jzz5MY4t uK692EYpPCr/St/z4+S4hqGVk6XOF2epZKRrSEZsQdYl8cjLoDAYJRxm0 Myxt2i4mKmt0HCf4i0OpUr1yxXxrMFZWxEr1zPolMfL+KqE15ZAkdMMHi dksN1Ud3BoO0fkmhDddxUeYKQih/+BxZUFCkQXuxluoDsaEC+e92AY+OV w3ziWPYCrsjLdw+g5r2uXyg4eF1R78YyoDS5YPi0bbVY8JakRfxJe6zWO bDB4sXvGuN8oB0Dj3/38XBXbHnc3lgOBys4fs3JBKs05BgeQQ4L0M7w7B Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="333719746" X-IronPort-AV: E=Sophos;i="5.97,300,1669104000"; d="scan'208";a="333719746" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2023 15:10:11 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="702344456" X-IronPort-AV: E=Sophos;i="5.97,300,1669104000"; d="scan'208";a="702344456" Received: from zfilgut-mobl.ger.corp.intel.com (HELO aotchere-desk.intel.com) ([10.254.144.126]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2023 15:10:09 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Ilan Peer Subject: [PATCH 32/50] AP: Provide the link ID for an MLD setting when setting VLAN Date: Thu, 16 Feb 2023 01:08:46 +0200 Message-Id: <20230215230904.933291-33-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230215230904.933291-1-andrei.otcheretianski@intel.com> References: <20230215230904.933291-1-andrei.otcheretianski@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230215_151011_641621_0010FD35 X-CRM114-Status: GOOD ( 16.77 ) X-Spam-Score: -2.7 (--) 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: From: Ilan Peer This required modification to the driver interface and driver nl80211. Signed-off-by: Ilan Peer --- src/ap/ap_drv_ops.h | 5 +++-- src/ap/sta_info.c | 9 ++++++++- src/drivers/driver.h | 3 ++- src/drivers/driver_nl80211.c | 13 ++++++++----- 4 files ch [...] Content analysis details: (-2.7 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [134.134.136.65 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -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 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.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 From: Ilan Peer This required modification to the driver interface and driver nl80211. Signed-off-by: Ilan Peer --- src/ap/ap_drv_ops.h | 5 +++-- src/ap/sta_info.c | 9 ++++++++- src/drivers/driver.h | 3 ++- src/drivers/driver_nl80211.c | 13 ++++++++----- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h index 29a6bdd770..2cd327a047 100644 --- a/src/ap/ap_drv_ops.h +++ b/src/ap/ap_drv_ops.h @@ -168,12 +168,13 @@ static inline int hostapd_drv_set_countermeasures(struct hostapd_data *hapd, static inline int hostapd_drv_set_sta_vlan(const char *ifname, struct hostapd_data *hapd, - const u8 *addr, int vlan_id) + const u8 *addr, int vlan_id, + s8 link_id) { if (hapd->driver == NULL || hapd->driver->set_sta_vlan == NULL) return 0; return hapd->driver->set_sta_vlan(hapd->drv_priv, addr, ifname, - vlan_id); + vlan_id, link_id); } static inline int hostapd_drv_get_inact_sec(struct hostapd_data *hapd, diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c index 6848aab3da..43af479043 100644 --- a/src/ap/sta_info.c +++ b/src/ap/sta_info.c @@ -1083,6 +1083,12 @@ int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta) struct hostapd_vlan *vlan = NULL; int ret; int old_vlanid = sta->vlan_id_bound; + s8 mld_link_id = -1; + +#ifdef CONFIG_IEEE80211BE + if (hapd->conf->mld_ap) + mld_link_id = hapd->conf->mld_link_id; +#endif /* CONFIG_IEEE80211BE */ if ((sta->flags & WLAN_STA_WDS) && sta->vlan_id == 0) { wpa_printf(MSG_DEBUG, @@ -1140,7 +1146,8 @@ skip_counting: if (wpa_auth_sta_set_vlan(sta->wpa_sm, sta->vlan_id) < 0) wpa_printf(MSG_INFO, "Failed to update VLAN-ID for WPA"); - ret = hostapd_drv_set_sta_vlan(iface, hapd, sta->addr, sta->vlan_id); + ret = hostapd_drv_set_sta_vlan(iface, hapd, sta->addr, sta->vlan_id, + mld_link_id); if (ret < 0) { hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211, HOSTAPD_LEVEL_DEBUG, "could not bind the STA " diff --git a/src/drivers/driver.h b/src/drivers/driver.h index af59510c7b..f545dd47c6 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -3719,6 +3719,7 @@ struct wpa_driver_ops { * @ifname: Interface (main or virtual BSS or VLAN) * @addr: MAC address of the associated station * @vlan_id: VLAN ID + * @link_id: The link ID or -1 for non-MLO * Returns: 0 on success, -1 on failure * * This function is used to bind a station to a specific virtual @@ -3728,7 +3729,7 @@ struct wpa_driver_ops { * domains to be used with a single BSS. */ int (*set_sta_vlan)(void *priv, const u8 *addr, const char *ifname, - int vlan_id); + int vlan_id, s8 link_id); /** * commit - Optional commit changes handler (AP only) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 112e59530e..6177482813 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -7872,7 +7872,7 @@ fail: static int i802_set_sta_vlan(struct i802_bss *bss, const u8 *addr, - const char *ifname, int vlan_id) + const char *ifname, int vlan_id, s8 link_id) { struct wpa_driver_nl80211_data *drv = bss->drv; struct nl_msg *msg; @@ -7886,6 +7886,8 @@ static int i802_set_sta_vlan(struct i802_bss *bss, const u8 *addr, nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr) || (vlan_id && (drv->capa.flags & WPA_DRIVER_FLAGS_VLAN_OFFLOAD) && nla_put_u16(msg, NL80211_ATTR_VLAN_ID, vlan_id)) || + (link_id >= 0 && nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, + link_id)) || nla_put_u32(msg, NL80211_ATTR_STA_VLAN, if_nametoindex(ifname))) { nlmsg_free(msg); return -ENOBUFS; @@ -8144,7 +8146,7 @@ static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val, wpa_printf(MSG_ERROR, "nl80211: Failed to set WDS STA " "interface %s up", name); } - return i802_set_sta_vlan(priv, addr, name, 0); + return i802_set_sta_vlan(priv, addr, name, 0, -1); } else { if (bridge_ifname && linux_br_del_if(drv->global->ioctl_sock, bridge_ifname, @@ -8153,7 +8155,7 @@ static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val, "nl80211: Failed to remove interface %s from bridge %s: %s", name, bridge_ifname, strerror(errno)); - i802_set_sta_vlan(priv, addr, bss->ifname, 0); + i802_set_sta_vlan(priv, addr, bss->ifname, 0, -1); nl80211_remove_iface(drv, if_nametoindex(name)); os_memset(&event, 0, sizeof(event)); event.wds_sta_interface.sta_addr = addr; @@ -10317,10 +10319,11 @@ static int driver_nl80211_sta_remove(void *priv, const u8 *addr) static int driver_nl80211_set_sta_vlan(void *priv, const u8 *addr, - const char *ifname, int vlan_id) + const char *ifname, int vlan_id, + s8 link_id) { struct i802_bss *bss = priv; - return i802_set_sta_vlan(bss, addr, ifname, vlan_id); + return i802_set_sta_vlan(bss, addr, ifname, vlan_id, link_id); }