plugins: remove dependency on ELL plugins
PATCH 1/7 plugins: remove dependency on ELL plugins
There has been a desire to remove the ELL plugin dependency from IWD which is the only consumer of the plugin API. This removes the dependency and prepares the tree for converting the existing ofono and sim_hardcoded plugins into regular modules.
---
Makefile.am | 5 ++---
src/main.c | 16 ----------------
{plugins => src}/ofono.c | 0
{plugins => src}/sim_hardcoded.c | 0
4 files changed, 2 insertions(+), 19 deletions(-)
rename {plugins => src}/ofono.c (100%)
rename {plugins => src}/sim_hardcoded.c (100%)Makefile.am +2 -3
@@ -185,7 +185,6 @@ if DAEMON libexec_PROGRAMS += src/iwd src_iwd_SOURCES = src/main.c linux/nl80211.h src/iwd.h src/missing.h \ - src/plugin.h src/plugin.c \ src/netdev.h src/netdev.c \ src/wiphy.h src/wiphy.c \ src/device.c \
@@ -237,12 +236,12 @@ src_iwd_DEPENDENCIES = $(ell_dependencies) if SIM_HARDCODED builtin_modules += sim_hardcoded -builtin_sources += plugins/sim_hardcoded.c +builtin_sources += src/sim_hardcoded.c endif if OFONO builtin_modules += ofono -builtin_sources += plugins/ofono.c +builtin_sources += src/ofono.c endif if DBUS_POLICY
src/main.c +0 -16
@@ -40,7 +40,6 @@#include "src/eap.h" #include "src/eapol.h" #include "src/rfkill.h" -#include "src/plugin.h" #include "src/storage.h" #include "src/anqp.h"
@@ -54,8 +53,6 @@ static const char *interfaces;static const char *nointerfaces;static const char *phys;static const char *nophys; -static const char *plugins; -static const char *noplugins;static const char *debugopt;static bool terminating;static bool nl80211_complete;
@@ -140,8 +137,6 @@ static void usage(void)"\t-I, --nointerfaces Interfaces to ignore\n" "\t-p, --phys Phys to manage\n" "\t-P, --nophys Phys to ignore\n" -"\t-l, --plugin Plugins to include\n" -"\t-L, --noplugin Plugins to exclude\n" "\t-d, --debug Enable debug output\n" "\t-v, --version Show version\n" "\t-h, --help Show help options\n");
@@ -154,8 +149,6 @@ static const struct option main_options[] = { { "nointerfaces", required_argument, NULL, 'I' }, { "phys", required_argument, NULL, 'p' }, { "nophys", required_argument, NULL, 'P' }, - { "plugin", required_argument, NULL, 'l' }, - { "noplugin", required_argument, NULL, 'L' }, { "debug", optional_argument, NULL, 'd' }, { "help", no_argument, NULL, 'h' }, { }
@@ -179,8 +172,6 @@ static void nl80211_appeared(const struct l_genl_family_info *info,l_main_quit ();return ; } - -plugin_init (plugins, noplugins); } static void request_name_callback(struct l_dbus *dbus, bool success,
@@ -393,12 +384,6 @@ int main(int argc, char *argv[])case 'P' : nophys = optarg;break ; -case 'l' : - plugins = optarg; -break ; -case 'L' : - noplugins = optarg; -break ;case 'd' :if (optarg) debugopt = optarg;
@@ -504,7 +489,6 @@ int main(int argc, char *argv[]) exit_status =l_main_run_with_signal (signal_handler,NULL ); -plugin_exit ();iwd_modules_exit ();dbus_exit ();l_dbus_destroy (dbus);
src/ofono.c renamed from plugins/ofono.c +0 -0
src/sim_hardcoded.c renamed from plugins/sim_hardcoded.c +0 -0
Signature · 1 line
2.26.2
PATCH 2/7 test-runner: remove ofono/hardcoded IWD options
--- tools/test-runner | 3 --- 1 file changed, 3 deletions(-)
tools/test-runner +0 -3
@@ -607,7 +607,6 @@ class TestContext: return elif sim_keys != 'ofono': os.environ['IWD_SIM_KEYS'] = sim_keys - self.iwd_extra_options = '--plugin=sim_hardcoded' return if not find_binary(['ofonod']) or not find_binary(['phonesim']):
@@ -616,8 +615,6 @@ class TestContext: Process(['ifconfig', 'lo', 'up'], wait=True) - self.iwd_extra_options = '--plugin=ofono' - os.environ['OFONO_PHONESIM_CONFIG'] = '/tmp/phonesim.conf' phonesim_args = ['phonesim', '-p', '12345', '/usr/share/phonesim/default.xml']
Signature · 1 line
2.26.2
PATCH 3/7 ofono: convert to module
In reply to James PrestwoodThe only change (apart from IWD_MODULE) was to check main.conf for SimAuthBackend=ofono.
--- src/ofono.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
src/ofono.c +13 -4
@@ -30,11 +30,12 @@#include <errno.h> #include <ell/ell.h> -#include <ell/plugin.h> #include <ell/dbus.h> #include "src/dbus.h" #include "src/simauth.h" +#include "src/module.h" +#include "src/iwd.h" /* * This plugin takes care of all the communication with ofono in order to
@@ -765,7 +766,15 @@ static void ofono_disappeared(struct l_dbus *dbus, void *user_data)static int ofono_init (void ) { -struct l_dbus *dbus =dbus_get_bus (); +const struct l_settings *settings =iwd_get_config (); +struct l_dbus *dbus; + +const char *value =l_settings_get_value (settings,"General" , +"SimAuthBackend" ); +if (!value ||strcmp (value,"ofono" )) +return 0 ; + + dbus =dbus_get_bus (); ofono_watch =l_dbus_add_service_watch (dbus,"org.ofono" , ofono_found, ofono_disappeared,NULL ,NULL );
@@ -783,5 +792,5 @@ static void ofono_exit(void)l_dbus_remove_watch (dbus, ofono_watch); } -L_PLUGIN_DEFINE (__iwd_builtin_ofono, ofono,"oFono plugin" ,"1.0" , -L_PLUGIN_PRIORITY_DEFAULT , ofono_init, ofono_exit) +IWD_MODULE (ofono, ofono_init, ofono_exit); +IWD_MODULE_DEPENDS (ofono, simauth);
Signature · 1 line
2.26.2
PATCH 4/7 sim_hardcoded: convert to module
In reply to James PrestwoodThe only change (apart from IWD_MODULE) was to check main.conf
for SimAuthBackend=hardcoded.
--- src/sim_hardcoded.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
src/sim_hardcoded.c +13 -5
@@ -27,9 +27,10 @@#include <errno.h> #include <ell/ell.h> -#include <ell/plugin.h> #include "src/simauth.h" +#include "src/module.h" +#include "src/iwd.h" struct hardcoded_sim {char *identity;
@@ -263,7 +264,15 @@ static int sim_hardcoded_init(void)const char *str;size_t len;struct l_settings *key_settings; -const char *config_path =getenv ("IWD_SIM_KEYS" ); +const char *config_path; +const struct l_settings *settings =iwd_get_config (); + +const char *value =l_settings_get_value (settings,"General" , +"SimAuthBackend" ); +if (!value ||strcmp (value,"hardcoded" )) +return 0 ; + + config_path =getenv ("IWD_SIM_KEYS" );if (!config_path) {l_debug ("IWD_SIM_KEYS not set in env" );
@@ -394,6 +403,5 @@ static void sim_hardcoded_exit(void)l_free (sim); } -L_PLUGIN_DEFINE (__iwd_builtin_sim_hardcoded, sim_hardcoded, -"Hardcoded SIM driver" ,"1.0" ,L_PLUGIN_PRIORITY_DEFAULT , - sim_hardcoded_init, sim_hardcoded_exit) +IWD_MODULE (sim_hardcoded, sim_hardcoded_init, sim_hardcoded_exit); +IWD_MODULE_DEPENDS (sim_hardcoded, simauth);
Signature · 1 line
2.26.2
PATCH 5/7 plugin: remove plugin source
In reply to James Prestwood--- src/plugin.c | 97 ---------------------------------------------------- src/plugin.h | 24 ------------- 2 files changed, 121 deletions(-) delete mode 100644 src/plugin.c delete mode 100644 src/plugin.h
src/plugin.c deleted +0 -97
@@ -1,97 +0,0 @@ -/* -* -* Wireless daemon for Linux -* -* Copyright (C) 2017-2019 Intel Corporation. All rights reserved. -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public -* License as published by the Free Software Foundation; either -* version 2.1 of the License, or (at your option) any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library; if not, write to the Free Software -* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -* -*/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <fnmatch.h> - -#include <ell/ell.h> -#include <ell/plugin.h> - -#include "src/builtin.h" -#include "src/plugin.h" - -static bool check_plugin (struct l_plugin_desc *desc, -char **include,char **exclude) -{ -char *pattern; -unsigned int i; - -if (!include) - goto check_blacklist; - -for (i =0 ; (pattern = include[i]); i++) { -if (fnmatch (pattern, desc->name,0 ) !=0 ) -continue ; - - goto check_blacklist; - } - -l_debug ("whitelist filtered plugin: %s" , desc->name); -return false; - -check_blacklist: -if (!exclude) -return true; - -for (i =0 ; (pattern = exclude[i]); i++) { -if (fnmatch (pattern, desc->name,0 ) ==0 ) { -l_debug ("blacklist filtered plugin: %s" , desc->name); -return false; - } - } - -return true; -} - -int plugin_init (const char *include,const char *exclude) -{ -char **inc =NULL ; -char **exc =NULL ; -int i; - -if (include) - inc =l_strsplit_set (include,"," ); - -if (exclude) - exc =l_strsplit_set (exclude,"," ); - -for (i =0 ; __iwd_builtin[i]; i++) { -if (check_plugin (__iwd_builtin[i], inc, exc)) -l_plugin_add (__iwd_builtin[i], - __iwd_builtin[i]->version); - } - -l_plugin_load (NULL ,NULL ,NULL ); - -l_strfreev (inc); -l_strfreev (exc); - -return 1 ; -} - -void plugin_exit (void ) -{ -l_plugin_unload (); -}
src/plugin.h deleted +0 -24
@@ -1,24 +0,0 @@ -/* -* -* Wireless daemon for Linux -* -* Copyright (C) 2017-2019 Intel Corporation. All rights reserved. -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public -* License as published by the Free Software Foundation; either -* version 2.1 of the License, or (at your option) any later version. -* -* This library is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this library; if not, write to the Free Software -* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -* -*/ - -int plugin_init (const char *include,const char *exclude); -void plugin_exit (void );
Signature · 1 line
2.26.2
PATCH 6/7 doc: document SimAuthBackend option
In reply to James Prestwood--- src/iwd.config.rst | 8 ++++++++ 1 file changed, 8 insertions(+)
src/iwd.config.rst +8 -0
@@ -154,6 +154,14 @@ The group ``[General]`` contains general settings. off by default. If you want to easily utilize Hotspot 2.0 networks, then setting ``DisableANQP`` to ``false`` is recommended. + * - SimAuthBackend + - Values: ofono, hardcoded + + Enable the simauth backend. A value of 'ofono' enables communication with + the ofono daemon for use with EAP-SIM/EAP-AKA/EAP-AKA-prime. The + 'hardcoded' option is only used for testing. If this option is not + provided neither backend will be initialized. + Network ---------
Signature · 1 line
2.26.2
PATCH 7/7 auto-t: update AKA/SIM autotests SimAuthBackend
In reply to James Prestwood--- autotests/testEAP-AKA-ofono/main.conf | 2 ++ autotests/testEAP-AKA-prime-ofono/main.conf | 2 ++ autotests/testEAP-AKA-prime/main.conf | 2 ++ autotests/testEAP-AKA/main.conf | 2 ++ autotests/testEAP-PEAP-SIM/main.conf | 2 ++ autotests/testEAP-SIM-ofono/main.conf | 2 ++ autotests/testEAP-SIM/main.conf | 2 ++ 7 files changed, 14 insertions(+) create mode 100644 autotests/testEAP-AKA-ofono/main.conf create mode 100644 autotests/testEAP-AKA-prime-ofono/main.conf create mode 100644 autotests/testEAP-AKA-prime/main.conf create mode 100644 autotests/testEAP-AKA/main.conf create mode 100644 autotests/testEAP-PEAP-SIM/main.conf create mode 100644 autotests/testEAP-SIM-ofono/main.conf create mode 100644 autotests/testEAP-SIM/main.conf
autotests/testEAP-AKA-ofono/main.conf new file +2 -0
@@ -0,0 +1,2 @@ +[General] +SimAuthBackend=ofono
autotests/testEAP-AKA-prime-ofono/main.conf new file +2 -0
@@ -0,0 +1,2 @@ +[General] +SimAuthBackend=ofono
autotests/testEAP-AKA-prime/main.conf new file +2 -0
@@ -0,0 +1,2 @@ +[General] +SimAuthBackend=hardcoded
autotests/testEAP-AKA/main.conf new file +2 -0
@@ -0,0 +1,2 @@ +[General] +SimAuthBackend=hardcoded
autotests/testEAP-PEAP-SIM/main.conf new file +2 -0
@@ -0,0 +1,2 @@ +[General] +SimAuthBackend=hardcoded
autotests/testEAP-SIM-ofono/main.conf new file +2 -0
@@ -0,0 +1,2 @@ +[General] +SimAuthBackend=ofono
autotests/testEAP-SIM/main.conf new file +2 -0
@@ -0,0 +1,2 @@ +[General] +SimAuthBackend=hardcoded
Signature · 1 line
2.26.2