binder: Add network removal notification
Invoke the new helper function for network add/remove.
BUG: 29998764
Change-Id: I5f741ca447a77fb261aa62cd7cd74a9ddca8d518
TEST: Ran integration tests under wificond.
Signed-off-by: Roshan Pius <rpius@google.com>
diff --git a/wpa_supplicant/binder/iface.cpp b/wpa_supplicant/binder/iface.cpp
index 5b5a68e..d5a6502 100644
--- a/wpa_supplicant/binder/iface.cpp
+++ b/wpa_supplicant/binder/iface.cpp
@@ -42,21 +42,12 @@
"wpa_supplicant does not control this interface.");
}
- struct wpa_ssid *ssid = wpa_config_add_network(wpa_s->conf);
+ struct wpa_ssid *ssid = wpa_supplicant_add_network(wpa_s);
if (!ssid) {
return android::binder::Status::fromServiceSpecificError(
ERROR_GENERIC, "wpa_supplicant couldn't add this network.");
}
- // This sequence of steps after network addition is following what is
- // currently being done in |ctrl_iface.c| & |dbus_new_handlers|.
- // Notify the control interfaces about the network addition.
- wpas_notify_network_added(wpa_s, ssid);
- // Set the new network to be disabled.
- ssid->disabled = 1;
- // Set defaults for the new network.
- wpa_config_set_network_defaults(ssid);
-
BinderManager *binder_manager = BinderManager::getInstance();
if (!binder_manager ||
binder_manager->getNetworkBinderObjectByIfnameAndNetworkId(
@@ -77,13 +68,14 @@
"wpa_supplicant does not control this interface.");
}
- struct wpa_ssid *ssid = wpa_config_get_network(wpa_s->conf, network_id);
- if (!ssid) {
+ int result = wpa_supplicant_remove_network(wpa_s, network_id);
+ if (result == -1) {
return android::binder::Status::fromServiceSpecificError(
ERROR_NETWORK_UNKNOWN,
"wpa_supplicant does not control this network.");
}
- if (wpa_config_remove_network(wpa_s->conf, network_id)) {
+
+ if (result == -2) {
return android::binder::Status::fromServiceSpecificError(
ERROR_GENERIC,
"wpa_supplicant couldn't remove this network.");
@@ -150,5 +142,4 @@
return wpa_supplicant_get_iface(
(struct wpa_global *)wpa_global_, ifname_.c_str());
}
-
} // namespace wpa_supplicant_binder
diff --git a/wpa_supplicant/binder/iface.h b/wpa_supplicant/binder/iface.h
index 6db4609..50d7d80 100644
--- a/wpa_supplicant/binder/iface.h
+++ b/wpa_supplicant/binder/iface.h
@@ -18,9 +18,7 @@
extern "C" {
#include "utils/common.h"
#include "utils/includes.h"
-#include "../config.h"
-#include "../notify.h"
-#include "../wpa_supplicant_i.h"
+#include "wpa_supplicant_i.h"
}
namespace wpa_supplicant_binder {