diff mbox

Create DBus getter/setter for FastReauth

Message ID 20120126185117.DF08F2041A@glenhelen.mtv.corp.google.com
State Accepted
Commit a4bbb6066d044c5fcac4e291349538ad3a46e164
Headers show

Commit Message

Paul Stewart Jan. 25, 2012, 11:12 p.m. UTC
Provide a means over DBus to set the conf->fast_reauth
property, which controls whether TLS session resumption
should be attempted for EAP-TLS 802.1x networks.

Signed-off-by: Paul Stewart <pstew@chromium.org>
Cc: Jouni Malinen <j@w1.fi>
Cc: sleffler@chromium.org
---
 wpa_supplicant/dbus/dbus_new.c          |    4 ++
 wpa_supplicant/dbus/dbus_new_handlers.c |   53 +++++++++++++++++++++++++++++++
 wpa_supplicant/dbus/dbus_new_handlers.h |    8 +++++
 3 files changed, 65 insertions(+), 0 deletions(-)

Comments

Jouni Malinen Jan. 28, 2012, 9:24 a.m. UTC | #1
On Wed, Jan 25, 2012 at 03:12:41PM -0800, Paul Stewart wrote:
> Provide a means over DBus to set the conf->fast_reauth
> property, which controls whether TLS session resumption
> should be attempted for EAP-TLS 802.1x networks.

Thanks! Was there any particular reason for using UInt32 instead of
Boolean as the type of the property? I changed this to Boolean since
conf->fast_reauth is really a boolean value even though it is stored as
an int.
Paul Stewart Jan. 30, 2012, 2:54 p.m. UTC | #2
On Sat, Jan 28, 2012 at 1:24 AM, Jouni Malinen <j@w1.fi> wrote:
> On Wed, Jan 25, 2012 at 03:12:41PM -0800, Paul Stewart wrote:
>> Provide a means over DBus to set the conf->fast_reauth
>> property, which controls whether TLS session resumption
>> should be attempted for EAP-TLS 802.1x networks.
>
> Thanks! Was there any particular reason for using UInt32 instead of
> Boolean as the type of the property? I changed this to Boolean since
> conf->fast_reauth is really a boolean value even though it is stored as
> an int.

Your way sounds much better.  I've downstreamed your change to boolean.

--
Paul
>
> --
> Jouni Malinen                                            PGP id EFC895FA
> _______________________________________________
> HostAP mailing list
> HostAP@lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap
diff mbox

Patch

diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index 2bf9be8..d54f3d5 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -2555,6 +2555,10 @@  static const struct wpa_dbus_property_desc wpas_dbus_interface_properties[] = {
 	  wpas_dbus_getter_networks,
 	  NULL
 	},
+	{ "FastReauth", WPAS_DBUS_NEW_IFACE_INTERFACE, "u",
+	  wpas_dbus_getter_fast_reauth,
+	  wpas_dbus_setter_fast_reauth
+	},
 #ifdef CONFIG_WPS
 	{ "ProcessCredentials", WPAS_DBUS_NEW_IFACE_WPS, "b",
 	  wpas_dbus_getter_process_credentials,
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c
index f90c060..c8727fc 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers.c
@@ -2181,6 +2181,59 @@  dbus_bool_t wpas_dbus_setter_ap_scan(DBusMessageIter *iter, DBusError *error,
 
 
 /**
+ * wpas_dbus_getter_fast_reauth - Control fast
+ * reauthentication (TLS session resumption)
+ * @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 function for "FastReauth" property.
+ */
+dbus_bool_t wpas_dbus_getter_fast_reauth(DBusMessageIter *iter,
+					 DBusError *error,
+					 void *user_data)
+{
+	struct wpa_supplicant *wpa_s = user_data;
+	dbus_uint32_t fast_reauth = wpa_s->conf->fast_reauth;
+
+	return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_UINT32,
+						&fast_reauth, error);
+}
+
+
+/**
+ * wpas_dbus_setter_fast_reauth - Control fast
+ * reauthentication (TLS session resumption)
+ * @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
+ *
+ * Setter function for "FastReauth" property.
+ */
+dbus_bool_t wpas_dbus_setter_fast_reauth(DBusMessageIter *iter,
+				     DBusError *error,
+				     void *user_data)
+{
+	struct wpa_supplicant *wpa_s = user_data;
+	dbus_uint32_t fast_reauth;
+
+	if (!wpas_dbus_simple_property_setter(iter, error, DBUS_TYPE_UINT32,
+					      &fast_reauth))
+		return FALSE;
+
+	if (fast_reauth != 0 && fast_reauth != 1) {
+		dbus_set_error_const(error, DBUS_ERROR_FAILED,
+				     "fast_reauth must be 0 or 1");
+		return FALSE;
+	}
+	wpa_s->conf->fast_reauth = fast_reauth;
+	return TRUE;
+}
+
+
+/**
  * wpas_dbus_getter_bss_expire_age - Get BSS entry expiration age
  * @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 ac3af1f..c0272d5 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.h
+++ b/wpa_supplicant/dbus/dbus_new_handlers.h
@@ -133,6 +133,14 @@  dbus_bool_t wpas_dbus_getter_ap_scan(DBusMessageIter *iter, DBusError *error,
 dbus_bool_t wpas_dbus_setter_ap_scan(DBusMessageIter *iter, DBusError *error,
 				     void *user_data);
 
+dbus_bool_t wpas_dbus_getter_fast_reauth(DBusMessageIter *iter,
+					 DBusError *error,
+					 void *user_data);
+
+dbus_bool_t wpas_dbus_setter_fast_reauth(DBusMessageIter *iter,
+					 DBusError *error,
+					 void *user_data);
+
 dbus_bool_t wpas_dbus_getter_bss_expire_age(DBusMessageIter *iter,
 					    DBusError *error, void *user_data);