--- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -522,6 +522,7 @@ static void handle_auth_ft_finish(void * hostapd_logger(hapd, dst, HOSTAPD_MODULE_IEEE80211, HOSTAPD_LEVEL_DEBUG, "authentication OK (FT)"); + hostapd_ubus_notify(hapd, "ft-finish", sta->addr); sta->flags |= WLAN_STA_AUTH; mlme_authenticate_indication(hapd, sta); } @@ -5273,6 +5274,8 @@ static void handle_assoc(struct hostapd_ } sta = ap_get_sta(hapd, mgmt->sa); + if (sta && reassoc) + memcpy(sta->origin_ap, mgmt->u.reassoc_req.current_ap, 6); #ifdef CONFIG_IEEE80211R_AP if (sta && sta->auth_alg == WLAN_AUTH_FT && (sta->flags & WLAN_STA_AUTH) == 0) { @@ -5426,6 +5429,7 @@ static void handle_assoc(struct hostapd_ .type = HOSTAPD_UBUS_ASSOC_REQ, .mgmt_frame = mgmt, .ssi_signal = rssi, + .reassoc = reassoc, }; /* followed by SSID and Supported rates; and HT capabilities if 802.11n @@ -6496,7 +6500,7 @@ static void handle_assoc_cb(struct hosta * Open, static WEP, FT protocol, or FILS; no separate * authorization step. */ - ap_sta_set_authorized(hapd, sta, 1); + _ap_sta_set_authorized(hapd, sta, 1, reassoc); } if (reassoc) --- a/src/ap/ubus.c +++ b/src/ap/ubus.c @@ -1870,6 +1870,8 @@ int hostapd_ubus_handle_event(struct hos if (req->ssi_signal) blobmsg_add_u32(&b, "signal", req->ssi_signal); blobmsg_add_u32(&b, "freq", hapd->iface->freq); + if (req->reassoc && req->mgmt_frame) + blobmsg_add_macaddr(&b, "origin", req->mgmt_frame->u.reassoc_req.current_ap); if (req->elems) { if(req->elems->ht_capabilities) @@ -1940,6 +1942,7 @@ void hostapd_ubus_notify(struct hostapd_ blob_buf_init(&b, 0); blobmsg_add_macaddr(&b, "address", addr); blobmsg_add_string(&b, "ifname", hapd->conf->iface); + blobmsg_printf(&b, "target", MACSTR, MAC2STR(hapd->conf->bssid)); ubus_notify(ctx, &hapd->ubus.obj, type, b.head, -1); } @@ -1958,7 +1961,7 @@ void hostapd_ubus_notify_csa(struct host } -void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta) +void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta, int reassoc) { if (!hapd->ubus.obj.has_subscribers) return; @@ -1975,6 +1978,9 @@ void hostapd_ubus_notify_authorized(stru blobmsg_add_u32(&b, "", sta->bandwidth[1]); blobmsg_close_array(&b, r); } + if (reassoc) + blobmsg_add_macaddr(&b, "origin", sta->origin_ap); + blobmsg_printf(&b, "target", MACSTR, MAC2STR(hapd->conf->bssid)); ubus_notify(ctx, &hapd->ubus.obj, "sta-authorized", b.head, -1); } --- a/src/ap/ubus.h +++ b/src/ap/ubus.h @@ -22,6 +22,7 @@ struct hostapd_ubus_request { const struct ieee802_11_elems *elems; int ssi_signal; /* dBm */ const u8 *addr; + int reassoc; }; struct hostapd_iface; @@ -49,7 +50,7 @@ void hostapd_ubus_remove_vlan(struct hos int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req); void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac); -void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta); +void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta, int reassoc); void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd, const u8 *addr, u8 token, u8 rep_mode, struct rrm_measurement_beacon_report *rep, --- a/src/ap/sta_info.c +++ b/src/ap/sta_info.c @@ -1297,8 +1297,8 @@ const u8 * ap_sta_wpa_get_dpp_pkhash(str } -void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta, - int authorized) +void _ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta, + int authorized, int reassoc) { const u8 *dev_addr = NULL; char buf[100]; @@ -1404,7 +1404,7 @@ void ap_sta_set_authorized(struct hostap dpp_pkhash, SHA256_MAC_LEN); } - hostapd_ubus_notify_authorized(hapd, sta); + hostapd_ubus_notify_authorized(hapd, sta, reassoc); wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED "%s%s%s%s%s", buf, ip_addr, keyid_buf, dpp_pkhash_buf, alg_buf); @@ -1434,6 +1434,11 @@ void ap_sta_set_authorized(struct hostap } #endif /* CONFIG_FST */ } +void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta, + int authorized) +{ + _ap_sta_set_authorized(hapd, sta, authorized, 0); +} void ap_sta_disconnect(struct hostapd_data *hapd, struct sta_info *sta, --- a/src/ap/sta_info.h +++ b/src/ap/sta_info.h @@ -102,6 +102,7 @@ struct sta_info { struct sta_info *next; /* next entry in sta list */ struct sta_info *hnext; /* next entry in hash table list */ u8 addr[6]; + u8 origin_ap[6]; be32 ipaddr; struct dl_list ip6addr; /* list head for struct ip6addr */ u16 aid; /* STA's unique AID (1 .. 2007) or 0 if not yet assigned */ @@ -398,6 +399,9 @@ const u8 * ap_sta_wpa_get_dpp_pkhash(str void ap_sta_disconnect(struct hostapd_data *hapd, struct sta_info *sta, const u8 *addr, u16 reason); +void _ap_sta_set_authorized(struct hostapd_data *hapd, + struct sta_info *sta, int authorized, + int reassoc); void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta, int authorized); static inline int ap_sta_is_authorized(struct sta_info *sta)