[PATCH 1/2] dbus: Add new method MeshInterfaceAdd to add mesh interface
Saurav Babu
saurav.babu at samsung.com
Mon Jan 9 21:51:45 PST 2017
Hello Dan,
>> 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.
MeshInterfaceAdd creates a virtual mesh interface over existing Wi-Fi
interface which would be used for mesh gate.
> 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.
Yes it should return object path of the new mesh interface object it just
created.
> Or, maybe we just add a "mesh"::boolean recognized property to the
> existing CreateInterface call's args dictionary? That's a lot less
> work.
I think I can add a "mesh"::boolean in CreateInterface call's args dictionary.
But as we need to create a virtual mesh interface over existing interface, I
need to pass "parent"::string also in args dictionary, parent here would be
existing interface over which virtual mesh interface would be created. Please
suggest if it is a good approach to also add parent in args dictionary?
> 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?
Currently I can't find many changes with mesh.
Thanks,
Saurav
> { 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