diff mbox

D-Bus: Add ConfigFile parameter into the interface properties

Message ID 1471954560-8527-2-git-send-email-blanquicet@gmail.com
State Accepted
Headers show

Commit Message

Jose Blanquicet Aug. 23, 2016, 12:16 p.m. UTC
This patch aims to expose the configuration file path as an interface
property, like is done with the driver and the bridge name.  Doing so,
higher layer programs become responsible to recreate interfaces with the
correct configuration file path when programs need to remove them.

Signed-off-by: Jose Blanquicet <blanquicet@gmail.com>

---
 wpa_supplicant/dbus/dbus_new.c          |  5 +++++
 wpa_supplicant/dbus/dbus_new_handlers.c | 23 +++++++++++++++++++++++
 wpa_supplicant/dbus/dbus_new_handlers.h |  1 +
 3 files changed, 29 insertions(+)

Comments

Jouni Malinen Sept. 17, 2016, 7:50 p.m. UTC | #1
On Tue, Aug 23, 2016 at 02:16:00PM +0200, Jose Blanquicet wrote:
> This patch aims to expose the configuration file path as an interface
> property, like is done with the driver and the bridge name.  Doing so,
> higher layer programs become responsible to recreate interfaces with the
> correct configuration file path when programs need to remove them.

Thanks, applied.
diff mbox

Patch

diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index 6d73bbc..27b3012 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -3158,6 +3158,11 @@  static const struct wpa_dbus_property_desc wpas_dbus_interface_properties[] = {
 	  NULL,
 	  NULL
 	},
+	{ "ConfigFile", WPAS_DBUS_NEW_IFACE_INTERFACE, "s",
+	  wpas_dbus_getter_config_file,
+	  NULL,
+	  NULL
+	},
 	{ "CurrentBSS", WPAS_DBUS_NEW_IFACE_INTERFACE, "o",
 	  wpas_dbus_getter_current_bss,
 	  NULL,
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c
index de6d216..c0ffa44 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers.c
@@ -3262,6 +3262,29 @@  dbus_bool_t wpas_dbus_getter_bridge_ifname(
 
 
 /**
+ * wpas_dbus_getter_config_file - Get interface configuration file path
+ * @iter: Pointer to incoming dbus message iter
+ * @error: Location to store error on failure
+ * @user_data: Function specific data
+ * Returns: TRUE on success, FALSE on failure
+ *
+ * Getter for "ConfigFile" property.
+ */
+dbus_bool_t wpas_dbus_getter_config_file(
+	const struct wpa_dbus_property_desc *property_desc,
+	DBusMessageIter *iter, DBusError *error, void *user_data)
+{
+	struct wpa_supplicant *wpa_s = user_data;
+	char *confname = "";
+
+	if (wpa_s->confname != NULL)
+		confname = wpa_s->confname;
+
+	return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING,
+						&confname, error);
+}
+
+/**
  * wpas_dbus_getter_bsss - Get array of BSSs objects
  * @iter: Pointer to incoming dbus message iter
  * @error: Location to store error on failure
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.h b/wpa_supplicant/dbus/dbus_new_handlers.h
index cd299c0..1d6235d 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.h
+++ b/wpa_supplicant/dbus/dbus_new_handlers.h
@@ -150,6 +150,7 @@  DECLARE_ACCESSOR(wpas_dbus_setter_scan_interval);
 DECLARE_ACCESSOR(wpas_dbus_getter_ifname);
 DECLARE_ACCESSOR(wpas_dbus_getter_driver);
 DECLARE_ACCESSOR(wpas_dbus_getter_bridge_ifname);
+DECLARE_ACCESSOR(wpas_dbus_getter_config_file);
 DECLARE_ACCESSOR(wpas_dbus_getter_current_bss);
 DECLARE_ACCESSOR(wpas_dbus_getter_current_network);
 DECLARE_ACCESSOR(wpas_dbus_getter_current_auth_mode);