From patchwork Mon Jul 6 12:50:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Crispin X-Patchwork-Id: 1323604 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=phrozen.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=ryVneOx0; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B0lnM5KP8z9sSn for ; Mon, 6 Jul 2020 22:51:35 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=elRU8HiVNqKAKVvz1gVbfRiZMIszdssk7cV1mGj6Y0E=; b=ryVneOx0U3NkaQ3Kt/SD+lUZW vGU8HwUbOKXugKeo8gCcqeD9OtLSPl6/xUtaDOMTZqI3G+EyDFY5i5m4Kl6wlrnRnGo0eWea5LFrv 8AtwG9kz3ClHml91LCGFfWQ//d0urO9jBaUvhOmx9hLbIzFgPeHOIccsOHgJX1Omh92qpKWQem0+o vUMNQeGmAEX7n4ABdQeVvs/9AqqJtXcOxVC1OwBPfN1nY2Qo/PK4d+PxBkDuGPufXlxIxFp3zSj2e FreYuIiYTwxL4rDBHT0VUDuNV9v1q/S2Q+SG/I633DXwMKr9Ckhr7TwXoDzpgXgna5MWPQGhFjkl4 rNkkPMTEw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jsQaB-0006Av-9f; Mon, 06 Jul 2020 12:50:51 +0000 Received: from nbd.name ([2a01:4f8:221:3d45::2]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jsQZz-00066M-TM for hostap@lists.infradead.org; Mon, 06 Jul 2020 12:50:42 +0000 Received: from [134.101.131.141] (helo=localhost.localdomain) by ds12 with esmtpa (Exim 4.89) (envelope-from ) id 1jsQZy-0001fi-2k; Mon, 06 Jul 2020 14:50:38 +0200 From: John Crispin To: hostap@lists.infradead.org Subject: [PATCH V2 3/7] multiple_bssid: add support for non/transmitting mode Date: Mon, 6 Jul 2020 14:50:27 +0200 Message-Id: <20200706125031.668258-4-john@phrozen.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200706125031.668258-1-john@phrozen.org> References: <20200706125031.668258-1-john@phrozen.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200706_085040_111436_972D911A X-CRM114-Status: GOOD ( 17.02 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: John Crispin Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org When starting the non-transmitting BSSs we need to let if_add() known what the bss_index and bss_parent are. Signed-off-by: John Crispin --- src/ap/ap_drv_ops.c | 8 +++++--- src/ap/ap_drv_ops.h | 3 ++- src/ap/beacon.c | 4 ++++ src/ap/hostapd.c | 9 ++++++++- src/common/defs.h | 7 +++++++ src/drivers/driver.h | 10 +++++++++- wpa_supplicant/driver_i.h | 2 +- 7 files changed, 36 insertions(+), 7 deletions(-) diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c index f15765945..3a46b5745 100644 --- a/src/ap/ap_drv_ops.c +++ b/src/ap/ap_drv_ops.c @@ -321,7 +321,7 @@ int hostapd_vlan_if_add(struct hostapd_data *hapd, const char *ifname) char force_ifname[IFNAMSIZ]; u8 if_addr[ETH_ALEN]; return hostapd_if_add(hapd, WPA_IF_AP_VLAN, ifname, hapd->own_addr, - NULL, NULL, force_ifname, if_addr, NULL, 0); + NULL, NULL, force_ifname, if_addr, NULL, 0, 0, NULL); } @@ -497,13 +497,15 @@ int hostapd_set_ssid(struct hostapd_data *hapd, const u8 *buf, size_t len) int hostapd_if_add(struct hostapd_data *hapd, enum wpa_driver_if_type type, const char *ifname, const u8 *addr, void *bss_ctx, void **drv_priv, char *force_ifname, u8 *if_addr, - const char *bridge, int use_existing) + const char *bridge, int use_existing, + int multi_bssid_mode, const char *multi_bssid_parent) { if (hapd->driver == NULL || hapd->driver->if_add == NULL) return -1; return hapd->driver->if_add(hapd->drv_priv, type, ifname, addr, bss_ctx, drv_priv, force_ifname, if_addr, - bridge, use_existing, 1); + bridge, use_existing, 1, + multi_bssid_mode, multi_bssid_parent); } diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h index 5738c1c97..651b77e9a 100644 --- a/src/ap/ap_drv_ops.h +++ b/src/ap/ap_drv_ops.h @@ -54,7 +54,8 @@ int hostapd_set_ssid(struct hostapd_data *hapd, const u8 *buf, size_t len); int hostapd_if_add(struct hostapd_data *hapd, enum wpa_driver_if_type type, const char *ifname, const u8 *addr, void *bss_ctx, void **drv_priv, char *force_ifname, u8 *if_addr, - const char *bridge, int use_existing); + const char *bridge, int use_existin, + int multi_bssid_mode, const char *multi_bssid_parent); int hostapd_if_remove(struct hostapd_data *hapd, enum wpa_driver_if_type type, const char *ifname); int hostapd_set_ieee8021x(struct hostapd_data *hapd, diff --git a/src/ap/beacon.c b/src/ap/beacon.c index b3b33b7fa..4988ee2a1 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -1506,6 +1506,10 @@ int ieee802_11_set_beacon(struct hostapd_data *hapd) params.twt_responder = hostapd_get_he_twt_responder(hapd, IEEE80211_MODE_AP); #endif /* CONFIG_IEEE80211AX */ + if (hapd->iconf->multiple_bssid) { + params.multiple_bssid_index = hostapd_get_bss_index(hapd); + params.multiple_bssid_count = iface->num_bss; + } hapd->reenable_beacon = 0; if (cmode && diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index c442b82db..26e62d991 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -1149,6 +1149,13 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first) if (!first || first == -1) { u8 *addr = hapd->own_addr; + int multiple_bssid_mode = HOSTAPD_BSSID_LEGACY; + const char *multiple_bssid_parent = NULL; + + if (hapd->iconf->multiple_bssid) { + multiple_bssid_mode = HOSTAPD_BSSID_NON_TRANSMITTED; + multiple_bssid_parent = hapd->iface->bss[0]->conf->iface; + } if (!is_zero_ether_addr(conf->bssid)) { /* Allocate the configured BSSID. */ @@ -1176,7 +1183,7 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first) conf->iface, addr, hapd, &hapd->drv_priv, force_ifname, if_addr, conf->bridge[0] ? conf->bridge : NULL, - first == -1)) { + first == -1, multiple_bssid_mode, multiple_bssid_parent)) { wpa_printf(MSG_ERROR, "Failed to add BSS (BSSID=" MACSTR ")", MAC2STR(hapd->own_addr)); hapd->interface_added = 0; diff --git a/src/common/defs.h b/src/common/defs.h index bbe3120de..ef6f518d2 100644 --- a/src/common/defs.h +++ b/src/common/defs.h @@ -471,4 +471,11 @@ enum ptk0_rekey_handling { PTK0_REKEY_ALLOW_NEVER }; + +enum hostapd_multi_bssid_mode { + HOSTAPD_BSSID_LEGACY = 0, + HOSTAPD_BSSID_TRANSMITTED, + HOSTAPD_BSSID_NON_TRANSMITTED, +}; + #endif /* DEFS_H */ diff --git a/src/drivers/driver.h b/src/drivers/driver.h index cb412cbfe..cfeb94781 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -1508,6 +1508,13 @@ struct wpa_driver_ap_params { * twt_responder - Whether Target Wait Time responder is enabled */ int twt_responder; + + /** + * multiple_bssid_mode - The multi bssid mode + */ + int multiple_bssid_mode; + unsigned int multiple_bssid_index; + unsigned int multiple_bssid_count; }; struct wpa_driver_mesh_bss_params { @@ -3244,7 +3251,8 @@ struct wpa_driver_ops { int (*if_add)(void *priv, enum wpa_driver_if_type type, const char *ifname, const u8 *addr, void *bss_ctx, void **drv_priv, char *force_ifname, u8 *if_addr, - const char *bridge, int use_existing, int setup_ap); + const char *bridge, int use_existing, int setup_ap, + int multi_bssid_mode, const char *multi_bssid_parent); /** * if_remove - Remove a virtual interface diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h index 54ae03b5a..85af3c971 100644 --- a/wpa_supplicant/driver_i.h +++ b/wpa_supplicant/driver_i.h @@ -444,7 +444,7 @@ static inline int wpa_drv_if_add(struct wpa_supplicant *wpa_s, if (wpa_s->driver->if_add) return wpa_s->driver->if_add(wpa_s->drv_priv, type, ifname, addr, bss_ctx, NULL, force_ifname, - if_addr, bridge, 0, 0); + if_addr, bridge, 0, 0, 0, NULL); return -1; }