]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
More consistent use of mesh peer connected/disconnected notification
authorJouni Malinen <j@w1.fi>
Sun, 29 Oct 2023 08:49:43 +0000 (10:49 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 29 Oct 2023 08:49:43 +0000 (10:49 +0200)
Use the wpas_notify_mesh_peer_*() functions for sending the control
interface events in addition to the D-Bus events so that these are all
done consistently.

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/mesh_mpm.c
wpa_supplicant/notify.c

index 643796672a5a4e926fc9945b983a313ce508a305..77417ae6a4af63c6a45950ad18f94dec71f90a0a 100644 (file)
@@ -563,8 +563,8 @@ static int mesh_mpm_plink_close(struct hostapd_data *hapd, struct sta_info *sta,
        if (sta) {
                if (sta->plink_state == PLINK_ESTAB) {
                        hapd->num_plinks--;
-                       wpa_msg(wpa_s, MSG_INFO, MESH_PEER_DISCONNECTED MACSTR,
-                               MAC2STR(sta->addr));
+                       wpas_notify_mesh_peer_disconnected(
+                               wpa_s, sta->addr, WLAN_REASON_UNSPECIFIED);
                }
                wpa_mesh_set_plink_state(wpa_s, sta, PLINK_HOLDING);
                mesh_mpm_send_plink_action(wpa_s, sta, PLINK_CLOSE, reason);
@@ -954,11 +954,6 @@ static void mesh_mpm_plink_estab(struct wpa_supplicant *wpa_s,
        peer_add_timer(wpa_s, NULL);
        eloop_cancel_timeout(plink_timer, wpa_s, sta);
 
-       /* Send ctrl event */
-       wpa_msg(wpa_s, MSG_INFO, MESH_PEER_CONNECTED MACSTR,
-               MAC2STR(sta->addr));
-
-       /* Send D-Bus event */
        wpas_notify_mesh_peer_connected(wpa_s, sta->addr);
 }
 
@@ -1109,10 +1104,6 @@ static void mesh_mpm_fsm(struct wpa_supplicant *wpa_s, struct sta_info *sta,
                                " closed with reason %d",
                                MAC2STR(sta->addr), reason);
 
-                       wpa_msg(wpa_s, MSG_INFO, MESH_PEER_DISCONNECTED MACSTR,
-                               MAC2STR(sta->addr));
-
-                       /* Send D-Bus event */
                        wpas_notify_mesh_peer_disconnected(wpa_s, sta->addr,
                                                           reason);
 
@@ -1435,8 +1426,8 @@ void mesh_mpm_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
 
        if (sta->plink_state == PLINK_ESTAB) {
                hapd->num_plinks--;
-               wpa_msg(wpa_s, MSG_INFO, MESH_PEER_DISCONNECTED MACSTR,
-                       MAC2STR(sta->addr));
+               wpas_notify_mesh_peer_disconnected(
+                       wpa_s, sta->addr, WLAN_REASON_UNSPECIFIED);
        }
        eloop_cancel_timeout(plink_timer, ELOOP_ALL_CTX, sta);
        eloop_cancel_timeout(mesh_auth_timer, ELOOP_ALL_CTX, sta);
index 4b4a34b52d626652d7d11d5f1a6a4f321043163e..a2693587193229f3fbd4c196ab2c8a7204808f5a 100644 (file)
@@ -949,6 +949,8 @@ void wpas_notify_mesh_peer_connected(struct wpa_supplicant *wpa_s,
        if (wpa_s->p2p_mgmt)
                return;
 
+       wpa_msg(wpa_s, MSG_INFO, MESH_PEER_CONNECTED MACSTR,
+               MAC2STR(peer_addr));
        wpas_dbus_signal_mesh_peer_connected(wpa_s, peer_addr);
 }
 
@@ -959,6 +961,8 @@ void wpas_notify_mesh_peer_disconnected(struct wpa_supplicant *wpa_s,
        if (wpa_s->p2p_mgmt)
                return;
 
+       wpa_msg(wpa_s, MSG_INFO, MESH_PEER_DISCONNECTED MACSTR,
+               MAC2STR(peer_addr));
        wpas_dbus_signal_mesh_peer_disconnected(wpa_s, peer_addr, reason_code);
 }