[RFC PATCH 8/8] iwd: Register the IWD settings plugin



Add the IWD plugin to the build and use nm_settings_add_plugin to add
its instance.  The plugin is built into the wifi plugin's binary because
with an independent binary it's difficult to cleanly listen to
NMIwdManager's signals and call its methods.  The meson configuration is
not in this patch.

Note the plugin is added as just another plugin in the list in the
NMSettings object, which means that for any operation it's tried along
with the other plugins until one succeeds.  Instead it would be better
if the plugin gets some sort of exclusivity on wireless connections so
that no other plugin can create duplicate connections for the ones
already added by this plugin.

The plugin is effectively registered whenever the IWD backend is enabled
for at least one device.  NM still allows IWD-managed devices to coexist
with wpa_supplicant devices.  The plugin makes no sense in those
situations because the IWD connections (specifically WPA-Enterprise)
can't be activated on wpa_supplicant devices and normal NM
WPA-Enterprise connections can't be activated on IWD-managed devices.
We are considering eventually allowing the IWD plugin to access IWD's
WPA-Enterprise network config files directly so that they can be
read/written/edited through the NM clients, without going through the
IWD DBus interface.
---
 Makefile.am                       |  6 +++++-
 src/devices/wifi/nm-iwd-manager.c | 11 +++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 79b046280..6fe8fb9a1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2757,7 +2757,11 @@ src_devices_wifi_libnm_device_plugin_wifi_la_SOURCES += \
        src/devices/wifi/nm-device-iwd.c \
        src/devices/wifi/nm-device-iwd.h \
        src/devices/wifi/nm-iwd-manager.c \
-       src/devices/wifi/nm-iwd-manager.h
+       src/devices/wifi/nm-iwd-manager.h \
+       src/settings/plugins/iwd/nms-iwd-connection.c \
+       src/settings/plugins/iwd/nms-iwd-connection.h \
+       src/settings/plugins/iwd/nms-iwd-plugin.c \
+       src/settings/plugins/iwd/nms-iwd-plugin.h
 endif
 
 src_devices_wifi_libnm_device_plugin_wifi_la_CPPFLAGS = \
diff --git a/src/devices/wifi/nm-iwd-manager.c b/src/devices/wifi/nm-iwd-manager.c
index d785c1100..bd508f151 100644
--- a/src/devices/wifi/nm-iwd-manager.c
+++ b/src/devices/wifi/nm-iwd-manager.c
@@ -30,6 +30,8 @@
 #include "nm-manager.h"
 #include "nm-device-iwd.h"
 #include "nm-utils/nm-random-utils.h"
+#include "settings/nm-settings.h"
+#include "settings/plugins/iwd/nms-iwd-plugin.h"
 
 /*****************************************************************************/
 
@@ -49,6 +51,7 @@ typedef struct {
        guint agent_id;
        gchar *agent_path;
        GSList *known_networks;
+       gboolean settings_added;
 } NMIwdManagerPrivate;
 
 struct _NMIwdManager {
@@ -589,6 +592,14 @@ got_object_manager (GObject *object, GAsyncResult *result, gpointer user_data)
 
                update_known_networks (self);
        }
+
+       if (!priv->settings_added) {
+               NMSIwdPlugin *settings = nms_iwd_plugin_get ();
+
+               nm_settings_add_plugin (NM_SETTINGS_GET, NM_SETTINGS_PLUGIN (settings));
+
+               priv->settings_added = TRUE;
+       }
 }
 
 static void
-- 
2.14.1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]