86 lines
3.1 KiB
Diff
86 lines
3.1 KiB
Diff
From f1207f311ec04aeda07759e04538d65d41d4ea4a Mon Sep 17 00:00:00 2001
|
|
Message-Id: <f1207f311ec04aeda07759e04538d65d41d4ea4a.1624465064.git.dcaratti@redhat.com>
|
|
From: dcaratti <davide.caratti@gmail.com>
|
|
Date: Wed, 23 Jun 2021 18:12:41 +0200
|
|
Subject: [PATCH] Allow empty values of "plugin_dir" in mptcpd.conf. (#145)
|
|
|
|
The plugin dirname is $(libdir)/mptcpd/ on standard configurations:
|
|
use this value in case the value of plugin_dir is empty in
|
|
/etc/mptcpd/mptcpd.conf.
|
|
---
|
|
src/Makefile.am | 3 ++-
|
|
src/configuration.c | 27 ++++++++++-----------------
|
|
2 files changed, 12 insertions(+), 18 deletions(-)
|
|
|
|
diff --git a/src/Makefile.am b/src/Makefile.am
|
|
index 09ca74c..4aa5037 100644
|
|
--- a/src/Makefile.am
|
|
+++ b/src/Makefile.am
|
|
@@ -31,7 +31,8 @@ libpath_manager_la_LIBADD = \
|
|
|
|
libpath_manager_la_CPPFLAGS = \
|
|
$(AM_CPPFLAGS) \
|
|
- -DMPTCPD_CONFIG_FILE='"$(sysconfdir)/@PACKAGE@/@PACKAGE@.conf"'
|
|
+ -DMPTCPD_CONFIG_FILE='"$(sysconfdir)/@PACKAGE@/@PACKAGE@.conf"' \
|
|
+ -DMPTCPD_DEFAULT_PLUGINDIR='"$(libdir)/@PACKAGE@"'
|
|
|
|
EXTRA_DIST = mptcp.service.in
|
|
|
|
diff --git a/src/configuration.c b/src/configuration.c
|
|
index 2a48405..70a8e19 100644
|
|
--- a/src/configuration.c
|
|
+++ b/src/configuration.c
|
|
@@ -304,8 +304,6 @@ static bool check_file_perms(char const *f)
|
|
static bool parse_config_file(struct mptcpd_config *config,
|
|
char const *filename)
|
|
{
|
|
- bool parsed = true;
|
|
-
|
|
assert(filename != NULL);
|
|
|
|
if (!check_file_perms(filename))
|
|
@@ -337,22 +335,17 @@ static bool parse_config_file(struct mptcpd_config *config,
|
|
group,
|
|
"plugin-dir");
|
|
|
|
- if (plugin_dir == NULL) {
|
|
- l_error("No plugin directory set in mptcpd "
|
|
- "configuration.");
|
|
+ set_plugin_dir(config,
|
|
+ plugin_dir ? plugin_dir :
|
|
+ l_strdup(MPTCPD_DEFAULT_PLUGINDIR));
|
|
|
|
- parsed = false;
|
|
- } else {
|
|
- set_plugin_dir(config, plugin_dir);
|
|
-
|
|
- // Default plugin name. Can be NULL.
|
|
- char *const default_plugin =
|
|
- l_settings_get_string(settings,
|
|
- group,
|
|
- "path-manager");
|
|
+ // Default plugin name. Can be NULL.
|
|
+ char *const default_plugin =
|
|
+ l_settings_get_string(settings,
|
|
+ group,
|
|
+ "path-manager");
|
|
|
|
- set_default_plugin(config, default_plugin);
|
|
- }
|
|
+ set_default_plugin(config, default_plugin);
|
|
} else {
|
|
l_debug("Unable to mptcpd load settings from file '%s'",
|
|
filename);
|
|
@@ -360,7 +353,7 @@ static bool parse_config_file(struct mptcpd_config *config,
|
|
|
|
l_settings_free(settings);
|
|
|
|
- return parsed;
|
|
+ return true;
|
|
}
|
|
|
|
/**
|
|
--
|
|
2.31.1
|
|
|