Commit graph

56 commits

Author SHA1 Message Date
Thomas Haller
caed15e082 config: pass signals to nm_config_reload()
Also react on SIGUSR1 and SIGUSR2, beside SIGHUP.
Only for SIGHUP actually reload the configuration from
disc. For the other signals only emit a config-changed
signal.
2015-06-25 22:02:18 +02:00
Thomas Haller
f031b926c4 config: publish nm_config_keyfile_get_boolean() utility function 2015-06-05 12:38:29 +02:00
Thomas Haller
ae0608eef5 config: minor fix in read_entire_config()
Calling read_entire_config() without passing a @cli argument would
always have caused an assert due to unset @o_config_main_file.
That is not a real problem as that situation didn't arise. Still
fix it.
2015-05-19 11:59:09 +02:00
Thomas Haller
2d333a1769 config: make ignore-carrier option reloadable
Only move the ignore-carrier option from NMConfig to
NMConfigData. The ignore-carrier option is still
immutable after startup.

https://bugzilla.gnome.org/show_bug.cgi?id=748050
2015-05-05 16:51:19 +02:00
Beniamino Galvani
e573977b80 dns: allow runtime selection of resolv.conf manager
Add a new 'rc-manager' configuration parameter that allows to select
the strategy used to write resolv.conf; currently supported values
are: none|resolvconf|netconfig, 'none' meaning that NM directly writes
the file.

The default value of the parameter is 'none'; however if a
RESOLVCONF_PATH (or NETCONFIG_PATH) is specified at build time, the
default value will be 'resolvconf' (or 'netconfig').
2015-05-04 09:42:25 +02:00
Thomas Haller
6b0f84bdda config: fix filename order for config-description
The configuration snippets are loaded in alphabetical order.
Fix the printed description to reflect that order. Otherwise,
NM logs at startup:

  <info>  Read config: /etc/NetworkManager/NetworkManager.conf and conf.d: 20-connectivity-fedora.conf, 10-ibft-plugin.conf
2015-04-17 13:30:30 +02:00
Lubomir Rintel
aa672b2dc2 config: move dns mode configuration to NMConfigData
This will make is possible for the NMDnsManager to watch for
configuration changes.
2015-02-25 18:25:04 +01:00
Thomas Haller
c6778ad1b7 core: unify parsing of device specs using nm_match_spec_split()
There are three configuration options that contain device specs:
'main.ignore-carrier', 'main.no-auto-default', and
'keyfile.unmanaged-devices'.

Unify the parsing of them by splitting the device spec with
nm_match_spec_split(). This changes behavior for parsing of these
properties.

Also get rid of logging warnings when parsing 'keyfile.unmanaged-devices'.
2015-02-24 10:35:24 +01:00
Lubomir Rintel
bf6073b647 config: add configure and quit command line option
Useful for using the feature without having to hardcode it in configuration
(container set up scripts, development).

https://bugzilla.gnome.org/show_bug.cgi?id=744241
2015-02-16 18:14:25 +01:00
Thomas Haller
b49fdae59e config: fix memleak in read_config() 2015-02-09 11:51:05 +01:00
Thomas Haller
5b47462f32 config: use flags argument in config-changed signal instead of a hash table 2015-02-03 13:01:54 +01:00
Thomas Haller
cc46b182ed config: make NMConfig implement GInitable 2015-02-03 13:01:53 +01:00
Thomas Haller
13c7f6a56d config: move no-auto-default to NMConfigData
With this change, NMConfig is really immutable and all
modifyable parts migrated to NMConfigData.

