2011-09-22 10:16:07 -05:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
|
|
|
|
/* NetworkManager -- Network link manager
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program 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 General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2011 Red Hat, Inc.
|
2013-01-15 18:48:51 +01:00
|
|
|
* Copyright (C) 2013 Thomas Bechtold <thomasbechtold@jpberlin.de>
|
2011-09-22 10:16:07 -05:00
|
|
|
*/
|
|
|
|
|
|
all: fix up multiple-include-guard defines
Previously, src/nm-ip4-config.h, libnm/nm-ip4-config.h, and
libnm-glib/nm-ip4-config.h all used "NM_IP4_CONFIG_H" as an include
guard, which meant that nm-test-utils.h could not tell which of them
was being included (and so, eg, if you tried to include
nm-ip4-config.h in a libnm test, it would fail to compile because
nm-test-utils.h was referring to symbols in src/nm-ip4-config.h).
Fix this by changing the include guards in the non-API-stable parts of
the tree:
- libnm-glib/nm-ip4-config.h remains NM_IP4_CONFIG_H
- libnm/nm-ip4-config.h now uses __NM_IP4_CONFIG_H__
- src/nm-ip4-config.h now uses __NETWORKMANAGER_IP4_CONFIG_H__
And likewise for all other headers.
The two non-"nm"-prefixed headers, libnm/NetworkManager.h and
src/NetworkManagerUtils.h are now __NETWORKMANAGER_H__ and
__NETWORKMANAGER_UTILS_H__ respectively, which, while not entirely
consistent with the general scheme, do still mostly make sense in
isolation.
2014-08-13 14:10:11 -04:00
|
|
|
#ifndef __NETWORKMANAGER_CONFIG_H__
|
|
|
|
|
#define __NETWORKMANAGER_CONFIG_H__
|
2011-09-22 10:16:07 -05:00
|
|
|
|
2014-07-11 18:54:18 +02:00
|
|
|
#include "nm-config-data.h"
|
2013-03-12 13:14:54 -04:00
|
|
|
|
2013-01-15 18:48:51 +01:00
|
|
|
#define NM_TYPE_CONFIG (nm_config_get_type ())
|
|
|
|
|
#define NM_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_CONFIG, NMConfig))
|
|
|
|
|
#define NM_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_CONFIG, NMConfigClass))
|
|
|
|
|
#define NM_IS_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_CONFIG))
|
|
|
|
|
#define NM_IS_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_CONFIG))
|
|
|
|
|
#define NM_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_CONFIG, NMConfigClass))
|
|
|
|
|
|
2014-12-16 15:10:24 +01:00
|
|
|
/* Properties */
|
|
|
|
|
#define NM_CONFIG_CMD_LINE_OPTIONS "cmd-line-options"
|
2015-06-10 11:59:46 +02:00
|
|
|
#define NM_CONFIG_ATOMIC_SECTION_PREFIXES "atomic-section-prefixes"
|
2014-12-16 15:10:24 +01:00
|
|
|
|
2014-07-09 18:54:47 +02:00
|
|
|
/* Signals */
|
|
|
|
|
#define NM_CONFIG_SIGNAL_CONFIG_CHANGED "config-changed"
|
|
|
|
|
|
2015-02-19 14:24:37 +01:00
|
|
|
#define NM_CONFIG_DEFAULT_CONNECTIVITY_INTERVAL 300
|
2015-06-06 21:29:01 +02:00
|
|
|
#define NM_CONFIG_DEFAULT_CONNECTIVITY_RESPONSE "NetworkManager is online" /* NOT LOCALIZED */
|
2015-02-19 14:24:37 +01:00
|
|
|
|
2015-07-02 09:46:35 +02:00
|
|
|
#define NM_CONFIG_KEYFILE_LIST_SEPARATOR ','
|
|
|
|
|
|
2015-06-24 20:11:42 +02:00
|
|
|
#define NM_CONFIG_KEYFILE_GROUPPREFIX_INTERN ".intern."
|
2015-06-09 09:24:28 +02:00
|
|
|
#define NM_CONFIG_KEYFILE_GROUPPREFIX_CONNECTION "connection"
|
2016-06-22 13:14:10 +02:00
|
|
|
#define NM_CONFIG_KEYFILE_GROUPPREFIX_DEVICE "device"
|
2015-06-15 09:01:42 +02:00
|
|
|
#define NM_CONFIG_KEYFILE_GROUPPREFIX_GLOBAL_DNS_DOMAIN "global-dns-domain-"
|
2015-07-01 13:59:06 +02:00
|
|
|
#define NM_CONFIG_KEYFILE_GROUPPREFIX_TEST_APPEND_STRINGLIST ".test-append-stringlist"
|
2015-06-09 09:24:28 +02:00
|
|
|
|
|
|
|
|
#define NM_CONFIG_KEYFILE_GROUP_MAIN "main"
|
|
|
|
|
#define NM_CONFIG_KEYFILE_GROUP_LOGGING "logging"
|
|
|
|
|
#define NM_CONFIG_KEYFILE_GROUP_CONNECTIVITY "connectivity"
|
2015-06-15 09:01:42 +02:00
|
|
|
#define NM_CONFIG_KEYFILE_GROUP_GLOBAL_DNS "global-dns"
|
config: allow to enable/disable configuration snippets
Support a new configuration option
[.config]
enable=<ENABLED>
for configuration snippets.
This new [.config] section is only relevant within the snippet itself
and it is not merged into the combined configuration.
Currently only the "enable" key is supported. If the "enable" key is
missing, it obviously defaults to being enabled. It allows snippets
to be skipped from loading. The main configuration "NetworkManager.conf"
cannot be skipped.
<ENABLED> can be a boolean value (false), to skip a configuration
snippet from loading.
It can also be a string to match against the NetworkManager version,
like "enable=nm-version-min:1.1,nm-version-min:1.0.6"
There are several motivations for this:
- the user can disable an entire configuration snippet by toggeling
one entry.
This generalizes the functionality of the global-dns.enable
setting, but in a way that applies to configuration on a per-file
basis.
- for developing, we often switch between different versions of
NetworkManager. Thus, we might want to use different configuration.
E.g. before global-dns options, I want to use "dns=none" and manage
resolv.conf myself. Now, I can use global-dns setting to do that.
That can be achieved with something like the following (not exactly,
it's an example only):
[.config]
enable=nm-version-min:1.1
[main]
dns=default
[global-dns-domain-*]
nameserver=127.0.0.1
Arguably, this would be more awesome, if we would bump our micro devel
version (1.1.0) more often while developing 1.2.0 (*hint*).
- in principle, packages could drop configuration snippets and enable
them based on the NetworkManager version.
- with the "env:" spec, you can enable/disable snippets by configuring
an environment variable. Again, useful for testing and developing.
2015-10-01 10:43:33 +02:00
|
|
|
#define NM_CONFIG_KEYFILE_GROUP_CONFIG ".config"
|
2015-06-09 09:24:28 +02:00
|
|
|
|
|
|
|
|
#define NM_CONFIG_KEYFILE_GROUP_KEYFILE "keyfile"
|
|
|
|
|
#define NM_CONFIG_KEYFILE_GROUP_IFUPDOWN "ifupdown"
|
|
|
|
|
#define NM_CONFIG_KEYFILE_GROUP_IFNET "ifnet"
|
|
|
|
|
|
2016-11-25 14:39:59 +01:00
|
|
|
#define NM_CONFIG_KEYFILE_KEY_MAIN_AUTH_POLKIT "auth-polkit"
|
2017-11-22 21:11:54 +01:00
|
|
|
#define NM_CONFIG_KEYFILE_KEY_MAIN_AUTOCONNECT_RETRIES_DEFAULT "autoconnect-retries-default"
|
2016-11-25 15:07:19 +01:00
|
|
|
#define NM_CONFIG_KEYFILE_KEY_MAIN_DHCP "dhcp"
|
2016-11-25 15:34:40 +01:00
|
|
|
#define NM_CONFIG_KEYFILE_KEY_MAIN_DEBUG "debug"
|
2017-03-02 19:18:49 +01:00
|
|
|
#define NM_CONFIG_KEYFILE_KEY_MAIN_HOSTNAME_MODE "hostname-mode"
|
2017-05-15 17:17:26 +02:00
|
|
|
#define NM_CONFIG_KEYFILE_KEY_MAIN_SLAVES_ORDER "slaves-order"
|
2015-07-08 19:34:34 +02:00
|
|
|
#define NM_CONFIG_KEYFILE_KEY_LOGGING_BACKEND "backend"
|
config: allow to enable/disable configuration snippets
Support a new configuration option
[.config]
enable=<ENABLED>
for configuration snippets.
This new [.config] section is only relevant within the snippet itself
and it is not merged into the combined configuration.
Currently only the "enable" key is supported. If the "enable" key is
missing, it obviously defaults to being enabled. It allows snippets
to be skipped from loading. The main configuration "NetworkManager.conf"
cannot be skipped.
<ENABLED> can be a boolean value (false), to skip a configuration
snippet from loading.
It can also be a string to match against the NetworkManager version,
like "enable=nm-version-min:1.1,nm-version-min:1.0.6"
There are several motivations for this:
- the user can disable an entire configuration snippet by toggeling
one entry.
This generalizes the functionality of the global-dns.enable
setting, but in a way that applies to configuration on a per-file
basis.
- for developing, we often switch between different versions of
NetworkManager. Thus, we might want to use different configuration.
E.g. before global-dns options, I want to use "dns=none" and manage
resolv.conf myself. Now, I can use global-dns setting to do that.
That can be achieved with something like the following (not exactly,
it's an example only):
[.config]
enable=nm-version-min:1.1
[main]
dns=default
[global-dns-domain-*]
nameserver=127.0.0.1
Arguably, this would be more awesome, if we would bump our micro devel
version (1.1.0) more often while developing 1.2.0 (*hint*).
- in principle, packages could drop configuration snippets and enable
them based on the NetworkManager version.
- with the "env:" spec, you can enable/disable snippets by configuring
an environment variable. Again, useful for testing and developing.
2015-10-01 10:43:33 +02:00
|
|
|
#define NM_CONFIG_KEYFILE_KEY_CONFIG_ENABLE "enable"
|
2015-06-10 11:59:46 +02:00
|
|
|
#define NM_CONFIG_KEYFILE_KEY_ATOMIC_SECTION_WAS ".was"
|
2015-10-09 18:16:42 +02:00
|
|
|
#define NM_CONFIG_KEYFILE_KEY_KEYFILE_PATH "path"
|
2015-12-08 11:47:56 +01:00
|
|
|
#define NM_CONFIG_KEYFILE_KEY_KEYFILE_UNMANAGED_DEVICES "unmanaged-devices"
|
|
|
|
|
#define NM_CONFIG_KEYFILE_KEY_KEYFILE_HOSTNAME "hostname"
|
2015-06-09 09:24:28 +02:00
|
|
|
#define NM_CONFIG_KEYFILE_KEY_IFNET_AUTO_REFRESH "auto_refresh"
|
|
|
|
|
#define NM_CONFIG_KEYFILE_KEY_IFNET_MANAGED "managed"
|
|
|
|
|
#define NM_CONFIG_KEYFILE_KEY_IFUPDOWN_MANAGED "managed"
|
2015-07-20 18:33:35 +02:00
|
|
|
#define NM_CONFIG_KEYFILE_KEY_AUDIT "audit"
|
2015-06-09 09:24:28 +02:00
|
|
|
|
2017-09-26 16:28:49 +02:00
|
|
|
#define NM_CONFIG_KEYFILE_KEY_DEVICE_MANAGED "managed"
|
config: make "ignore-carrier" a per-device configuration option
NetworkManager.conf already contains several per-device settings,
that is, settings that have a device-spec as argument.
main.ignore-carrier
main.no-auto-default
main.assume-ipv6ll-only
keyfile.unmanged-devices
Optimally, these settings should be moved to the new [device*]
section.
For now, only move main.ignore-carrier there. For the others
it may not make sense to do so:
- main.no-auto-default: is already merged with internal state
from /var/lib/NetworkManager/no-auto-default.state. While
NMConfig's write API would be fine to also persist and merge
the no-auto-default setting, we'd still have to read the old
file too. Thus, deprecating this setting gets quite cumbersome
to still handle the old state file.
Also, it seems a less useful setting to configure in the
global configuration aside setting main.no-auto-default=*.
- main.assume-ipv6ll-only: one day, I hope that we no longer
assume connections at all, and this setting becomes entirely
obsolete.
- keyfile.unmanged-devices: this sets NM_UNMANAGED_USER_SETTINGS,
which cannot be overruled via D-Bus. For a future device.managed
setting we want it it to be overwritable via D-Bus by an explicit
user action. Thus, a device.managed property should have a different
semantic, this should be more like a device.unmanaged-force setting,
which could be done.
2016-06-22 13:43:08 +02:00
|
|
|
#define NM_CONFIG_KEYFILE_KEY_DEVICE_IGNORE_CARRIER "ignore-carrier"
|
2017-04-14 23:33:14 +02:00
|
|
|
#define NM_CONFIG_KEYFILE_KEY_DEVICE_SRIOV_NUM_VFS "sriov-num-vfs"
|
2017-11-21 15:48:57 +01:00
|
|
|
#define NM_CONFIG_KEYFILE_KEY_DEVICE_CARRIER_WAIT_TIMEOUT "carrier-wait-timeout"
|
config: make "ignore-carrier" a per-device configuration option
NetworkManager.conf already contains several per-device settings,
that is, settings that have a device-spec as argument.
main.ignore-carrier
main.no-auto-default
main.assume-ipv6ll-only
keyfile.unmanged-devices
Optimally, these settings should be moved to the new [device*]
section.
For now, only move main.ignore-carrier there. For the others
it may not make sense to do so:
- main.no-auto-default: is already merged with internal state
from /var/lib/NetworkManager/no-auto-default.state. While
NMConfig's write API would be fine to also persist and merge
the no-auto-default setting, we'd still have to read the old
file too. Thus, deprecating this setting gets quite cumbersome
to still handle the old state file.
Also, it seems a less useful setting to configure in the
global configuration aside setting main.no-auto-default=*.
- main.assume-ipv6ll-only: one day, I hope that we no longer
assume connections at all, and this setting becomes entirely
obsolete.
- keyfile.unmanged-devices: this sets NM_UNMANAGED_USER_SETTINGS,
which cannot be overruled via D-Bus. For a future device.managed
setting we want it it to be overwritable via D-Bus by an explicit
user action. Thus, a device.managed property should have a different
semantic, this should be more like a device.unmanaged-force setting,
which could be done.
2016-06-22 13:43:08 +02:00
|
|
|
|
2015-06-24 20:11:42 +02:00
|
|
|
#define NM_CONFIG_KEYFILE_KEYPREFIX_WAS ".was."
|
|
|
|
|
#define NM_CONFIG_KEYFILE_KEYPREFIX_SET ".set."
|
|
|
|
|
|
2015-06-15 09:01:42 +02:00
|
|
|
#define NM_CONFIG_KEYFILE_GROUP_INTERN_GLOBAL_DNS \
|
|
|
|
|
NM_CONFIG_KEYFILE_GROUPPREFIX_INTERN NM_CONFIG_KEYFILE_GROUP_GLOBAL_DNS
|
|
|
|
|
#define NM_CONFIG_KEYFILE_GROUPPREFIX_INTERN_GLOBAL_DNS_DOMAIN \
|
|
|
|
|
NM_CONFIG_KEYFILE_GROUPPREFIX_INTERN NM_CONFIG_KEYFILE_GROUPPREFIX_GLOBAL_DNS_DOMAIN
|
|
|
|
|
|
2014-07-09 15:17:01 +02:00
|
|
|
typedef struct NMConfigCmdLineOptions NMConfigCmdLineOptions;
|
|
|
|
|
|
2015-11-06 16:45:27 +01:00
|
|
|
typedef enum {
|
2016-04-07 18:42:24 +02:00
|
|
|
NM_CONFIG_STATE_PROPERTY_NONE,
|
2015-11-06 16:45:27 +01:00
|
|
|
|
|
|
|
|
/* 1 set-argument: (gboolean enabled) */
|
2016-04-07 18:42:24 +02:00
|
|
|
NM_CONFIG_STATE_PROPERTY_NETWORKING_ENABLED,
|
|
|
|
|
NM_CONFIG_STATE_PROPERTY_WIFI_ENABLED,
|
|
|
|
|
NM_CONFIG_STATE_PROPERTY_WWAN_ENABLED,
|
2015-11-06 16:45:27 +01:00
|
|
|
} NMConfigRunStatePropertyType;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
bool net_enabled;
|
|
|
|
|
bool wifi_enabled;
|
|
|
|
|
bool wwan_enabled;
|
|
|
|
|
|
|
|
|
|
/* Whether the runstate is modified and not saved to disk. */
|
|
|
|
|
bool dirty;
|
2016-04-07 18:42:24 +02:00
|
|
|
} NMConfigState;
|
2015-11-06 16:45:27 +01:00
|
|
|
|
2016-09-29 13:49:01 +02:00
|
|
|
typedef struct _NMConfigClass NMConfigClass;
|
2013-01-15 18:48:51 +01:00
|
|
|
|
|
|
|
|
GType nm_config_get_type (void);
|
2011-09-22 10:16:07 -05:00
|
|
|
|
2013-01-15 18:48:51 +01:00
|
|
|
NMConfig *nm_config_get (void);
|
2011-09-22 10:16:07 -05:00
|
|
|
|
2016-01-19 11:14:51 +01:00
|
|
|
const char *nm_config_change_flags_to_string (NMConfigChangeFlags flags, char *buf, gsize len);
|
2015-01-21 12:58:32 +01:00
|
|
|
|
2014-07-11 18:54:18 +02:00
|
|
|
NMConfigData *nm_config_get_data (NMConfig *config);
|
|
|
|
|
NMConfigData *nm_config_get_data_orig (NMConfig *config);
|
2015-06-09 08:47:41 +02:00
|
|
|
|
|
|
|
|
#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 ()))
|
|
|
|
|
|
2013-05-23 19:05:40 -03:00
|
|
|
gboolean nm_config_get_monitor_connection_files (NMConfig *config);
|
2011-09-22 10:16:07 -05:00
|
|
|
const char *nm_config_get_log_level (NMConfig *config);
|
|
|
|
|
const char *nm_config_get_log_domains (NMConfig *config);
|
2014-04-02 12:41:04 -05:00
|
|
|
gboolean nm_config_get_configure_and_quit (NMConfig *config);
|
2015-07-08 19:39:00 +02:00
|
|
|
gboolean nm_config_get_is_debug (NMConfig *config);
|
2011-09-22 10:16:07 -05:00
|
|
|
|
2017-04-19 15:56:24 +02:00
|
|
|
gboolean nm_config_get_first_start (NMConfig *config);
|
|
|
|
|
|
2015-06-24 20:11:42 +02:00
|
|
|
void nm_config_set_values (NMConfig *self,
|
|
|
|
|
GKeyFile *keyfile_intern_new,
|
|
|
|
|
gboolean allow_write,
|
|
|
|
|
gboolean force_rewrite);
|
|
|
|
|
|
2013-03-11 12:06:38 -04:00
|
|
|
/* for main.c only */
|
2017-04-19 15:56:24 +02:00
|
|
|
NMConfigCmdLineOptions *nm_config_cmd_line_options_new (gboolean first_start);
|
2014-07-09 15:17:01 +02:00
|
|
|
void nm_config_cmd_line_options_free (NMConfigCmdLineOptions *cli);
|
|
|
|
|
void nm_config_cmd_line_options_add_to_entries (NMConfigCmdLineOptions *cli,
|
|
|
|
|
GOptionContext *opt_ctx);
|
|
|
|
|
|
2015-01-07 17:09:52 +01:00
|
|
|
gboolean nm_config_get_no_auto_default_for_device (NMConfig *config, NMDevice *device);
|
|
|
|
|
void nm_config_set_no_auto_default_for_device (NMConfig *config, NMDevice *device);
|
|
|
|
|
|
2015-06-10 11:59:46 +02:00
|
|
|
NMConfig *nm_config_new (const NMConfigCmdLineOptions *cli, char **atomic_section_prefixes, GError **error);
|
|
|
|
|
NMConfig *nm_config_setup (const NMConfigCmdLineOptions *cli, char **atomic_section_prefixes, GError **error);
|
config: refactor change-flags to be a cause/reason which triggered the change
For the most part, this patch just renames some change-flags, but
doesn't change much about them. The new name should better express
what they are.
A config-change signal can be emitted for different reasons:
when we receive a signal (SIGHUP, SIGUSR1, SIGUSR2) or for internal
reasons like resetting of no-auto-default or setting internal
values.
Depending on the reason, we want to perform different actions.
For example:
- we reload the configuration from disk on SIGHUP, but not for
SIGUSR1.
- For SIGUSR1 and SIGHUP, we want to update-dns, but not for SIGUSR2.
Another part of the change-flags encodes which part of the configuration
actually changed. Often, these parts can only change when re-reading
from disk (e.g. a SIGUSR1 will not change any configuration inside
NMConfig).
Later, we will have more causes, and accordingly more fine-grained
effects of what should be done on reload.
2016-05-30 14:53:27 +02:00
|
|
|
void nm_config_reload (NMConfig *config, NMConfigChangeFlags reload_flags);
|
2013-03-11 12:06:38 -04:00
|
|
|
|
2016-04-07 18:42:24 +02:00
|
|
|
const NMConfigState *nm_config_state_get (NMConfig *config);
|
2015-11-06 16:45:27 +01:00
|
|
|
|
2016-04-07 18:42:24 +02:00
|
|
|
void _nm_config_state_set (NMConfig *config,
|
|
|
|
|
gboolean allow_persist,
|
|
|
|
|
gboolean force_persist,
|
|
|
|
|
...);
|
|
|
|
|
#define nm_config_state_set(config, allow_persist, force_persist, ...) \
|
|
|
|
|
_nm_config_state_set (config, allow_persist, force_persist, ##__VA_ARGS__, 0)
|
2015-11-06 16:45:27 +01:00
|
|
|
|
2015-06-09 09:02:32 +02:00
|
|
|
gint nm_config_parse_boolean (const char *str, gint default_value);
|
|
|
|
|
|
2014-12-16 12:14:30 +01:00
|
|
|
GKeyFile *nm_config_create_keyfile (void);
|
2016-09-29 13:49:01 +02:00
|
|
|
gint nm_config_keyfile_get_boolean (const GKeyFile *keyfile,
|
2015-06-09 09:02:32 +02:00
|
|
|
const char *section,
|
|
|
|
|
const char *key,
|
|
|
|
|
gint default_value);
|
2016-09-29 13:49:01 +02:00
|
|
|
char *nm_config_keyfile_get_value (const GKeyFile *keyfile,
|
2015-06-16 15:13:26 +02:00
|
|
|
const char *section,
|
|
|
|
|
const char *key,
|
|
|
|
|
NMConfigGetValueFlags flags);
|
2015-06-09 09:02:32 +02:00
|
|
|
void nm_config_keyfile_set_string_list (GKeyFile *keyfile,
|
|
|
|
|
const char *group,
|
2015-05-15 17:00:31 +02:00
|
|
|
const char *key,
|
2015-06-09 09:02:32 +02:00
|
|
|
const char *const* strv,
|
|
|
|
|
gssize len);
|
2015-10-01 14:00:01 +02:00
|
|
|
gboolean nm_config_keyfile_has_global_dns_config (GKeyFile *keyfile, gboolean internal);
|
|
|
|
|
|
2015-10-01 10:50:14 +02:00
|
|
|
GSList *nm_config_get_match_spec (const GKeyFile *keyfile, const char *group, const char *key, gboolean *out_has_key);
|
2014-12-16 12:14:30 +01:00
|
|
|
|
2015-06-24 20:11:42 +02:00
|
|
|
void _nm_config_sort_groups (char **groups, gsize ngroups);
|
|
|
|
|
|
2015-07-03 11:06:39 +02:00
|
|
|
gboolean nm_config_set_global_dns (NMConfig *self, NMGlobalDnsConfig *global_dns, GError **error);
|
|
|
|
|
|
2017-08-09 15:19:54 +08:00
|
|
|
void nm_config_set_connectivity_check_enabled (NMConfig *self, gboolean enabled);
|
|
|
|
|
|
config: allow to enable/disable configuration snippets
Support a new configuration option
[.config]
enable=<ENABLED>
for configuration snippets.
This new [.config] section is only relevant within the snippet itself
and it is not merged into the combined configuration.
Currently only the "enable" key is supported. If the "enable" key is
missing, it obviously defaults to being enabled. It allows snippets
to be skipped from loading. The main configuration "NetworkManager.conf"
cannot be skipped.
<ENABLED> can be a boolean value (false), to skip a configuration
snippet from loading.
It can also be a string to match against the NetworkManager version,
like "enable=nm-version-min:1.1,nm-version-min:1.0.6"
There are several motivations for this:
- the user can disable an entire configuration snippet by toggeling
one entry.
This generalizes the functionality of the global-dns.enable
setting, but in a way that applies to configuration on a per-file
basis.
- for developing, we often switch between different versions of
NetworkManager. Thus, we might want to use different configuration.
E.g. before global-dns options, I want to use "dns=none" and manage
resolv.conf myself. Now, I can use global-dns setting to do that.
That can be achieved with something like the following (not exactly,
it's an example only):
[.config]
enable=nm-version-min:1.1
[main]
dns=default
[global-dns-domain-*]
nameserver=127.0.0.1
Arguably, this would be more awesome, if we would bump our micro devel
version (1.1.0) more often while developing 1.2.0 (*hint*).
- in principle, packages could drop configuration snippets and enable
them based on the NetworkManager version.
- with the "env:" spec, you can enable/disable snippets by configuring
an environment variable. Again, useful for testing and developing.
2015-10-01 10:43:33 +02:00
|
|
|
/* internal defines ... */
|
|
|
|
|
extern guint _nm_config_match_nm_version;
|
|
|
|
|
extern char *_nm_config_match_env;
|
|
|
|
|
|
2016-04-04 18:18:49 +02:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#define NM_CONFIG_DEVICE_STATE_DIR ""NMRUNDIR"/devices"
|
2016-10-06 22:14:01 +02:00
|
|
|
|
2016-11-25 14:17:30 +01:00
|
|
|
#define NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT_BOOL (nm_streq (""NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT, "true"))
|
2016-10-06 22:14:01 +02:00
|
|
|
#define NM_CONFIG_DEFAULT_LOGGING_AUDIT_BOOL (nm_streq (""NM_CONFIG_DEFAULT_LOGGING_AUDIT, "true"))
|
2016-04-04 18:18:49 +02:00
|
|
|
|
2016-09-23 17:36:21 +02:00
|
|
|
typedef enum {
|
|
|
|
|
NM_CONFIG_DEVICE_STATE_MANAGED_TYPE_UNKNOWN = -1,
|
|
|
|
|
NM_CONFIG_DEVICE_STATE_MANAGED_TYPE_UNMANAGED = 0,
|
|
|
|
|
NM_CONFIG_DEVICE_STATE_MANAGED_TYPE_MANAGED = 1,
|
|
|
|
|
} NMConfigDeviceStateManagedType;
|
|
|
|
|
|
2016-09-26 14:36:20 +02:00
|
|
|
struct _NMConfigDeviceStateData {
|
2016-09-23 17:36:21 +02:00
|
|
|
int ifindex;
|
|
|
|
|
NMConfigDeviceStateManagedType managed;
|
|
|
|
|
|
|
|
|
|
/* the UUID of the last settings-connection active
|
|
|
|
|
* on the device. */
|
|
|
|
|
const char *connection_uuid;
|
2016-10-13 15:56:13 +02:00
|
|
|
|
|
|
|
|
const char *perm_hw_addr_fake;
|
2017-05-30 13:36:56 +02:00
|
|
|
|
|
|
|
|
/* whether the device was nm-owned (0/1) or -1 for
|
|
|
|
|
* non-software devices. */
|
|
|
|
|
gint nm_owned;
|
2016-09-26 14:36:20 +02:00
|
|
|
};
|
2016-09-23 17:36:21 +02:00
|
|
|
|
2017-04-19 15:45:31 +02:00
|
|
|
NMConfigDeviceStateData *nm_config_device_state_load (int ifindex);
|
|
|
|
|
gboolean nm_config_device_state_write (int ifindex,
|
2017-04-07 13:48:43 +02:00
|
|
|
NMConfigDeviceStateManagedType managed,
|
2016-10-13 15:56:13 +02:00
|
|
|
const char *perm_hw_addr_fake,
|
2017-05-30 13:36:56 +02:00
|
|
|
const char *connection_uuid,
|
|
|
|
|
gint nm_owned);
|
2017-04-19 15:45:31 +02:00
|
|
|
void nm_config_device_state_prune_unseen (GHashTable *seen_ifindexes);
|
2016-09-23 17:36:21 +02:00
|
|
|
|
2016-04-04 18:18:49 +02:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
all: fix up multiple-include-guard defines
Previously, src/nm-ip4-config.h, libnm/nm-ip4-config.h, and
libnm-glib/nm-ip4-config.h all used "NM_IP4_CONFIG_H" as an include
guard, which meant that nm-test-utils.h could not tell which of them
was being included (and so, eg, if you tried to include
nm-ip4-config.h in a libnm test, it would fail to compile because
nm-test-utils.h was referring to symbols in src/nm-ip4-config.h).
Fix this by changing the include guards in the non-API-stable parts of
the tree:
- libnm-glib/nm-ip4-config.h remains NM_IP4_CONFIG_H
- libnm/nm-ip4-config.h now uses __NM_IP4_CONFIG_H__
- src/nm-ip4-config.h now uses __NETWORKMANAGER_IP4_CONFIG_H__
And likewise for all other headers.
The two non-"nm"-prefixed headers, libnm/NetworkManager.h and
src/NetworkManagerUtils.h are now __NETWORKMANAGER_H__ and
__NETWORKMANAGER_UTILS_H__ respectively, which, while not entirely
consistent with the general scheme, do still mostly make sense in
isolation.
2014-08-13 14:10:11 -04:00
|
|
|
#endif /* __NETWORKMANAGER_CONFIG_H__ */
|