From b1f7bd04184e0820150c2ba6b96a54dc78ae7cfb Mon Sep 17 00:00:00 2001 From: Aditya Kumar Singh Date: Tue, 10 Oct 2023 23:10:04 +0530 Subject: [PATCH] hostapd: cache hostapd_data context in per link bss struct Currently, struct i802_link has defined a void *ctx member but has not used it. Add changes to cache the corresponding hostapd_data struct context into it. This will be useful for wpa events callback processing. Signed-off-by: Aditya Kumar Singh --- src/ap/ap_drv_ops.h | 2 +- src/drivers/driver.h | 3 ++- src/drivers/driver_nl80211.c | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h index eecb739515ab..e230e62e0a29 100644 --- a/src/ap/ap_drv_ops.h +++ b/src/ap/ap_drv_ops.h @@ -453,7 +453,7 @@ static inline int hostapd_drv_link_add(struct hostapd_data *hapd, if (!hapd->driver || !hapd->drv_priv || !hapd->driver->link_add) return -1; - return hapd->driver->link_add(hapd->drv_priv, link_id, addr); + return hapd->driver->link_add(hapd->drv_priv, link_id, addr, hapd); } #endif /* CONFIG_IEEE80211BE */ diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 4a3a9631b778..70005d1512bb 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -5183,9 +5183,10 @@ struct wpa_driver_ops { * @priv: Private driver interface data * @link_id: The link ID * @addr: The MAC address to use for the link + * @bss_ctx: BSS context for %WPA_IF_AP_BSS interfaces * Returns: 0 on success, negative value on failure */ - int (*link_add)(void *priv, u8 link_id, const u8 *addr); + int (*link_add)(void *priv, u8 link_id, const u8 *addr, void *bss_ctx); #ifdef CONFIG_TESTING_OPTIONS int (*register_frame)(void *priv, u16 type, diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index bb7ea7e158a2..c0a00cb0ee15 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -13663,7 +13663,7 @@ static int nl80211_dpp_listen(void *priv, bool enable) #endif /* CONFIG_DPP */ -static int nl80211_link_add(void *priv, u8 link_id, const u8 *addr) +static int nl80211_link_add(void *priv, u8 link_id, const u8 *addr, void *bss_ctx) { struct i802_bss *bss = priv; struct wpa_driver_nl80211_data *drv = bss->drv; @@ -13726,6 +13726,7 @@ static int nl80211_link_add(void *priv, u8 link_id, const u8 *addr) bss->links[idx].link_id = link_id; os_memcpy(bss->links[idx].addr, addr, ETH_ALEN); + bss->links[idx].ctx = bss_ctx; bss->n_links = idx + 1; -- 2.17.1