diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index c59ccc3ce..428a496d4 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -2940,7 +2940,7 @@ static int wpa_supplicant_ctrl_iface_update_network( static int wpa_supplicant_ctrl_iface_set_network( struct wpa_supplicant *wpa_s, char *cmd) { - int id, ret, prev_bssid_set; + int id, ret, prev_bssid_set, prev_disabled; struct wpa_ssid *ssid; char *name, *value; u8 prev_bssid[ETH_ALEN]; @@ -2970,6 +2970,7 @@ static int wpa_supplicant_ctrl_iface_set_network( } prev_bssid_set = ssid->bssid_set; + prev_disabled = ssid->disabled; os_memcpy(prev_bssid, ssid->bssid, ETH_ALEN); ret = wpa_supplicant_ctrl_iface_update_network(wpa_s, ssid, name, value); @@ -2977,6 +2978,11 @@ static int wpa_supplicant_ctrl_iface_set_network( (ssid->bssid_set != prev_bssid_set || os_memcmp(ssid->bssid, prev_bssid, ETH_ALEN) != 0)) wpas_notify_network_bssid_set_changed(wpa_s, ssid); + + if (prev_disabled != ssid->disabled && + (prev_disabled == 2 || ssid->disabled == 2)) + wpas_notify_network_type_changed(wpa_s, ssid); + return ret; } diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c index bf1836a5c..ea7dbdb15 100644 --- a/wpa_supplicant/notify.c +++ b/wpa_supplicant/notify.c @@ -764,3 +764,22 @@ void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s, wpa_drv_roaming(wpa_s, !ssid->bssid_set, ssid->bssid_set ? ssid->bssid : NULL); } + + +void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s, + struct wpa_ssid *ssid) +{ +#ifdef CONFIG_P2P + if (ssid->disabled == 2) { + /* Changed from normal network profile to persistent group */ + ssid->disabled = 0; + wpas_dbus_unregister_network(wpa_s, ssid->id); + ssid->disabled = 2; + wpas_dbus_register_persistent_group(wpa_s, ssid); + } else { + /* Changed from persistent group to normal network profile */ + wpas_dbus_unregister_persistent_group(wpa_s, ssid->id); + wpas_dbus_register_network(wpa_s, ssid); + } +#endif /* CONFIG_P2P */ +} diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h index 7fb1f58ef..b268332ff 100644 --- a/wpa_supplicant/notify.h +++ b/wpa_supplicant/notify.h @@ -131,5 +131,7 @@ void wpas_notify_eap_status(struct wpa_supplicant *wpa_s, const char *status, const char *parameter); void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid); +void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s, + struct wpa_ssid *ssid); #endif /* NOTIFY_H */