[PATCH 1/2] dbus: Add new method MeshInterfaceAdd to add mesh interface

Dan Williams dcbw at redhat.com
Fri Jan 6 10:03:41 PST 2017


On Thu, 2017-01-05 at 20:48 +0530, Saurav Babu wrote:
> Signed-off-by: Saurav Babu <saurav.babu at samsung.com>
> ---
>  wpa_supplicant/dbus/dbus_new.c          |  9 +++++++++
>  wpa_supplicant/dbus/dbus_new_handlers.c | 28
> ++++++++++++++++++++++++++++
>  wpa_supplicant/dbus/dbus_new_handlers.h |  3 +++
>  3 files changed, 40 insertions(+)
> 
> diff --git a/wpa_supplicant/dbus/dbus_new.c
> b/wpa_supplicant/dbus/dbus_new.c
> index a601182..7721b59 100644
> --- a/wpa_supplicant/dbus/dbus_new.c
> +++ b/wpa_supplicant/dbus/dbus_new.c
> @@ -3114,6 +3114,15 @@ static const struct wpa_dbus_method_desc
> wpas_dbus_interface_methods[] = {
>  	  }
>  	},
>  #endif /* CONFIG_NO_CONFIG_WRITE */
> +#ifdef CONFIG_MESH
> +	{ "MeshInterfaceAdd", WPAS_DBUS_NEW_IFACE_INTERFACE,
> +	  (WPADBusMethodHandler)
> wpas_dbus_handler_mesh_interface_add,
> +	  {
> +		  { "ifname", "s", ARG_IN },
> +		  END_ARGS
> +	  }
> +	},
> +#endif /* CONFIG_MESH */

Two things here:

1) should probably call it CreateMeshInterface since that's more
consistent with the existing CreateInterface.

2) it should follow the signature of CreateInterface, which means:
  a) it should just take an 'args' dictionary so that we can extend
this easily in the future without changing the API/ABI
  b) it should return the object path of the new mesh interface object
it just created, like CreateInterface.

Or, maybe we just add a "mesh"::boolean recognized property to the
existing CreateInterface call's args dictionary?  That's a lot less
work.

But a bigger question: how much changes with mesh?  Should it get its
own D-Bus namespace/interface like P2P has?  Will there be other mesh-
specific methods and properties, and if so how many?

Dan


 	{ NULL, NULL, NULL, { END_ARGS } }
>  };
>  
> diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c
> b/wpa_supplicant/dbus/dbus_new_handlers.c
> index 7446f8d..85a5001 100644
> --- a/wpa_supplicant/dbus/dbus_new_handlers.c
> +++ b/wpa_supplicant/dbus/dbus_new_handlers.c
> @@ -28,6 +28,7 @@
>  #include "dbus_dict_helpers.h"
>  #include "dbus_common_i.h"
>  #include "drivers/driver.h"
> +#include "../mesh.h"
>  
>  static const char * const debug_strings[] = {
>  	"excessive", "msgdump", "debug", "info", "warning", "error",
> NULL
> @@ -2098,6 +2099,33 @@ DBusMessage *
> wpas_dbus_handler_autoscan(DBusMessage *message,
>  #endif /* CONFIG_AUTOSCAN */
>  
>  
> +#ifdef CONFIG_MESH
> +/**
> + * wpas_dbus_handler_mesh_interface_add - Add Mesh Interface
> + * @message: Pointer to incoming dbus message
> + * @wpa_s: wpa_supplicant structure for a network interface
> + * Returns: NULL
> + *
> + * Handler function for "MeshInterfaceAdd" method call of network
> interface.
> + */
> +DBusMessage * wpas_dbus_handler_mesh_interface_add(DBusMessage
> *message,
> +					 struct wpa_supplicant
> *wpa_s)
> +{
> +	DBusMessage *reply = NULL;
> +	char *ifname;
> +
> +	dbus_message_get_args(message, NULL, DBUS_TYPE_STRING,
> &ifname,
> +			      DBUS_TYPE_INVALID);
> +
> +	if (wpas_mesh_add_interface(wpa_s, ifname, sizeof(ifname)) <
> 0)
> +		reply = dbus_message_new_error(message,
> +					       DBUS_ERROR_INVALID_AR
> GS,
> +					       NULL);
> +
> +	return reply;
> +}
> +#endif /* CONFIG_MESH */
> +
>  /*
>   * wpas_dbus_handler_eap_logoff - IEEE 802.1X EAPOL state machine
> logoff
>   * @message: Pointer to incoming dbus message
> diff --git a/wpa_supplicant/dbus/dbus_new_handlers.h
> b/wpa_supplicant/dbus/dbus_new_handlers.h
> index fe8767a..1bd46f9 100644
> --- a/wpa_supplicant/dbus/dbus_new_handlers.h
> +++ b/wpa_supplicant/dbus/dbus_new_handlers.h
> @@ -233,4 +233,7 @@ DBusMessage * wpas_dbus_handler_subscribe_preq(
>  DBusMessage * wpas_dbus_handler_unsubscribe_preq(
>  	DBusMessage *message, struct wpa_supplicant *wpa_s);
>  
> +DBusMessage * wpas_dbus_handler_mesh_interface_add(DBusMessage
> *message,
> +					 struct wpa_supplicant
> *wpa_s);
> +
>  #endif /* CTRL_IFACE_DBUS_HANDLERS_NEW_H */



More information about the Hostap mailing list