Another advantage is that components can now subscribe to
NMConfig changes to pickup changes to no-auto-default.
2015-02-03 13:01:53 +01:00
Thomas Haller
49b3f5b8d9 config: refactor merging no_auto_default 2015-02-03 13:01:53 +01:00
Thomas Haller
ba74f9d242 config: move keyfile values to NMConfigData 2015-02-03 13:01:53 +01:00
Thomas Haller
045a576a7a config: add new function nm_config_data_diff() 2015-02-03 13:01:53 +01:00
Thomas Haller
56f5fba723 config: move main_file and description to NMConfigData
Every reload might change the main_file and description.
Move those properties to NMConfigData.
2015-02-03 13:01:53 +01:00
Thomas Haller
699b12ddc9 config: refactor reloading not to create a second NMConfig instance 2015-02-03 13:01:53 +01:00
Thomas Haller
83996c621c config: minor refactoring to highlight mutable property no_auto_default of NMConfig 2015-02-03 13:01:53 +01:00
Thomas Haller
64520b7ba4 config: refactor read_entire_config() to merge command line options 2015-02-03 13:01:53 +01:00
Thomas Haller
4429f8aea5 config: refactor to inject NMConfigCmdLineOptions to NMConfig constructor 2015-02-03 13:01:53 +01:00
Thomas Haller
40dc4c3242 config: refactor nm_config_new() by extracting function read_entire_config() 2015-02-03 13:01:53 +01:00
Thomas Haller
ef57828442 config: refactor nm_config_new() by extracting function _get_config_dir_files() 2015-02-03 13:01:53 +01:00
Thomas Haller
3714a6c7bd config/trivial: rename variables for configuration file
The name "nm_conf_path" and cli.config_path" were not consistent.
Rename them both to "config_main_file".
2015-02-03 13:01:53 +01:00
Thomas Haller
3c7f71e44a config: refactor read_config() to make it independent from NMConfig 2015-02-03 13:01:53 +01:00
Thomas Haller
b814c3122a config: implement reloading of connectivity parameters 2015-02-03 13:01:53 +01:00
Thomas Haller
82cfd5ad47 config: add support for reloading of configuration
No actual reloading is yet implemented. Later we will decide
on specific configuration parameters where we support reloading.
They must be then implemented one-by-one.

Some configuration parameters can be set via command line.
If a parameter is set from command line, the original value
from command line will still be preserved after reloading.
2015-02-03 13:01:53 +01:00
Thomas Haller
50fce5a860 config: use NMConfigData in NMConfig 2015-02-03 13:01:53 +01:00
Thomas Haller
1ff5154369 config: add nm_config_setup() to initialize config singleton
Make nm_config_new() usable without accessing static/singleton data.

nm_config_setup() is now used to initialize the singleton.
Still, you must not call nm_config_get() before calling
nm_config_setup() or after freeing the provided singleton
instance.
2015-02-03 13:01:53 +01:00
Thomas Haller
9387e8e8a7 config/trivial: fix returning FALSE instead of NULL in nm_config_new() 2015-02-03 13:01:53 +01:00
Thomas Haller
643f042b9b config: fix memory leak in merge_no_auto_default_state() 2015-02-03 13:01:53 +01:00
Thomas Haller
6519c2be0a config: fix memleak in read_config() 2015-01-29 14:59:42 +01:00
Dan Winship
3bfb163a74 all: consistently include config.h
config.h should be included from every .c file, and it should be
included before any other include. Fix that.

(As a side effect of how I did this, this also changes us to
consistently use "config.h" rather than <config.h>. To the extent that
it matters [which is not much], quotes are more correct anyway, since
we're talking about a file in our own build tree, not a system
include.)
2014-11-13 17:18:42 -05:00
Dan Williams
5149fd120d iface-helper: add nm-iface-helper for dynamic configure-then-quit support
When quitting, the Manager asks each device to spawn the interface helper,
which persists and manages dynamic address on the interface after NetworkManager
is gone.  If the dynamic address cannot be maintaned, the helper quits and
the interface's address may be removed when their lifetime runs out.

To keep the helper as simple as possible, NetworkManager passes most of the
configuration on the command-line, including some properties of the device's
current state, which are necessary for the helper to maintain DHCP leases
or IPv6 SLAAC addresses.
2014-11-07 12:18:33 -06:00
Dan Williams
a01e2ff91d core: add option to quit when startup is complete (rh #863515) (rh #1083683)
Cloud setups often have a never-changing setup and since every cycle counts,
they don't really want a management process running in the background after
network setup is complete.  Since it's likely a VM, it's not like links
are going to go up/down very often.

Add a new "configure-quit=true/false" config option which, when set to true,
will quit NetworkManager after startup and initial configuration is complete.
2014-11-07 12:18:33 -06:00
Thomas Haller
4545b6cb1e config: set a compile time default for the main.plugins configuration option
In case of a missing NetworkManager.conf (or a missing configuration option
main.plugins), allow to determine the fallback at compile time

https://bugzilla.gnome.org/show_bug.cgi?id=738611

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-29 15:17:55 +01:00
Thomas Haller
eabe7d856c auth: rework polkit autorization to use DBUS interface directly
This makes NetworkManager independent of <polkit/polkit.h>
development headers and libpolkit-gobject-1.so library.
Instead communicate directly with polkit using its DBUS
interface.

PolicyKit support is now always compiled in. You can control
polkit authorization with the configuration option
  [main]
  auth-polkit=yes|no

If the configure option is omitted, a build time default
value is used. This default value can be set with the
configure option --enable-polkit.

This commit adds a new class NMAuthManager that reimplements the
relevant DBUS client parts. It takes source code from the polkit
library.

https://bugzilla.gnome.org/show_bug.cgi?id=734146

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-09-29 13:51:11 +02:00
Thomas Haller
624e7deb47 config: refactor parsing of boolean config values
Allow for the special values "1" and "0". Also, ignore the
letter case when comparing the configuration value.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-09-29 13:00:10 +02:00
Dan Winship
b019348fdd core: update data types of some hwaddr properties
Now that we have nm_utils_hwaddr_matches() for comparing addresses
(even when one is a string and the other binary), there are now places
where it's more convenient to store hardware addresses as strings
rather than binary, since we want them in string form for most
non-comparison purposes. So update for that.

In particular, this also changes nm_device_get_hw_address() to return
a string.

Also, simplify the update_permanent_hw_address() implementations by
assuming that they will only be called once. (Since they will.)
2014-08-07 15:41:04 -04:00
Dan Winship
35f36ba4c3 libnm-core, etc: drop type-based hwaddr funcs, port to length-based ones
Drop the arptype-based nm_utils_hwaddr funcs, and rename the
length-based ones to no longer have _len in their names. This also
switches nm_utils_hwaddr_atoba() to using a length rather than an
arptype, and adds a length argument to nm_utils_hwaddr_valid() (making
nm_utils_hwaddr_valid() now a replacement for nm_utils_hwaddr_aton()
in some places, where we were only using aton() to do validity
checking).
2014-08-07 12:08:16 -04:00
Dan Winship
8aa3b9859b core: merge src/config, src/logging, src/posix-signals into src/
Some subdirectories of src/ encapsulate large chunks of functionality,
but src/config/, src/logging/, and src/posix-signals/ are really only
separated out because they used to be built into separate
sub-libraries that were needed either for test programs, or to prevent
circular dependencies. Since this is no longer relevant, simplify
things by moving their files back into the main source directory.
2014-07-30 15:56:29 -04:00
Dan Winship
53bd84feff config: move NMConfig into its own subdirectory/library
Also, remove the unused NMConfigError, and add a config-parsing test
program.
2013-04-03 10:23:47 -04:00
Jiří Klimeš
0e92228476 trivial: remove extra semicolons 2013-03-12 09:32:47 +01:00
Dan Williams
c636fe88e3 config: rename fill_from_file() to read_config() 2013-03-11 14:45:12 -05:00
Dan Williams
2e0fead744 config: fix bounds of connectivity_interval values
0 means "turn off connectivity checking", so we can't use that to
determine whether or not the interval has already been set by
command-line options or not.  Instead, store the interval
internally as a signed int and use -1 to mean "not yet set".

Second, validate input values for interval to ensure they can't
be less than 0 or more than G_MAXINT.
2013-03-11 14:45:11 -05:00
Jonh Wendell
06dca1b056 config: honor CLI arguments when config file is not found
If no config file was present, the Config object is returned empty
even if some options were passed via the command-line.
2013-03-11 14:44:47 -05:00
Dan Williams
f378c10e01 trivial: move NMConfig GObject functions to the bottom
More closely match the style of other objects in NM, where the
actual logic is nearer the top, and GObject stuff is near the bottom.
2013-03-11 14:44:46 -05:00
Thomas Bechtold
c910a52241 config: convert NMConfig to object 2013-03-11 14:43:24 -05:00
Dan Winship
d04f286327 all: remove pointless NULL checks
g_malloc(), etc, never return NULL, by API contract. Likewise, by
extension, no other glib function ever returns NULL due to lack of
memory. So remove lots of unnecessary checks (the vast majority of
which would have immediately crashed had they ever run anyway, since
g_set_error(), g_warning(), and nm_log_*() all need to allocate
memory).

https://bugzilla.gnome.org/show_bug.cgi?id=693678
2013-02-13 13:38:13 -05:00
Pavel Šimerda
d82669d3fd build: unify NetworkManager path handling (some paths are changed)
Use autoconf/automake variables for NetworkManager paths. Use
NetworkManager subdirectory where appropriate.

Files in /var/run (or /run on some distros) are moved into a separate
directory as is usual with other daemons. It makes the filesystem
more readable and file prefixing unnecessary.

/var/run/NetworkManager.pid -> /var/run/NetworkManager/NetworkManager.pid
/var/run/nm-dns-dnsmasq.pid -> /var/run/NetworkManager/dnsmasq.pid
/var/run/nm-dns-dnsmasq.conf -> /var/run/NetworkManager/dnsmasq.conf

The /var/run/NetworkManager directory is created at runtime, if it doesn't
exist.

Note: Path-based security policies like SELinux and AppArmor may need to
be adapted.
2012-11-05 14:01:47 +01:00