[PATCH 4/9] vpn: Use util conf.d to read additional configs
Jussi Laakkonen <[email protected]> Wed, 20 May 2026 16:47:08 +0300
| Newsgroups | dev.linux.lists.connman |
|---|---|
| Message-ID | <[email protected]> |
---
Makefile.am | 3 ++-
vpn/main.c | 10 ++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 88100968..85f70c8b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -181,7 +181,8 @@ vpn_connman_vpnd_SOURCES = $(builtin_vpn_sources) $(backtrace_sources) \
vpn/vpn-ipconfig.c src/inet.c vpn/vpn-rtnl.c \
src/dbus.c src/storage.c src/ipaddress.c src/agent.c \
vpn/vpn-agent.c vpn/vpn-agent.h src/inotify.c \
- vpn/vpn-config.c vpn/vpn-settings.c vpn/vpn-util.c
+ vpn/vpn-config.c vpn/vpn-settings.c vpn/vpn-util.c \
+ src/shared/util.c
vpn_connman_vpnd_LDADD = gdbus/libgdbus-internal.la $(builtin_vpn_libadd) \
@GIO_LIBS@ @GLIB_LIBS@ @DBUS_LIBS@ @GNUTLS_LIBS@ \
diff --git a/vpn/main.c b/vpn/main.c
index 1965c34b..a28cb0a2 100644
--- a/vpn/main.c
+++ b/vpn/main.c
@@ -42,8 +42,11 @@
#include "vpn.h"
#include "connman/vpn-dbus.h"
+#include "src/shared/util.h"
#define CONFIGMAINFILE CONFIGDIR "/connman-vpn.conf"
+#define CONFIGMAINDIR CONFIGMAINFILE ".d"
+#define CONFIGSUFFIX ".conf"
static GMainLoop *main_loop = NULL;
@@ -177,6 +180,7 @@ int main(int argc, char *argv[])
DBusConnection *conn;
DBusError err;
guint signal;
+ int conf_err;
context = g_option_context_new(NULL);
g_option_context_add_main_entries(context, options, NULL);
@@ -255,6 +259,12 @@ int main(int argc, char *argv[])
else
__vpn_settings_init(option_config, CONFIGDIR);
+ conf_err = util_read_config_files_from(CONFIGMAINDIR, CONFIGSUFFIX,
+ NULL, __vpn_settings_process_config);
+ if (conf_err && conf_err != -ENOTDIR)
+ connman_error("failed to read configs from %s: %s",
+ CONFIGMAINDIR, strerror(conf_err));
+
__connman_inotify_init();
__connman_agent_init();
__vpn_provider_init();
--
2.47.3