]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
FST: Make sure get_hw_modes() callback is set for hostapd
authorJouni Malinen <j@w1.fi>
Sat, 7 May 2022 21:27:51 +0000 (00:27 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 7 May 2022 21:27:51 +0000 (00:27 +0300)
It looks like fst_wpa_obj::get_hw_modes would have been left
uninitialized in hostapd. It is not obviously clear why this would not
have caused issues earlier, but in any case, better make this set
properly to allow unexpected behavior should that function pointer ever
be used.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/ap/hostapd.c
wpa_supplicant/wpa_supplicant.c

index ef53c41dfb0d2c7599dbc7fd21e7aacf5f1996dd..122d1660fbdb69a957ece5380bc27bb2e6ee79d9 100644 (file)
@@ -1784,6 +1784,16 @@ static void fst_hostapd_get_channel_info_cb(void *ctx,
 }
 
 
+static int fst_hostapd_get_hw_modes_cb(void *ctx,
+                                      struct hostapd_hw_modes **modes)
+{
+       struct hostapd_data *hapd = ctx;
+
+       *modes = hapd->iface->hw_features;
+       return hapd->iface->num_hw_features;
+}
+
+
 static void fst_hostapd_set_ies_cb(void *ctx, const struct wpabuf *fst_ies)
 {
        struct hostapd_data *hapd = ctx;
@@ -1876,9 +1886,11 @@ static const u8 * fst_hostapd_get_peer_next(void *ctx,
 void fst_hostapd_fill_iface_obj(struct hostapd_data *hapd,
                                struct fst_wpa_obj *iface_obj)
 {
+       os_memset(iface_obj, 0, sizeof(*iface_obj));
        iface_obj->ctx = hapd;
        iface_obj->get_bssid = fst_hostapd_get_bssid_cb;
        iface_obj->get_channel_info = fst_hostapd_get_channel_info_cb;
+       iface_obj->get_hw_modes = fst_hostapd_get_hw_modes_cb;
        iface_obj->set_ies = fst_hostapd_set_ies_cb;
        iface_obj->send_action = fst_hostapd_send_action_cb;
        iface_obj->get_mb_ie = fst_hostapd_get_mb_ie_cb;
index e16861886ab21c1edfeccc2dd34464aa3d17aa3b..15215c3b1ae00606a7112036819efa0127683fd5 100644 (file)
@@ -5964,6 +5964,7 @@ static const u8 * wpas_fst_get_peer_next(void *ctx,
 void fst_wpa_supplicant_fill_iface_obj(struct wpa_supplicant *wpa_s,
                                       struct fst_wpa_obj *iface_obj)
 {
+       os_memset(iface_obj, 0, sizeof(*iface_obj));
        iface_obj->ctx              = wpa_s;
        iface_obj->get_bssid        = wpas_fst_get_bssid_cb;
        iface_obj->get_channel_info = wpas_fst_get_channel_info_cb;