dbus: Add an interface configuration entry to set the WPS methods
It is thus possible to restrain WPS methods to prefered ones, like PBC only, etc. Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
393869c551
commit
1274ec2329
3 changed files with 69 additions and 0 deletions
|
@ -2961,6 +2961,10 @@ static const struct wpa_dbus_property_desc wpas_dbus_interface_properties[] = {
|
||||||
wpas_dbus_getter_process_credentials,
|
wpas_dbus_getter_process_credentials,
|
||||||
wpas_dbus_setter_process_credentials
|
wpas_dbus_setter_process_credentials
|
||||||
},
|
},
|
||||||
|
{ "ConfigMethods", WPAS_DBUS_NEW_IFACE_WPS, "s",
|
||||||
|
wpas_dbus_getter_config_methods,
|
||||||
|
wpas_dbus_setter_config_methods
|
||||||
|
},
|
||||||
#endif /* CONFIG_WPS */
|
#endif /* CONFIG_WPS */
|
||||||
#ifdef CONFIG_P2P
|
#ifdef CONFIG_P2P
|
||||||
{ "P2PDeviceConfig", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "a{sv}",
|
{ "P2PDeviceConfig", WPAS_DBUS_NEW_IFACE_P2PDEVICE, "a{sv}",
|
||||||
|
|
|
@ -298,6 +298,14 @@ dbus_bool_t wpas_dbus_setter_process_credentials(DBusMessageIter *iter,
|
||||||
DBusError *error,
|
DBusError *error,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
||||||
|
dbus_bool_t wpas_dbus_getter_config_methods(DBusMessageIter *iter,
|
||||||
|
DBusError *error,
|
||||||
|
void *user_data);
|
||||||
|
|
||||||
|
dbus_bool_t wpas_dbus_setter_config_methods(DBusMessageIter *iter,
|
||||||
|
DBusError *error,
|
||||||
|
void *user_data);
|
||||||
|
|
||||||
DBusMessage * wpas_dbus_handler_tdls_discover(DBusMessage *message,
|
DBusMessage * wpas_dbus_handler_tdls_discover(DBusMessage *message,
|
||||||
struct wpa_supplicant *wpa_s);
|
struct wpa_supplicant *wpa_s);
|
||||||
DBusMessage * wpas_dbus_handler_tdls_setup(DBusMessage *message,
|
DBusMessage * wpas_dbus_handler_tdls_setup(DBusMessage *message,
|
||||||
|
|
|
@ -389,3 +389,60 @@ dbus_bool_t wpas_dbus_setter_process_credentials(DBusMessageIter *iter,
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wpas_dbus_getter_config_methods - Get current WPS configuration methods
|
||||||
|
* @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 "ConfigMethods" property. Returned boolean will be true if
|
||||||
|
* providing the relevant string worked, or false otherwise.
|
||||||
|
*/
|
||||||
|
dbus_bool_t wpas_dbus_getter_config_methods(DBusMessageIter *iter,
|
||||||
|
DBusError *error,
|
||||||
|
void *user_data)
|
||||||
|
{
|
||||||
|
struct wpa_supplicant *wpa_s = user_data;
|
||||||
|
char *methods = wpa_s->conf->config_methods;
|
||||||
|
|
||||||
|
return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING,
|
||||||
|
&methods, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wpas_dbus_setter_config_methods - Set WPS configuration methods
|
||||||
|
* @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 for "ConfigMethods" property. Sets the methods string, apply such
|
||||||
|
* change and returns true on success. Returns false otherwise.
|
||||||
|
*/
|
||||||
|
dbus_bool_t wpas_dbus_setter_config_methods(DBusMessageIter *iter,
|
||||||
|
DBusError *error,
|
||||||
|
void *user_data)
|
||||||
|
{
|
||||||
|
struct wpa_supplicant *wpa_s = user_data;
|
||||||
|
char *methods, *new_methods;
|
||||||
|
|
||||||
|
if (!wpas_dbus_simple_property_setter(iter, error, DBUS_TYPE_STRING,
|
||||||
|
&methods))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
new_methods = os_strdup(methods);
|
||||||
|
if (!new_methods)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
os_free(wpa_s->conf->config_methods);
|
||||||
|
wpa_s->conf->config_methods = new_methods;
|
||||||
|
|
||||||
|
wpa_s->conf->changed_parameters |= CFG_CHANGED_CONFIG_METHODS;
|
||||||
|
wpa_supplicant_update_config(wpa_s);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue