@@ -211,7 +211,6 @@ static int hostapd_driver_init(struct hostapd_iface *iface)
os_memcpy(hapd->own_addr, b, ETH_ALEN);
}
- hapd->mld_link_id = hapd->mld->next_link_id++;
hostapd_mld_add_link(hapd);
goto setup_mld;
@@ -296,7 +295,6 @@ static int hostapd_driver_init(struct hostapd_iface *iface)
else
os_memcpy(hapd->own_addr, b, ETH_ALEN);
- hapd->mld_link_id = hapd->mld->next_link_id++;
hostapd_mld_add_link(hapd);
}
@@ -73,7 +73,6 @@ static void hostapd_switch_color_timeout_handler(void *eloop_data,
void *user_ctx);
#endif /* CONFIG_IEEE80211AX */
-
int hostapd_for_each_interface(struct hapd_interfaces *interfaces,
int (*cb)(struct hostapd_iface *iface,
void *ctx), void *ctx)
@@ -2914,6 +2913,13 @@ struct hostapd_iface * hostapd_alloc_iface(void)
}
#ifdef CONFIG_IEEE80211BE
+static void hostapd_bss_alloc_link_id(struct hostapd_data *hapd)
+{
+ hapd->mld_link_id = hapd->mld->next_link_id++;
+ wpa_printf(MSG_DEBUG, "MLD: %s: Link ID %d assigned.",
+ hapd->mld->name, hapd->mld_link_id);
+}
+
static void hostapd_bss_setup_multi_link(struct hostapd_data *hapd,
struct hapd_interfaces *interfaces)
{
@@ -2937,6 +2943,7 @@ static void hostapd_bss_setup_multi_link(struct hostapd_data *hapd,
continue;
hapd->mld = mld;
+ hostapd_bss_alloc_link_id(hapd);
break;
}
@@ -2956,6 +2963,7 @@ static void hostapd_bss_setup_multi_link(struct hostapd_data *hapd,
wpa_printf(MSG_DEBUG, "MLD %s created", mld->name);
hapd->mld = mld;
+ hostapd_bss_alloc_link_id(hapd);
all_mld = os_realloc_array(interfaces->mld, interfaces->mld_count + 1,
sizeof(struct hostapd_mld *));
Currently, link ID is assigned when BSS is going to set up either via driver init. Later if interface is disabled and enabled again, it will again call setup BSS which will give a new link ID to it. However, Link ID should be same for a BSS affliated to a MLD until the lifetime of the BSS. Hence, add change to assign the link ID during BSS creation itself. And it will remain until BSS entry is completely freed. Hence, link ID will not change as part of disable/enable. Also, since link ID would be decided now, it will help in creating link level control sockets in a subsequent patch. Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com> --- hostapd/main.c | 2 -- src/ap/hostapd.c | 10 +++++++++- 2 files changed, 9 insertions(+), 3 deletions(-)