mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-09 03:38:09 +02:00
config: merge branch 'th/config-rh1397938'
https://bugzilla.redhat.com/show_bug.cgi?id=1397938
This commit is contained in:
commit
9fce5ae0eb
18 changed files with 162 additions and 153 deletions
24
configure.ac
24
configure.ac
|
|
@ -134,7 +134,7 @@ test "$enable_ifupdown" = "yes" && distro_plugins="$distro_plugins,ifu
|
||||||
test "$enable_ifnet" = "yes" && distro_plugins="$distro_plugins,ifnet"
|
test "$enable_ifnet" = "yes" && distro_plugins="$distro_plugins,ifnet"
|
||||||
distro_plugins="${distro_plugins#,}"
|
distro_plugins="${distro_plugins#,}"
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED(NM_CONFIG_PLUGINS_DEFAULT, "$config_plugins_default", [Default configuration option for main.plugins setting])
|
AC_DEFINE_UNQUOTED(NM_CONFIG_DEFAULT_MAIN_PLUGINS, "$config_plugins_default", [Default configuration option for main.plugins setting])
|
||||||
if test "${enable_config_plugin_ibft}" = yes; then
|
if test "${enable_config_plugin_ibft}" = yes; then
|
||||||
AC_DEFINE(WITH_SETTINGS_PLUGIN_IBFT, 1, [Whether compilation of ibft setting plugin is enabled])
|
AC_DEFINE(WITH_SETTINGS_PLUGIN_IBFT, 1, [Whether compilation of ibft setting plugin is enabled])
|
||||||
else
|
else
|
||||||
|
|
@ -417,9 +417,9 @@ if test "$nm_config_logging_backend_default" = ""; then
|
||||||
nm_config_logging_backend_default='syslog'
|
nm_config_logging_backend_default='syslog'
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
AC_DEFINE_UNQUOTED(NM_CONFIG_LOGGING_BACKEND_DEFAULT, "$nm_config_logging_backend_default", [Default configuration option for logging.backend])
|
AC_DEFINE_UNQUOTED(NM_CONFIG_DEFAULT_LOGGING_BACKEND, "$nm_config_logging_backend_default", [Default configuration option for logging.backend])
|
||||||
NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT="$nm_config_logging_backend_default"
|
NM_CONFIG_DEFAULT_LOGGING_BACKEND_TEXT="$nm_config_logging_backend_default"
|
||||||
AC_SUBST(NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT)
|
AC_SUBST(NM_CONFIG_DEFAULT_LOGGING_BACKEND_TEXT)
|
||||||
|
|
||||||
# Session tracking support
|
# Session tracking support
|
||||||
AC_ARG_WITH(systemd-logind, AS_HELP_STRING([--with-systemd-logind=yes|no],
|
AC_ARG_WITH(systemd-logind, AS_HELP_STRING([--with-systemd-logind=yes|no],
|
||||||
|
|
@ -579,11 +579,11 @@ AC_ARG_ENABLE(polkit, AS_HELP_STRING([--enable-polkit=yes|no|disabled], [set def
|
||||||
[enable_polkit=${enableval}], [enable_polkit=yes])
|
[enable_polkit=${enableval}], [enable_polkit=yes])
|
||||||
if (test "${enable_polkit}" != "no" -a "${enable_polkit}" != "disabled"); then
|
if (test "${enable_polkit}" != "no" -a "${enable_polkit}" != "disabled"); then
|
||||||
enable_polkit=yes
|
enable_polkit=yes
|
||||||
AC_DEFINE(NM_CONFIG_DEFAULT_AUTH_POLKIT, "true", [The default value of the auth-polkit configuration option])
|
AC_DEFINE(NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT, "true", [The default value of the auth-polkit configuration option])
|
||||||
AC_SUBST(NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT, true)
|
AC_SUBST(NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT_TEXT, true)
|
||||||
else
|
else
|
||||||
AC_DEFINE(NM_CONFIG_DEFAULT_AUTH_POLKIT, "false", [The default value of the auth-polkit configuration option])
|
AC_DEFINE(NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT, "false", [The default value of the auth-polkit configuration option])
|
||||||
AC_SUBST(NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT, false)
|
AC_SUBST(NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT_TEXT, false)
|
||||||
fi
|
fi
|
||||||
if (test "${enable_polkit}" != "disabled"); then
|
if (test "${enable_polkit}" != "disabled"); then
|
||||||
AC_DEFINE(WITH_POLKIT, 1, [whether to compile polkit support])
|
AC_DEFINE(WITH_POLKIT, 1, [whether to compile polkit support])
|
||||||
|
|
@ -815,8 +815,8 @@ fi
|
||||||
test -z "$config_dhcp_default" -a "$with_dhclient" != "no" && config_dhcp_default='dhclient'
|
test -z "$config_dhcp_default" -a "$with_dhclient" != "no" && config_dhcp_default='dhclient'
|
||||||
test -z "$config_dhcp_default" -a "$with_dhcpcd" != "no" && config_dhcp_default='dhcpcd'
|
test -z "$config_dhcp_default" -a "$with_dhcpcd" != "no" && config_dhcp_default='dhcpcd'
|
||||||
test -z "$config_dhcp_default" && config_dhcp_default='internal'
|
test -z "$config_dhcp_default" && config_dhcp_default='internal'
|
||||||
AC_DEFINE_UNQUOTED(NM_CONFIG_DEFAULT_DHCP, "$config_dhcp_default", [Default configuration option for main.dhcp setting])
|
AC_DEFINE_UNQUOTED(NM_CONFIG_DEFAULT_MAIN_DHCP, "$config_dhcp_default", [Default configuration option for main.dhcp setting])
|
||||||
AC_SUBST(NM_CONFIG_DEFAULT_DHCP, $config_dhcp_default)
|
AC_SUBST(NM_CONFIG_DEFAULT_MAIN_DHCP, $config_dhcp_default)
|
||||||
|
|
||||||
# resolvconf and netconfig support
|
# resolvconf and netconfig support
|
||||||
AC_ARG_WITH(resolvconf, AS_HELP_STRING([--with-resolvconf=yes|no|path], [Enable resolvconf support]))
|
AC_ARG_WITH(resolvconf, AS_HELP_STRING([--with-resolvconf=yes|no|path], [Enable resolvconf support]))
|
||||||
|
|
@ -856,8 +856,8 @@ fi
|
||||||
if test "$with_netconfig" != "no"; then
|
if test "$with_netconfig" != "no"; then
|
||||||
AC_DEFINE_UNQUOTED(NETCONFIG_PATH, "$with_netconfig", [Path to netconfig])
|
AC_DEFINE_UNQUOTED(NETCONFIG_PATH, "$with_netconfig", [Path to netconfig])
|
||||||
fi
|
fi
|
||||||
AC_DEFINE_UNQUOTED(NM_CONFIG_DEFAULT_DNS_RC_MANAGER, "$config_dns_rc_manager_default", [Default value for main.rc-manager setting (--with-config-dns-rc-manager-default)])
|
AC_DEFINE_UNQUOTED(NM_CONFIG_DEFAULT_MAIN_RC_MANAGER, "$config_dns_rc_manager_default", [Default value for main.rc-manager setting (--with-config-dns-rc-manager-default)])
|
||||||
AC_SUBST(NM_CONFIG_DEFAULT_DNS_RC_MANAGER, $config_dns_rc_manager_default)
|
AC_SUBST(NM_CONFIG_DEFAULT_MAIN_RC_MANAGER, $config_dns_rc_manager_default)
|
||||||
|
|
||||||
# iptables path
|
# iptables path
|
||||||
AC_ARG_WITH(iptables, AS_HELP_STRING([--with-iptables=/path/to/iptables], [path to iptables]))
|
AC_ARG_WITH(iptables, AS_HELP_STRING([--with-iptables=/path/to/iptables], [path to iptables]))
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,7 @@ plugins-=remove-me
|
||||||
<listitem><para>Whether the system uses PolicyKit for authorization.
|
<listitem><para>Whether the system uses PolicyKit for authorization.
|
||||||
If <literal>false</literal>, all requests will be allowed. If
|
If <literal>false</literal>, all requests will be allowed. If
|
||||||
<literal>true</literal>, non-root requests are authorized using PolicyKit.
|
<literal>true</literal>, non-root requests are authorized using PolicyKit.
|
||||||
The default value is <literal>&NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT;</literal>.
|
The default value is <literal>&NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT_TEXT;</literal>.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
|
@ -189,7 +189,7 @@ plugins-=remove-me
|
||||||
clients to be installed. The <literal>internal</literal>
|
clients to be installed. The <literal>internal</literal>
|
||||||
option uses a built-in DHCP client which is not currently as
|
option uses a built-in DHCP client which is not currently as
|
||||||
featureful as the external clients.</para>
|
featureful as the external clients.</para>
|
||||||
<para>If this key is missing, it defaults to <literal>&NM_CONFIG_DEFAULT_DHCP;</literal>.
|
<para>If this key is missing, it defaults to <literal>&NM_CONFIG_DEFAULT_MAIN_DHCP;</literal>.
|
||||||
It the chosen plugin is not available, clients are looked for
|
It the chosen plugin is not available, clients are looked for
|
||||||
in this order: <literal>dhclient</literal>, <literal>dhcpcd</literal>,
|
in this order: <literal>dhclient</literal>, <literal>dhcpcd</literal>,
|
||||||
<literal>internal</literal>.</para></listitem>
|
<literal>internal</literal>.</para></listitem>
|
||||||
|
|
@ -319,7 +319,7 @@ no-auto-default=*
|
||||||
<listitem><para>Set the <filename>resolv.conf</filename>
|
<listitem><para>Set the <filename>resolv.conf</filename>
|
||||||
management mode. The default value depends on NetworkManager build
|
management mode. The default value depends on NetworkManager build
|
||||||
options, and this version of NetworkManager was build with a default of
|
options, and this version of NetworkManager was build with a default of
|
||||||
"<literal>&NM_CONFIG_DEFAULT_DNS_RC_MANAGER;</literal>".
|
"<literal>&NM_CONFIG_DEFAULT_MAIN_RC_MANAGER;</literal>".
|
||||||
Regardless of this setting, NetworkManager will
|
Regardless of this setting, NetworkManager will
|
||||||
always write resolv.conf to its runtime state directory.</para>
|
always write resolv.conf to its runtime state directory.</para>
|
||||||
<para><literal>symlink</literal>: NetworkManager will symlink
|
<para><literal>symlink</literal>: NetworkManager will symlink
|
||||||
|
|
@ -558,7 +558,7 @@ unmanaged-devices=mac:00:22:68:1c:59:b1;mac:00:1E:65:30:D1:C4;interface-name:eth
|
||||||
"<literal>debug</literal>" uses syslog and logs to standard error.
|
"<literal>debug</literal>" uses syslog and logs to standard error.
|
||||||
If NetworkManager is started in debug mode (<literal>--debug</literal>)
|
If NetworkManager is started in debug mode (<literal>--debug</literal>)
|
||||||
this option is ignored and "<literal>debug</literal>" is always used.
|
this option is ignored and "<literal>debug</literal>" is always used.
|
||||||
Otherwise, the default is "<literal>&NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT;</literal>".
|
Otherwise, the default is "<literal>&NM_CONFIG_DEFAULT_LOGGING_BACKEND_TEXT;</literal>".
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<!ENTITY NM_VERSION "@NM_VERSION@">
|
<!ENTITY NM_VERSION "@NM_VERSION@">
|
||||||
<!ENTITY sysconfdir "@sysconfdir@">
|
<!ENTITY sysconfdir "@sysconfdir@">
|
||||||
<!ENTITY NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT "@NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@">
|
<!ENTITY NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT_TEXT "@NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT_TEXT@">
|
||||||
<!ENTITY NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT "@NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@">
|
<!ENTITY NM_CONFIG_DEFAULT_LOGGING_BACKEND_TEXT "@NM_CONFIG_DEFAULT_LOGGING_BACKEND_TEXT@">
|
||||||
<!ENTITY NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT "@NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@">
|
<!ENTITY NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT "@NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@">
|
||||||
<!ENTITY NM_CONFIG_DEFAULT_DNS_RC_MANAGER "@NM_CONFIG_DEFAULT_DNS_RC_MANAGER@">
|
<!ENTITY NM_CONFIG_DEFAULT_MAIN_RC_MANAGER "@NM_CONFIG_DEFAULT_MAIN_RC_MANAGER@">
|
||||||
<!ENTITY NM_CONFIG_DEFAULT_DHCP "@NM_CONFIG_DEFAULT_DHCP@">
|
<!ENTITY NM_CONFIG_DEFAULT_MAIN_DHCP "@NM_CONFIG_DEFAULT_MAIN_DHCP@">
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ global:
|
||||||
nm_config_get;
|
nm_config_get;
|
||||||
nm_config_get_data;
|
nm_config_get_data;
|
||||||
nm_config_get_data_orig;
|
nm_config_get_data_orig;
|
||||||
nm_config_get_dhcp_client;
|
|
||||||
nm_config_get_monitor_connection_files;
|
nm_config_get_monitor_connection_files;
|
||||||
nm_connection_add_setting;
|
nm_connection_add_setting;
|
||||||
nm_connection_compare;
|
nm_connection_compare;
|
||||||
|
|
@ -127,6 +126,8 @@ global:
|
||||||
nm_device_state_changed;
|
nm_device_state_changed;
|
||||||
nm_device_take_down;
|
nm_device_take_down;
|
||||||
nm_device_uses_assumed_connection;
|
nm_device_uses_assumed_connection;
|
||||||
|
nm_dhcp_manager_get;
|
||||||
|
nm_dhcp_manager_get_config;
|
||||||
nm_ethernet_address_is_valid;
|
nm_ethernet_address_is_valid;
|
||||||
nm_exported_object_class_add_interface;
|
nm_exported_object_class_add_interface;
|
||||||
nm_exported_object_export;
|
nm_exported_object_export;
|
||||||
|
|
|
||||||
|
|
@ -322,6 +322,17 @@ nm_dhcp_manager_get_lease_ip_configs (NMDhcpManager *self,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
nm_dhcp_manager_get_config (NMDhcpManager *self)
|
||||||
|
{
|
||||||
|
const NMDhcpClientFactory *factory;
|
||||||
|
|
||||||
|
g_return_val_if_fail (NM_IS_DHCP_MANAGER (self), NULL);
|
||||||
|
|
||||||
|
factory = NM_DHCP_MANAGER_GET_PRIVATE (self)->client_factory;
|
||||||
|
return factory ? factory->name : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
NM_DEFINE_SINGLETON_GETTER (NMDhcpManager, nm_dhcp_manager_get, NM_TYPE_DHCP_MANAGER);
|
NM_DEFINE_SINGLETON_GETTER (NMDhcpManager, nm_dhcp_manager_get, NM_TYPE_DHCP_MANAGER);
|
||||||
|
|
@ -331,6 +342,7 @@ nm_dhcp_manager_init (NMDhcpManager *self)
|
||||||
{
|
{
|
||||||
NMDhcpManagerPrivate *priv = NM_DHCP_MANAGER_GET_PRIVATE (self);
|
NMDhcpManagerPrivate *priv = NM_DHCP_MANAGER_GET_PRIVATE (self);
|
||||||
NMConfig *config = nm_config_get ();
|
NMConfig *config = nm_config_get ();
|
||||||
|
gs_free char *client_free = NULL;
|
||||||
const char *client;
|
const char *client;
|
||||||
int i;
|
int i;
|
||||||
const NMDhcpClientFactory *client_factory = NULL;
|
const NMDhcpClientFactory *client_factory = NULL;
|
||||||
|
|
@ -347,7 +359,11 @@ nm_dhcp_manager_init (NMDhcpManager *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Client-specific setup */
|
/* Client-specific setup */
|
||||||
client = nm_config_get_dhcp_client (config);
|
client_free = nm_config_data_get_value (nm_config_get_data_orig (config),
|
||||||
|
NM_CONFIG_KEYFILE_GROUP_MAIN,
|
||||||
|
NM_CONFIG_KEYFILE_KEY_MAIN_DHCP,
|
||||||
|
NM_CONFIG_GET_VALUE_STRIP | NM_CONFIG_GET_VALUE_NO_EMPTY);
|
||||||
|
client = client_free;
|
||||||
if (nm_config_get_configure_and_quit (config)) {
|
if (nm_config_get_configure_and_quit (config)) {
|
||||||
client_factory = &_nm_dhcp_client_factory_internal;
|
client_factory = &_nm_dhcp_client_factory_internal;
|
||||||
if (client && !nm_streq (client, client_factory->name))
|
if (client && !nm_streq (client, client_factory->name))
|
||||||
|
|
@ -359,13 +375,13 @@ nm_dhcp_manager_init (NMDhcpManager *self)
|
||||||
nm_log_warn (LOGD_DHCP, "dhcp-init: DHCP client '%s' not available", client);
|
nm_log_warn (LOGD_DHCP, "dhcp-init: DHCP client '%s' not available", client);
|
||||||
}
|
}
|
||||||
if (!client_factory) {
|
if (!client_factory) {
|
||||||
client_factory = _client_factory_find_by_name (""NM_CONFIG_DEFAULT_DHCP);
|
client_factory = _client_factory_find_by_name (""NM_CONFIG_DEFAULT_MAIN_DHCP);
|
||||||
if (!client_factory)
|
if (!client_factory)
|
||||||
nm_log_err (LOGD_DHCP, "dhcp-init: default DHCP client '%s' is not installed", NM_CONFIG_DEFAULT_DHCP);
|
nm_log_err (LOGD_DHCP, "dhcp-init: default DHCP client '%s' is not installed", NM_CONFIG_DEFAULT_MAIN_DHCP);
|
||||||
else {
|
else {
|
||||||
client_factory = _client_factory_available (client_factory);
|
client_factory = _client_factory_available (client_factory);
|
||||||
if (!client_factory)
|
if (!client_factory)
|
||||||
nm_log_info (LOGD_DHCP, "dhcp-init: default DHCP client '%s' is not available", NM_CONFIG_DEFAULT_DHCP);
|
nm_log_info (LOGD_DHCP, "dhcp-init: default DHCP client '%s' is not available", NM_CONFIG_DEFAULT_MAIN_DHCP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!client_factory) {
|
if (!client_factory) {
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,8 @@ GType nm_dhcp_manager_get_type (void);
|
||||||
|
|
||||||
NMDhcpManager *nm_dhcp_manager_get (void);
|
NMDhcpManager *nm_dhcp_manager_get (void);
|
||||||
|
|
||||||
|
const char *nm_dhcp_manager_get_config (NMDhcpManager *self);
|
||||||
|
|
||||||
void nm_dhcp_manager_set_default_hostname (NMDhcpManager *manager,
|
void nm_dhcp_manager_set_default_hostname (NMDhcpManager *manager,
|
||||||
const char *hostname);
|
const char *hostname);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1655,9 +1655,9 @@ again:
|
||||||
if (rc_manager == NM_DNS_MANAGER_RESOLV_CONF_MAN_UNKNOWN) {
|
if (rc_manager == NM_DNS_MANAGER_RESOLV_CONF_MAN_UNKNOWN) {
|
||||||
if (man) {
|
if (man) {
|
||||||
_LOGW ("init: unknown resolv.conf manager \"%s\", fallback to \"%s\"",
|
_LOGW ("init: unknown resolv.conf manager \"%s\", fallback to \"%s\"",
|
||||||
man, ""NM_CONFIG_DEFAULT_DNS_RC_MANAGER);
|
man, ""NM_CONFIG_DEFAULT_MAIN_RC_MANAGER);
|
||||||
}
|
}
|
||||||
man = ""NM_CONFIG_DEFAULT_DNS_RC_MANAGER;
|
man = ""NM_CONFIG_DEFAULT_MAIN_RC_MANAGER;
|
||||||
rc_manager = NM_DNS_MANAGER_RESOLV_CONF_MAN_SYMLINK;
|
rc_manager = NM_DNS_MANAGER_RESOLV_CONF_MAN_SYMLINK;
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
15
src/main.c
15
src/main.c
|
|
@ -85,7 +85,7 @@ _set_g_fatal_warnings (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_init_nm_debug (const char *debug)
|
_init_nm_debug (NMConfig *config)
|
||||||
{
|
{
|
||||||
const guint D_RLIMIT_CORE = 1;
|
const guint D_RLIMIT_CORE = 1;
|
||||||
const guint D_FATAL_WARNINGS = 2;
|
const guint D_FATAL_WARNINGS = 2;
|
||||||
|
|
@ -95,6 +95,12 @@ _init_nm_debug (const char *debug)
|
||||||
};
|
};
|
||||||
guint flags;
|
guint flags;
|
||||||
const char *env = getenv ("NM_DEBUG");
|
const char *env = getenv ("NM_DEBUG");
|
||||||
|
gs_free char *debug;
|
||||||
|
|
||||||
|
debug = nm_config_data_get_value (nm_config_get_data_orig (config),
|
||||||
|
NM_CONFIG_KEYFILE_GROUP_MAIN,
|
||||||
|
NM_CONFIG_KEYFILE_KEY_MAIN_DEBUG,
|
||||||
|
NM_MANAGER_RELOAD_FLAGS_NONE);
|
||||||
|
|
||||||
flags = nm_utils_parse_debug_string (env, keys, G_N_ELEMENTS (keys));
|
flags = nm_utils_parse_debug_string (env, keys, G_N_ELEMENTS (keys));
|
||||||
flags |= nm_utils_parse_debug_string (debug, keys, G_N_ELEMENTS (keys));
|
flags |= nm_utils_parse_debug_string (debug, keys, G_N_ELEMENTS (keys));
|
||||||
|
|
@ -302,7 +308,7 @@ main (int argc, char *argv[])
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
_init_nm_debug (nm_config_get_debug (config));
|
_init_nm_debug (config);
|
||||||
|
|
||||||
/* Initialize logging from config file *only* if not explicitly
|
/* Initialize logging from config file *only* if not explicitly
|
||||||
* specified by commandline.
|
* specified by commandline.
|
||||||
|
|
@ -362,7 +368,10 @@ main (int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
nm_auth_manager_setup (nm_config_get_auth_polkit (config));
|
nm_auth_manager_setup (nm_config_data_get_value_boolean (nm_config_get_data_orig (config),
|
||||||
|
NM_CONFIG_KEYFILE_GROUP_MAIN,
|
||||||
|
NM_CONFIG_KEYFILE_KEY_MAIN_AUTH_POLKIT,
|
||||||
|
NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT_BOOL));
|
||||||
|
|
||||||
nm_manager_setup ();
|
nm_manager_setup ();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -217,6 +217,27 @@ nm_config_data_get_value_boolean (const NMConfigData *self, const char *group, c
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char **
|
||||||
|
nm_config_data_get_plugins (const NMConfigData *self, gboolean allow_default)
|
||||||
|
{
|
||||||
|
const NMConfigDataPrivate *priv;
|
||||||
|
char **list;
|
||||||
|
|
||||||
|
g_return_val_if_fail (self, NULL);
|
||||||
|
|
||||||
|
priv = NM_CONFIG_DATA_GET_PRIVATE (self);
|
||||||
|
|
||||||
|
list = g_key_file_get_string_list (priv->keyfile, NM_CONFIG_KEYFILE_GROUP_MAIN, "plugins", NULL, NULL);
|
||||||
|
if (!list && allow_default) {
|
||||||
|
gs_unref_keyfile GKeyFile *kf = nm_config_create_keyfile ();
|
||||||
|
|
||||||
|
/* let keyfile split the default string according to it's own escaping rules. */
|
||||||
|
g_key_file_set_value (kf, NM_CONFIG_KEYFILE_GROUP_MAIN, "plugins", NM_CONFIG_DEFAULT_MAIN_PLUGINS);
|
||||||
|
list = g_key_file_get_string_list (kf, NM_CONFIG_KEYFILE_GROUP_MAIN, "plugins", NULL, NULL);
|
||||||
|
}
|
||||||
|
return _nm_utils_strv_cleanup (list, TRUE, TRUE, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
nm_config_data_get_connectivity_uri (const NMConfigData *self)
|
nm_config_data_get_connectivity_uri (const NMConfigData *self)
|
||||||
{
|
{
|
||||||
|
|
@ -545,12 +566,12 @@ static struct {
|
||||||
const char *key;
|
const char *key;
|
||||||
const char *value;
|
const char *value;
|
||||||
} default_values[] = {
|
} default_values[] = {
|
||||||
{ NM_CONFIG_KEYFILE_GROUP_MAIN, "plugins", NM_CONFIG_PLUGINS_DEFAULT },
|
{ NM_CONFIG_KEYFILE_GROUP_MAIN, "plugins", NM_CONFIG_DEFAULT_MAIN_PLUGINS },
|
||||||
{ NM_CONFIG_KEYFILE_GROUP_MAIN, "rc-manager", NM_CONFIG_DEFAULT_DNS_RC_MANAGER },
|
{ NM_CONFIG_KEYFILE_GROUP_MAIN, "rc-manager", NM_CONFIG_DEFAULT_MAIN_RC_MANAGER },
|
||||||
{ NM_CONFIG_KEYFILE_GROUP_MAIN, "auth-polkit", NM_CONFIG_DEFAULT_AUTH_POLKIT },
|
{ NM_CONFIG_KEYFILE_GROUP_MAIN, NM_CONFIG_KEYFILE_KEY_MAIN_AUTH_POLKIT, NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT },
|
||||||
{ NM_CONFIG_KEYFILE_GROUP_MAIN, "dhcp", NM_CONFIG_DEFAULT_DHCP },
|
{ NM_CONFIG_KEYFILE_GROUP_MAIN, NM_CONFIG_KEYFILE_KEY_MAIN_DHCP, NM_CONFIG_DEFAULT_MAIN_DHCP },
|
||||||
{ NM_CONFIG_KEYFILE_GROUP_LOGGING, "backend", NM_CONFIG_LOGGING_BACKEND_DEFAULT },
|
{ NM_CONFIG_KEYFILE_GROUP_LOGGING, "backend", NM_CONFIG_DEFAULT_LOGGING_BACKEND },
|
||||||
{ NM_CONFIG_KEYFILE_GROUP_LOGGING, "audit", NM_CONFIG_DEFAULT_LOGGING_AUDIT },
|
{ NM_CONFIG_KEYFILE_GROUP_LOGGING, "audit", NM_CONFIG_DEFAULT_LOGGING_AUDIT },
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,7 @@ char *nm_config_data_get_value (const NMConfigData *config_data, const char *gro
|
||||||
const char *nm_config_data_get_value_cached (const NMConfigData *config_data, const char *group, const char *key, NMConfigGetValueFlags flags);
|
const char *nm_config_data_get_value_cached (const NMConfigData *config_data, const char *group, const char *key, NMConfigGetValueFlags flags);
|
||||||
gint nm_config_data_get_value_boolean (const NMConfigData *self, const char *group, const char *key, gint default_value);
|
gint nm_config_data_get_value_boolean (const NMConfigData *self, const char *group, const char *key, gint default_value);
|
||||||
|
|
||||||
|
char **nm_config_data_get_plugins (const NMConfigData *config_data, gboolean allow_default);
|
||||||
const char *nm_config_data_get_connectivity_uri (const NMConfigData *config_data);
|
const char *nm_config_data_get_connectivity_uri (const NMConfigData *config_data);
|
||||||
const guint nm_config_data_get_connectivity_interval (const NMConfigData *config_data);
|
const guint nm_config_data_get_connectivity_interval (const NMConfigData *config_data);
|
||||||
const char *nm_config_data_get_connectivity_response (const NMConfigData *config_data);
|
const char *nm_config_data_get_connectivity_response (const NMConfigData *config_data);
|
||||||
|
|
|
||||||
|
|
@ -91,16 +91,11 @@ typedef struct {
|
||||||
char *no_auto_default_file;
|
char *no_auto_default_file;
|
||||||
char *intern_config_file;
|
char *intern_config_file;
|
||||||
|
|
||||||
char **plugins;
|
|
||||||
gboolean monitor_connection_files;
|
gboolean monitor_connection_files;
|
||||||
gboolean auth_polkit;
|
|
||||||
char *dhcp_client;
|
|
||||||
|
|
||||||
char *log_level;
|
char *log_level;
|
||||||
char *log_domains;
|
char *log_domains;
|
||||||
|
|
||||||
char *debug;
|
|
||||||
|
|
||||||
gboolean configure_and_quit;
|
gboolean configure_and_quit;
|
||||||
|
|
||||||
char **atomic_section_prefixes;
|
char **atomic_section_prefixes;
|
||||||
|
|
@ -260,14 +255,6 @@ nm_config_get_data_orig (NMConfig *config)
|
||||||
return NM_CONFIG_GET_PRIVATE (config)->config_data_orig;
|
return NM_CONFIG_GET_PRIVATE (config)->config_data_orig;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char **
|
|
||||||
nm_config_get_plugins (NMConfig *config)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (config != NULL, NULL);
|
|
||||||
|
|
||||||
return (const char **) NM_CONFIG_GET_PRIVATE (config)->plugins;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
nm_config_get_monitor_connection_files (NMConfig *config)
|
nm_config_get_monitor_connection_files (NMConfig *config)
|
||||||
{
|
{
|
||||||
|
|
@ -276,22 +263,6 @@ nm_config_get_monitor_connection_files (NMConfig *config)
|
||||||
return NM_CONFIG_GET_PRIVATE (config)->monitor_connection_files;
|
return NM_CONFIG_GET_PRIVATE (config)->monitor_connection_files;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
|
||||||
nm_config_get_auth_polkit (NMConfig *config)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_CONFIG (config), NM_CONFIG_DEFAULT_AUTH_POLKIT_BOOL);
|
|
||||||
|
|
||||||
return NM_CONFIG_GET_PRIVATE (config)->auth_polkit;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *
|
|
||||||
nm_config_get_dhcp_client (NMConfig *config)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (config != NULL, NULL);
|
|
||||||
|
|
||||||
return NM_CONFIG_GET_PRIVATE (config)->dhcp_client;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
nm_config_get_log_level (NMConfig *config)
|
nm_config_get_log_level (NMConfig *config)
|
||||||
{
|
{
|
||||||
|
|
@ -308,14 +279,6 @@ nm_config_get_log_domains (NMConfig *config)
|
||||||
return NM_CONFIG_GET_PRIVATE (config)->log_domains;
|
return NM_CONFIG_GET_PRIVATE (config)->log_domains;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
|
||||||
nm_config_get_debug (NMConfig *config)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (config != NULL, NULL);
|
|
||||||
|
|
||||||
return NM_CONFIG_GET_PRIVATE (config)->debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
nm_config_get_configure_and_quit (NMConfig *config)
|
nm_config_get_configure_and_quit (NMConfig *config)
|
||||||
{
|
{
|
||||||
|
|
@ -506,7 +469,7 @@ nm_config_cmd_line_options_add_to_entries (NMConfigCmdLineOptions *cli,
|
||||||
{ "intern-config", 0, 0, G_OPTION_ARG_FILENAME, &cli->intern_config_file, N_("Internal config file location"), N_(DEFAULT_INTERN_CONFIG_FILE) },
|
{ "intern-config", 0, 0, G_OPTION_ARG_FILENAME, &cli->intern_config_file, N_("Internal config file location"), N_(DEFAULT_INTERN_CONFIG_FILE) },
|
||||||
{ "state-file", 0, 0, G_OPTION_ARG_FILENAME, &cli->state_file, N_("State file location"), N_(DEFAULT_STATE_FILE) },
|
{ "state-file", 0, 0, G_OPTION_ARG_FILENAME, &cli->state_file, N_("State file location"), N_(DEFAULT_STATE_FILE) },
|
||||||
{ "no-auto-default", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_FILENAME, &cli->no_auto_default_file, N_("State file for no-auto-default devices"), N_(DEFAULT_NO_AUTO_DEFAULT_FILE) },
|
{ "no-auto-default", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_FILENAME, &cli->no_auto_default_file, N_("State file for no-auto-default devices"), N_(DEFAULT_NO_AUTO_DEFAULT_FILE) },
|
||||||
{ "plugins", 0, 0, G_OPTION_ARG_STRING, &cli->plugins, N_("List of plugins separated by ','"), N_(NM_CONFIG_PLUGINS_DEFAULT) },
|
{ "plugins", 0, 0, G_OPTION_ARG_STRING, &cli->plugins, N_("List of plugins separated by ','"), N_(NM_CONFIG_DEFAULT_MAIN_PLUGINS) },
|
||||||
{ "configure-and-quit", 0, 0, G_OPTION_ARG_NONE, &cli->configure_and_quit, N_("Quit after initial configuration"), NULL },
|
{ "configure-and-quit", 0, 0, G_OPTION_ARG_NONE, &cli->configure_and_quit, N_("Quit after initial configuration"), NULL },
|
||||||
{ "debug", 'd', 0, G_OPTION_ARG_NONE, &cli->is_debug, N_("Don't become a daemon, and log to stderr"), NULL },
|
{ "debug", 'd', 0, G_OPTION_ARG_NONE, &cli->is_debug, N_("Don't become a daemon, and log to stderr"), NULL },
|
||||||
|
|
||||||
|
|
@ -652,7 +615,7 @@ static gboolean
|
||||||
_setting_is_string_list (const char *group, const char *key)
|
_setting_is_string_list (const char *group, const char *key)
|
||||||
{
|
{
|
||||||
return _IS (NM_CONFIG_KEYFILE_GROUP_MAIN, "plugins")
|
return _IS (NM_CONFIG_KEYFILE_GROUP_MAIN, "plugins")
|
||||||
|| _IS (NM_CONFIG_KEYFILE_GROUP_MAIN, "debug")
|
|| _IS (NM_CONFIG_KEYFILE_GROUP_MAIN, NM_CONFIG_KEYFILE_KEY_MAIN_DEBUG)
|
||||||
|| _IS (NM_CONFIG_KEYFILE_GROUP_LOGGING, "domains")
|
|| _IS (NM_CONFIG_KEYFILE_GROUP_LOGGING, "domains")
|
||||||
|| g_str_has_prefix (group, NM_CONFIG_KEYFILE_GROUPPREFIX_TEST_APPEND_STRINGLIST);
|
|| g_str_has_prefix (group, NM_CONFIG_KEYFILE_GROUPPREFIX_TEST_APPEND_STRINGLIST);
|
||||||
#undef _IS
|
#undef _IS
|
||||||
|
|
@ -764,6 +727,13 @@ read_config (GKeyFile *keyfile, gboolean is_base_config, const char *dirname, co
|
||||||
if (is_string_list) {
|
if (is_string_list) {
|
||||||
old_val = g_key_file_get_string_list (keyfile, group, base_key, NULL, NULL);
|
old_val = g_key_file_get_string_list (keyfile, group, base_key, NULL, NULL);
|
||||||
new_val = g_key_file_get_string_list (kf, group, key, NULL, NULL);
|
new_val = g_key_file_get_string_list (kf, group, key, NULL, NULL);
|
||||||
|
if (!old_val && !g_key_file_has_key (keyfile, group, base_key, NULL)) {
|
||||||
|
/* we must fill the unspecified value with the compile-time default. */
|
||||||
|
if (nm_streq (group, NM_CONFIG_KEYFILE_GROUP_MAIN) && nm_streq (base_key, "plugins")) {
|
||||||
|
g_key_file_set_value (keyfile, group, base_key, NM_CONFIG_DEFAULT_MAIN_PLUGINS);
|
||||||
|
old_val = g_key_file_get_string_list (keyfile, group, base_key, NULL, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
gs_free char *old_sval = nm_config_keyfile_get_value (keyfile, group, base_key, NM_CONFIG_GET_VALUE_TYPE_SPEC);
|
gs_free char *old_sval = nm_config_keyfile_get_value (keyfile, group, base_key, NM_CONFIG_GET_VALUE_TYPE_SPEC);
|
||||||
gs_free char *new_sval = nm_config_keyfile_get_value (kf, group, key, NM_CONFIG_GET_VALUE_TYPE_SPEC);
|
gs_free char *new_sval = nm_config_keyfile_get_value (kf, group, key, NM_CONFIG_GET_VALUE_TYPE_SPEC);
|
||||||
|
|
@ -2331,20 +2301,11 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
|
||||||
else
|
else
|
||||||
priv->no_auto_default_file = g_strdup (DEFAULT_NO_AUTO_DEFAULT_FILE);
|
priv->no_auto_default_file = g_strdup (DEFAULT_NO_AUTO_DEFAULT_FILE);
|
||||||
|
|
||||||
priv->plugins = _nm_utils_strv_cleanup (g_key_file_get_string_list (keyfile, NM_CONFIG_KEYFILE_GROUP_MAIN, "plugins", NULL, NULL),
|
|
||||||
TRUE, TRUE, TRUE);
|
|
||||||
|
|
||||||
priv->monitor_connection_files = nm_config_keyfile_get_boolean (keyfile, NM_CONFIG_KEYFILE_GROUP_MAIN, "monitor-connection-files", FALSE);
|
priv->monitor_connection_files = nm_config_keyfile_get_boolean (keyfile, NM_CONFIG_KEYFILE_GROUP_MAIN, "monitor-connection-files", FALSE);
|
||||||
|
|
||||||
priv->auth_polkit = nm_config_keyfile_get_boolean (keyfile, NM_CONFIG_KEYFILE_GROUP_MAIN, "auth-polkit", NM_CONFIG_DEFAULT_AUTH_POLKIT_BOOL);
|
|
||||||
|
|
||||||
priv->dhcp_client = nm_strstrip (g_key_file_get_string (keyfile, NM_CONFIG_KEYFILE_GROUP_MAIN, "dhcp", NULL));
|
|
||||||
|
|
||||||
priv->log_level = nm_strstrip (g_key_file_get_string (keyfile, NM_CONFIG_KEYFILE_GROUP_LOGGING, "level", NULL));
|
priv->log_level = nm_strstrip (g_key_file_get_string (keyfile, NM_CONFIG_KEYFILE_GROUP_LOGGING, "level", NULL));
|
||||||
priv->log_domains = nm_strstrip (g_key_file_get_string (keyfile, NM_CONFIG_KEYFILE_GROUP_LOGGING, "domains", NULL));
|
priv->log_domains = nm_strstrip (g_key_file_get_string (keyfile, NM_CONFIG_KEYFILE_GROUP_LOGGING, "domains", NULL));
|
||||||
|
|
||||||
priv->debug = g_key_file_get_string (keyfile, NM_CONFIG_KEYFILE_GROUP_MAIN, "debug", NULL);
|
|
||||||
|
|
||||||
priv->configure_and_quit = nm_config_keyfile_get_boolean (keyfile, NM_CONFIG_KEYFILE_GROUP_MAIN, "configure-and-quit", FALSE);
|
priv->configure_and_quit = nm_config_keyfile_get_boolean (keyfile, NM_CONFIG_KEYFILE_GROUP_MAIN, "configure-and-quit", FALSE);
|
||||||
|
|
||||||
no_auto_default = no_auto_default_from_file (priv->no_auto_default_file);
|
no_auto_default = no_auto_default_from_file (priv->no_auto_default_file);
|
||||||
|
|
@ -2375,9 +2336,6 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
|
||||||
static void
|
static void
|
||||||
nm_config_init (NMConfig *config)
|
nm_config_init (NMConfig *config)
|
||||||
{
|
{
|
||||||
NMConfigPrivate *priv = NM_CONFIG_GET_PRIVATE (config);
|
|
||||||
|
|
||||||
priv->auth_polkit = NM_CONFIG_DEFAULT_AUTH_POLKIT_BOOL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NMConfig *
|
NMConfig *
|
||||||
|
|
@ -2402,11 +2360,8 @@ finalize (GObject *gobject)
|
||||||
g_free (priv->system_config_dir);
|
g_free (priv->system_config_dir);
|
||||||
g_free (priv->no_auto_default_file);
|
g_free (priv->no_auto_default_file);
|
||||||
g_free (priv->intern_config_file);
|
g_free (priv->intern_config_file);
|
||||||
g_strfreev (priv->plugins);
|
|
||||||
g_free (priv->dhcp_client);
|
|
||||||
g_free (priv->log_level);
|
g_free (priv->log_level);
|
||||||
g_free (priv->log_domains);
|
g_free (priv->log_domains);
|
||||||
g_free (priv->debug);
|
|
||||||
g_strfreev (priv->atomic_section_prefixes);
|
g_strfreev (priv->atomic_section_prefixes);
|
||||||
|
|
||||||
_nm_config_cmd_line_options_clear (&priv->cli);
|
_nm_config_cmd_line_options_clear (&priv->cli);
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,9 @@
|
||||||
#define NM_CONFIG_KEYFILE_GROUP_IFUPDOWN "ifupdown"
|
#define NM_CONFIG_KEYFILE_GROUP_IFUPDOWN "ifupdown"
|
||||||
#define NM_CONFIG_KEYFILE_GROUP_IFNET "ifnet"
|
#define NM_CONFIG_KEYFILE_GROUP_IFNET "ifnet"
|
||||||
|
|
||||||
|
#define NM_CONFIG_KEYFILE_KEY_MAIN_AUTH_POLKIT "auth-polkit"
|
||||||
|
#define NM_CONFIG_KEYFILE_KEY_MAIN_DHCP "dhcp"
|
||||||
|
#define NM_CONFIG_KEYFILE_KEY_MAIN_DEBUG "debug"
|
||||||
#define NM_CONFIG_KEYFILE_KEY_LOGGING_BACKEND "backend"
|
#define NM_CONFIG_KEYFILE_KEY_LOGGING_BACKEND "backend"
|
||||||
#define NM_CONFIG_KEYFILE_KEY_CONFIG_ENABLE "enable"
|
#define NM_CONFIG_KEYFILE_KEY_CONFIG_ENABLE "enable"
|
||||||
#define NM_CONFIG_KEYFILE_KEY_ATOMIC_SECTION_WAS ".was"
|
#define NM_CONFIG_KEYFILE_KEY_ATOMIC_SECTION_WAS ".was"
|
||||||
|
|
@ -114,13 +117,9 @@ NMConfigData *nm_config_get_data_orig (NMConfig *config);
|
||||||
#define NM_CONFIG_GET_DATA (nm_config_get_data (nm_config_get ()))
|
#define NM_CONFIG_GET_DATA (nm_config_get_data (nm_config_get ()))
|
||||||
#define NM_CONFIG_GET_DATA_ORIG (nm_config_get_data_orig (nm_config_get ()))
|
#define NM_CONFIG_GET_DATA_ORIG (nm_config_get_data_orig (nm_config_get ()))
|
||||||
|
|
||||||
const char **nm_config_get_plugins (NMConfig *config);
|
|
||||||
gboolean nm_config_get_monitor_connection_files (NMConfig *config);
|
gboolean nm_config_get_monitor_connection_files (NMConfig *config);
|
||||||
gboolean nm_config_get_auth_polkit (NMConfig *config);
|
|
||||||
const char *nm_config_get_dhcp_client (NMConfig *config);
|
|
||||||
const char *nm_config_get_log_level (NMConfig *config);
|
const char *nm_config_get_log_level (NMConfig *config);
|
||||||
const char *nm_config_get_log_domains (NMConfig *config);
|
const char *nm_config_get_log_domains (NMConfig *config);
|
||||||
const char *nm_config_get_debug (NMConfig *config);
|
|
||||||
gboolean nm_config_get_configure_and_quit (NMConfig *config);
|
gboolean nm_config_get_configure_and_quit (NMConfig *config);
|
||||||
gboolean nm_config_get_is_debug (NMConfig *config);
|
gboolean nm_config_get_is_debug (NMConfig *config);
|
||||||
|
|
||||||
|
|
@ -183,7 +182,7 @@ extern char *_nm_config_match_env;
|
||||||
|
|
||||||
#define NM_CONFIG_DEVICE_STATE_DIR ""NMRUNDIR"/devices"
|
#define NM_CONFIG_DEVICE_STATE_DIR ""NMRUNDIR"/devices"
|
||||||
|
|
||||||
#define NM_CONFIG_DEFAULT_AUTH_POLKIT_BOOL (nm_streq (""NM_CONFIG_DEFAULT_AUTH_POLKIT, "true"))
|
#define NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT_BOOL (nm_streq (""NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT, "true"))
|
||||||
#define NM_CONFIG_DEFAULT_LOGGING_AUDIT_BOOL (nm_streq (""NM_CONFIG_DEFAULT_LOGGING_AUDIT, "true"))
|
#define NM_CONFIG_DEFAULT_LOGGING_AUDIT_BOOL (nm_streq (""NM_CONFIG_DEFAULT_LOGGING_AUDIT, "true"))
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
|
||||||
|
|
@ -557,52 +557,56 @@ const NMDhcpClientFactory *const _nm_dhcp_manager_factories[3] = {
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Stub functions */
|
/* Stub functions */
|
||||||
|
|
||||||
|
#include "nm-config.h"
|
||||||
|
#include "devices/nm-device.h"
|
||||||
|
#include "nm-active-connection.h"
|
||||||
|
#include "nm-bus-manager.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
nm_main_config_reload (int signal)
|
nm_main_config_reload (int signal)
|
||||||
{
|
{
|
||||||
_LOGI (LOGD_CORE, "reloading configuration not supported");
|
_LOGI (LOGD_CORE, "reloading configuration not supported");
|
||||||
}
|
}
|
||||||
|
|
||||||
gconstpointer nm_config_get (void);
|
NMConfig *
|
||||||
const char *nm_config_get_dhcp_client (gpointer unused);
|
|
||||||
gboolean nm_config_get_configure_and_quit (gpointer unused);
|
|
||||||
gconstpointer nm_bus_manager_get (void);
|
|
||||||
void nm_bus_manager_register_object (gpointer unused, gpointer object);
|
|
||||||
void nm_bus_manager_unregister_object (gpointer unused, gpointer object);
|
|
||||||
GType nm_device_get_type (void);
|
|
||||||
GType nm_active_connection_get_type (void);
|
|
||||||
|
|
||||||
gconstpointer
|
|
||||||
nm_config_get (void)
|
nm_config_get (void)
|
||||||
{
|
{
|
||||||
return GUINT_TO_POINTER (1);
|
return GUINT_TO_POINTER (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
NMConfigData *
|
||||||
nm_config_get_dhcp_client (gpointer unused)
|
nm_config_get_data_orig (NMConfig *config)
|
||||||
{
|
{
|
||||||
return "internal";
|
return GUINT_TO_POINTER (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
nm_config_data_get_value (const NMConfigData *config_data, const char *group, const char *key, NMConfigGetValueFlags flags)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
nm_config_get_configure_and_quit (gpointer unused)
|
nm_config_get_configure_and_quit (NMConfig *config)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gconstpointer
|
NMBusManager *
|
||||||
nm_bus_manager_get (void)
|
nm_bus_manager_get (void)
|
||||||
{
|
{
|
||||||
return GUINT_TO_POINTER (1);
|
return GUINT_TO_POINTER (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nm_bus_manager_register_object (gpointer unused, gpointer object)
|
nm_bus_manager_register_object (NMBusManager *bus_manager,
|
||||||
|
GDBusObjectSkeleton *object)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nm_bus_manager_unregister_object (gpointer unused, gpointer object)
|
nm_bus_manager_unregister_object (NMBusManager *bus_manager,
|
||||||
|
GDBusObjectSkeleton *object)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -818,7 +818,7 @@ nm_logging_syslog_openlog (const char *logging_backend)
|
||||||
g_return_if_reached ();
|
g_return_if_reached ();
|
||||||
|
|
||||||
if (!logging_backend)
|
if (!logging_backend)
|
||||||
logging_backend = ""NM_CONFIG_LOGGING_BACKEND_DEFAULT;
|
logging_backend = ""NM_CONFIG_DEFAULT_LOGGING_BACKEND;
|
||||||
|
|
||||||
if (strcmp (logging_backend, "debug") == 0) {
|
if (strcmp (logging_backend, "debug") == 0) {
|
||||||
global.log_backend = LOG_BACKEND_SYSLOG;
|
global.log_backend = LOG_BACKEND_SYSLOG;
|
||||||
|
|
|
||||||
|
|
@ -2284,19 +2284,14 @@ nm_settings_start (NMSettings *self, GError **error)
|
||||||
GDBusProxy *proxy;
|
GDBusProxy *proxy;
|
||||||
GVariant *variant;
|
GVariant *variant;
|
||||||
GError *local_error = NULL;
|
GError *local_error = NULL;
|
||||||
const char **plugins;
|
gs_strfreev char **plugins = NULL;
|
||||||
gs_strfreev char **plugins_default = NULL;
|
|
||||||
|
|
||||||
priv = NM_SETTINGS_GET_PRIVATE (self);
|
priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||||
|
|
||||||
/* Load the plugins; fail if a plugin is not found. */
|
/* Load the plugins; fail if a plugin is not found. */
|
||||||
plugins = nm_config_get_plugins (priv->config);
|
plugins = nm_config_data_get_plugins (nm_config_get_data_orig (priv->config), TRUE);
|
||||||
if (!plugins) {
|
|
||||||
plugins_default = g_strsplit (NM_CONFIG_PLUGINS_DEFAULT, ",", -1);
|
|
||||||
plugins = (const char **) plugins_default;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!load_plugins (self, plugins, error)) {
|
if (!load_plugins (self, (const char **) plugins, error)) {
|
||||||
g_object_unref (self);
|
g_object_unref (self);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
#include "NetworkManagerUtils.h"
|
#include "NetworkManagerUtils.h"
|
||||||
#include "settings/nm-settings-plugin.h"
|
#include "settings/nm-settings-plugin.h"
|
||||||
#include "nm-config.h"
|
#include "nm-config.h"
|
||||||
|
#include "dhcp/nm-dhcp-manager.h"
|
||||||
|
|
||||||
#include "nms-ifnet-wpa-parser.h"
|
#include "nms-ifnet-wpa-parser.h"
|
||||||
#include "nms-ifnet-net-parser.h"
|
#include "nms-ifnet-net-parser.h"
|
||||||
|
|
@ -729,24 +730,25 @@ get_dhcp_hostname_and_client_id (char **hostname, char **client_id)
|
||||||
|
|
||||||
*hostname = NULL;
|
*hostname = NULL;
|
||||||
*client_id = NULL;
|
*client_id = NULL;
|
||||||
dhcp_client = nm_config_get_dhcp_client (nm_config_get ());
|
dhcp_client = nm_dhcp_manager_get_config (nm_dhcp_manager_get ());
|
||||||
if (dhcp_client) {
|
if (dhcp_client) {
|
||||||
if (!strcmp (dhcp_client, "dhclient")) {
|
if (!strcmp (dhcp_client, "dhclient")) {
|
||||||
g_file_get_contents (dhclient_conf, &contents, NULL,
|
g_file_get_contents (dhclient_conf, &contents, NULL,
|
||||||
NULL);
|
NULL);
|
||||||
use_dhclient = TRUE;
|
use_dhclient = TRUE;
|
||||||
} else if (!strcmp (dhcp_client, "dhcpcd"))
|
} else if (!strcmp (dhcp_client, "dhcpcd")) {
|
||||||
g_file_get_contents (dhcpcd_conf, &contents, NULL,
|
g_file_get_contents (dhcpcd_conf, &contents, NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (g_file_test (dhclient_conf, G_FILE_TEST_IS_REGULAR)) {
|
if (g_file_test (dhclient_conf, G_FILE_TEST_IS_REGULAR)) {
|
||||||
g_file_get_contents (dhclient_conf, &contents, NULL,
|
g_file_get_contents (dhclient_conf, &contents, NULL,
|
||||||
NULL);
|
NULL);
|
||||||
use_dhclient = TRUE;
|
use_dhclient = TRUE;
|
||||||
}
|
} else if (g_file_test (dhcpcd_conf, G_FILE_TEST_IS_REGULAR)) {
|
||||||
else if (g_file_test (dhcpcd_conf, G_FILE_TEST_IS_REGULAR))
|
|
||||||
g_file_get_contents (dhcpcd_conf, &contents, NULL,
|
g_file_get_contents (dhcpcd_conf, &contents, NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!contents)
|
if (!contents)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@
|
||||||
|
|
||||||
#include "nm-utils.h"
|
#include "nm-utils.h"
|
||||||
|
|
||||||
#include "nm-config.h"
|
|
||||||
#include "platform/nm-linux-platform.h"
|
#include "platform/nm-linux-platform.h"
|
||||||
|
#include "dhcp/nm-dhcp-manager.h"
|
||||||
|
|
||||||
#include "settings/plugins/ifnet/nms-ifnet-net-parser.h"
|
#include "settings/plugins/ifnet/nms-ifnet-net-parser.h"
|
||||||
#include "settings/plugins/ifnet/nms-ifnet-net-utils.h"
|
#include "settings/plugins/ifnet/nms-ifnet-net-utils.h"
|
||||||
|
|
@ -40,17 +40,17 @@
|
||||||
|
|
||||||
#include "nm-test-utils-core.h"
|
#include "nm-test-utils-core.h"
|
||||||
|
|
||||||
/* Fake NMConfig handling; the values it returns don't matter, so this
|
/* Fake config handling; the values it returns don't matter, so this
|
||||||
* is easier than forcing it to read our own config file, etc.
|
* is easier than forcing it to read our own config file, etc.
|
||||||
*/
|
*/
|
||||||
NMConfig *
|
NMDhcpManager *
|
||||||
nm_config_get (void)
|
nm_dhcp_manager_get (void)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
nm_config_get_dhcp_client (NMConfig *config)
|
nm_dhcp_manager_get_config (NMDhcpManager *dhcp_manager)
|
||||||
{
|
{
|
||||||
return "dhclient";
|
return "dhclient";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,17 @@ _assert_config_value (const NMConfigData *config_data, const char *group, const
|
||||||
}
|
}
|
||||||
#define assert_config_value(config_data, group, key, expected_value) _assert_config_value (config_data, group, key, expected_value, __FILE__, __LINE__)
|
#define assert_config_value(config_data, group, key, expected_value) _assert_config_value (config_data, group, key, expected_value, __FILE__, __LINE__)
|
||||||
|
|
||||||
|
#define _config_get_dhcp_client_a(config) \
|
||||||
|
({ \
|
||||||
|
gs_free char *_s = NULL; \
|
||||||
|
\
|
||||||
|
_s = nm_config_data_get_value (nm_config_get_data_orig (config), \
|
||||||
|
NM_CONFIG_KEYFILE_GROUP_MAIN, \
|
||||||
|
NM_CONFIG_KEYFILE_KEY_MAIN_DHCP, \
|
||||||
|
NM_CONFIG_GET_VALUE_STRIP | NM_CONFIG_GET_VALUE_NO_EMPTY); \
|
||||||
|
_s ? nm_sprintf_bufa (100, "%s", _s) : NULL; \
|
||||||
|
})
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static NMConfig *
|
static NMConfig *
|
||||||
|
|
@ -114,8 +125,8 @@ setup_config (GError **error, const char *config_file, const char *intern_config
|
||||||
static void
|
static void
|
||||||
test_config_simple (void)
|
test_config_simple (void)
|
||||||
{
|
{
|
||||||
NMConfig *config;
|
gs_unref_object NMConfig *config = NULL;
|
||||||
const char **plugins;
|
gs_strfreev char **plugins = NULL;
|
||||||
char *value;
|
char *value;
|
||||||
gs_unref_object NMDevice *dev50 = nm_test_device_new ("00:00:00:00:00:50");
|
gs_unref_object NMDevice *dev50 = nm_test_device_new ("00:00:00:00:00:50");
|
||||||
gs_unref_object NMDevice *dev51 = nm_test_device_new ("00:00:00:00:00:51");
|
gs_unref_object NMDevice *dev51 = nm_test_device_new ("00:00:00:00:00:51");
|
||||||
|
|
@ -124,11 +135,11 @@ test_config_simple (void)
|
||||||
config = setup_config (NULL, SRCDIR "/NetworkManager.conf", "", NULL, "/no/such/dir", "", NULL);
|
config = setup_config (NULL, SRCDIR "/NetworkManager.conf", "", NULL, "/no/such/dir", "", NULL);
|
||||||
|
|
||||||
g_assert_cmpstr (nm_config_data_get_config_main_file (nm_config_get_data_orig (config)), ==, SRCDIR "/NetworkManager.conf");
|
g_assert_cmpstr (nm_config_data_get_config_main_file (nm_config_get_data_orig (config)), ==, SRCDIR "/NetworkManager.conf");
|
||||||
g_assert_cmpstr (nm_config_get_dhcp_client (config), ==, "dhclient");
|
g_assert_cmpstr (_config_get_dhcp_client_a (config), ==, "dhclient");
|
||||||
g_assert_cmpstr (nm_config_get_log_level (config), ==, "INFO");
|
g_assert_cmpstr (nm_config_get_log_level (config), ==, "INFO");
|
||||||
g_assert_cmpint (nm_config_data_get_connectivity_interval (nm_config_get_data_orig (config)), ==, 100);
|
g_assert_cmpint (nm_config_data_get_connectivity_interval (nm_config_get_data_orig (config)), ==, 100);
|
||||||
|
|
||||||
plugins = nm_config_get_plugins (config);
|
plugins = nm_config_data_get_plugins (nm_config_get_data_orig (config), FALSE);
|
||||||
g_assert_cmpint (g_strv_length ((char **)plugins), ==, 3);
|
g_assert_cmpint (g_strv_length ((char **)plugins), ==, 3);
|
||||||
g_assert_cmpstr (plugins[0], ==, "foo");
|
g_assert_cmpstr (plugins[0], ==, "foo");
|
||||||
g_assert_cmpstr (plugins[1], ==, "bar");
|
g_assert_cmpstr (plugins[1], ==, "bar");
|
||||||
|
|
@ -190,9 +201,6 @@ test_config_simple (void)
|
||||||
value = nm_config_data_get_connection_default (nm_config_get_data_orig (config), "dummy.test2", dev50);
|
value = nm_config_data_get_connection_default (nm_config_get_data_orig (config), "dummy.test2", dev50);
|
||||||
g_assert_cmpstr (value, ==, "no");
|
g_assert_cmpstr (value, ==, "no");
|
||||||
g_free (value);
|
g_free (value);
|
||||||
|
|
||||||
|
|
||||||
g_object_unref (config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -218,8 +226,8 @@ test_config_parse_error (void)
|
||||||
static void
|
static void
|
||||||
test_config_override (void)
|
test_config_override (void)
|
||||||
{
|
{
|
||||||
NMConfig *config;
|
gs_unref_object NMConfig *config = NULL;
|
||||||
const char **plugins;
|
gs_strfreev char **plugins = NULL;
|
||||||
|
|
||||||
config = setup_config (NULL, SRCDIR "/NetworkManager.conf", "", NULL, "/no/such/dir", "",
|
config = setup_config (NULL, SRCDIR "/NetworkManager.conf", "", NULL, "/no/such/dir", "",
|
||||||
"--plugins", "alpha,beta,gamma,delta",
|
"--plugins", "alpha,beta,gamma,delta",
|
||||||
|
|
@ -227,18 +235,16 @@ test_config_override (void)
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_assert_cmpstr (nm_config_data_get_config_main_file (nm_config_get_data_orig (config)), ==, SRCDIR "/NetworkManager.conf");
|
g_assert_cmpstr (nm_config_data_get_config_main_file (nm_config_get_data_orig (config)), ==, SRCDIR "/NetworkManager.conf");
|
||||||
g_assert_cmpstr (nm_config_get_dhcp_client (config), ==, "dhclient");
|
g_assert_cmpstr (_config_get_dhcp_client_a (config), ==, "dhclient");
|
||||||
g_assert_cmpstr (nm_config_get_log_level (config), ==, "INFO");
|
g_assert_cmpstr (nm_config_get_log_level (config), ==, "INFO");
|
||||||
g_assert_cmpint (nm_config_data_get_connectivity_interval (nm_config_get_data_orig (config)), ==, 12);
|
g_assert_cmpint (nm_config_data_get_connectivity_interval (nm_config_get_data_orig (config)), ==, 12);
|
||||||
|
|
||||||
plugins = nm_config_get_plugins (config);
|
plugins = nm_config_data_get_plugins (nm_config_get_data_orig (config), FALSE);
|
||||||
g_assert_cmpint (g_strv_length ((char **)plugins), ==, 4);
|
g_assert_cmpint (g_strv_length ((char **)plugins), ==, 4);
|
||||||
g_assert_cmpstr (plugins[0], ==, "alpha");
|
g_assert_cmpstr (plugins[0], ==, "alpha");
|
||||||
g_assert_cmpstr (plugins[1], ==, "beta");
|
g_assert_cmpstr (plugins[1], ==, "beta");
|
||||||
g_assert_cmpstr (plugins[2], ==, "gamma");
|
g_assert_cmpstr (plugins[2], ==, "gamma");
|
||||||
g_assert_cmpstr (plugins[3], ==, "delta");
|
g_assert_cmpstr (plugins[3], ==, "delta");
|
||||||
|
|
||||||
g_object_unref (config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -374,21 +380,21 @@ test_config_no_auto_default (void)
|
||||||
static void
|
static void
|
||||||
test_config_confdir (void)
|
test_config_confdir (void)
|
||||||
{
|
{
|
||||||
NMConfig *config;
|
gs_unref_object NMConfig *config = NULL;
|
||||||
const char **plugins;
|
gs_strfreev char **plugins = NULL;
|
||||||
char *value;
|
char *value;
|
||||||
GSList *specs;
|
GSList *specs;
|
||||||
|
|
||||||
config = setup_config (NULL, SRCDIR "/NetworkManager.conf", "", NULL, SRCDIR "/conf.d", "", NULL);
|
config = setup_config (NULL, SRCDIR "/NetworkManager.conf", "", NULL, SRCDIR "/conf.d", "", NULL);
|
||||||
|
|
||||||
g_assert_cmpstr (nm_config_data_get_config_main_file (nm_config_get_data_orig (config)), ==, SRCDIR "/NetworkManager.conf");
|
g_assert_cmpstr (nm_config_data_get_config_main_file (nm_config_get_data_orig (config)), ==, SRCDIR "/NetworkManager.conf");
|
||||||
g_assert_cmpstr (nm_config_get_dhcp_client (config), ==, "dhcpcd");
|
g_assert_cmpstr (_config_get_dhcp_client_a (config), ==, "dhcpcd");
|
||||||
g_assert_cmpstr (nm_config_get_log_level (config), ==, "INFO");
|
g_assert_cmpstr (nm_config_get_log_level (config), ==, "INFO");
|
||||||
g_assert_cmpstr (nm_config_get_log_domains (config), ==, "PLATFORM,DNS,WIFI");
|
g_assert_cmpstr (nm_config_get_log_domains (config), ==, "PLATFORM,DNS,WIFI");
|
||||||
g_assert_cmpstr (nm_config_data_get_connectivity_uri (nm_config_get_data_orig (config)), ==, "http://example.net");
|
g_assert_cmpstr (nm_config_data_get_connectivity_uri (nm_config_get_data_orig (config)), ==, "http://example.net");
|
||||||
g_assert_cmpint (nm_config_data_get_connectivity_interval (nm_config_get_data_orig (config)), ==, 100);
|
g_assert_cmpint (nm_config_data_get_connectivity_interval (nm_config_get_data_orig (config)), ==, 100);
|
||||||
|
|
||||||
plugins = nm_config_get_plugins (config);
|
plugins = nm_config_data_get_plugins (nm_config_get_data_orig (config), FALSE);
|
||||||
g_assert_cmpint (g_strv_length ((char **)plugins), ==, 5);
|
g_assert_cmpint (g_strv_length ((char **)plugins), ==, 5);
|
||||||
g_assert_cmpstr (plugins[0], ==, "foo");
|
g_assert_cmpstr (plugins[0], ==, "foo");
|
||||||
g_assert_cmpstr (plugins[1], ==, "bar");
|
g_assert_cmpstr (plugins[1], ==, "bar");
|
||||||
|
|
@ -475,8 +481,6 @@ test_config_confdir (void)
|
||||||
g_free (value);
|
g_free (value);
|
||||||
|
|
||||||
nm_config_data_log (nm_config_get_data_orig (config), ">>> TEST: ", " ", NULL);
|
nm_config_data_log (nm_config_get_data_orig (config), ">>> TEST: ", " ", NULL);
|
||||||
|
|
||||||
g_object_unref (config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue