wpa_supplicant: Send P2P mgmt iface add/remove notifications
am: d6d8b8ddeb
Change-Id: Ia732948565ffdf96369d34d5b41e935ad43ddb7d
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index c76b82d..6627b90 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -61,15 +61,15 @@
int wpas_notify_iface_added(struct wpa_supplicant *wpa_s)
{
- if (wpa_s->p2p_mgmt)
- return 0;
+ if (!wpa_s->p2p_mgmt) {
+ if (wpas_dbus_register_iface(wpa_s))
+ return -1;
- if (wpas_dbus_register_iface(wpa_s))
- return -1;
+ if (wpas_dbus_register_interface(wpa_s))
+ return -1;
+ }
- if (wpas_dbus_register_interface(wpa_s))
- return -1;
-
+ /* HIDL interface wants to keep track of the P2P mgmt iface. */
if (wpas_hidl_register_interface(wpa_s))
return -1;
@@ -79,15 +79,15 @@
void wpas_notify_iface_removed(struct wpa_supplicant *wpa_s)
{
- if (wpa_s->p2p_mgmt)
- return;
+ if (!wpa_s->p2p_mgmt) {
+ /* unregister interface in old DBus ctrl iface */
+ wpas_dbus_unregister_iface(wpa_s);
- /* unregister interface in old DBus ctrl iface */
- wpas_dbus_unregister_iface(wpa_s);
+ /* unregister interface in new DBus ctrl iface */
+ wpas_dbus_unregister_interface(wpa_s);
+ }
- /* unregister interface in new DBus ctrl iface */
- wpas_dbus_unregister_interface(wpa_s);
-
+ /* HIDL interface wants to keep track of the P2P mgmt iface. */
wpas_hidl_unregister_interface(wpa_s);
}
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 25ec502..8cfb488 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -5225,13 +5225,15 @@
return NULL;
}
- if (iface->p2p_mgmt == 0) {
- /* Notify the control interfaces about new iface */
- if (wpas_notify_iface_added(wpa_s)) {
- wpa_supplicant_deinit_iface(wpa_s, 1, 0);
- return NULL;
- }
+ /* Notify the control interfaces about new iface */
+ if (wpas_notify_iface_added(wpa_s)) {
+ wpa_supplicant_deinit_iface(wpa_s, 1, 0);
+ return NULL;
+ }
+ /* Notify the control interfaces about new networks for non p2p mgmt
+ * ifaces. */
+ if (iface->p2p_mgmt == 0) {
for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next)
wpas_notify_network_added(wpa_s, ssid);
}