Wehn dealing with multiple bssid support we need to have a means to get a BSSs index and hostapd_data of the transmitting interface. Signed-off-by: John Crispin <john@xxxxxxxxxxx> --- src/ap/hostapd.c | 20 ++++++++++++++++++++ src/ap/hostapd.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index b37f49f9a..c442b82db 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -87,6 +87,26 @@ int hostapd_for_each_interface(struct hapd_interfaces *interfaces, } +int hostapd_get_bss_index(struct hostapd_data *hapd) +{ + size_t i; + + for (i = 1; i < hapd->iface->num_bss; i++) + if (hapd->iface->bss[i] == hapd) + return i; + return 0; +} + + +struct hostapd_data * hostapd_get_primary_bss(struct hostapd_data *hapd) +{ + if (hapd->iconf->multiple_bssid) + return hapd->iface->bss[0]; + + return hapd; +} + + void hostapd_reconfig_encryption(struct hostapd_data *hapd) { if (hapd->wpa_auth) diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h index b70d13fba..44d2c6068 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -595,6 +595,8 @@ struct hostapd_iface { int hostapd_for_each_interface(struct hapd_interfaces *interfaces, int (*cb)(struct hostapd_iface *iface, void *ctx), void *ctx); +int hostapd_get_bss_index(struct hostapd_data *hapd); +struct hostapd_data * hostapd_get_primary_bss(struct hostapd_data *hapd); int hostapd_reload_config(struct hostapd_iface *iface); void hostapd_reconfig_encryption(struct hostapd_data *hapd); struct hostapd_data * -- 2.25.1 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap