More consistent use of mesh peer connected/disconnected notification

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>
This commit is contained in:
Jouni Malinen 2023-10-29 10:49:43 +02:00
parent bd37f86155
commit 11a6ae242e
2 changed files with 8 additions and 13 deletions

View 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);

View 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);
}