Commit graph

5794 commits

Author SHA1 Message Date
Thomas Haller
0ca82739d5 config: move main_file and description to NMConfigData
Every reload might change the main_file and description.
Move those properties to NMConfigData.

(cherry picked from commit 56f5fba723)
2015-05-05 16:51:21 +02:00
Thomas Haller
30a4786468 config: refactor reloading not to create a second NMConfig instance
(cherry picked from commit 699b12ddc9)
2015-05-05 16:51:15 +02:00
Thomas Haller
c2d7454760 config: minor refactoring to highlight mutable property no_auto_default of NMConfig
(cherry picked from commit 83996c621c)
2015-05-05 16:51:10 +02:00
Thomas Haller
8ba5e062b2 config: refactor read_entire_config() to merge command line options
(cherry picked from commit 64520b7ba4)
2015-05-05 16:51:05 +02:00
Thomas Haller
f166c007fb config: refactor to inject NMConfigCmdLineOptions to NMConfig constructor
(cherry picked from commit 4429f8aea5)
2015-05-05 16:51:00 +02:00
Thomas Haller
ca6f06d069 config: refactor nm_config_new() by extracting function read_entire_config()
(cherry picked from commit 40dc4c3242)
2015-05-05 16:50:55 +02:00
Thomas Haller
cfc435be0b config: refactor nm_config_new() by extracting function _get_config_dir_files()
(cherry picked from commit ef57828442)
2015-05-05 16:50:50 +02:00
Thomas Haller
83edb5aee3 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".

(cherry picked from commit 3714a6c7bd)
2015-05-05 16:50:25 +02:00
Thomas Haller
67c4398170 config: refactor read_config() to make it independent from NMConfig
(cherry picked from commit 3c7f71e44a)
2015-05-05 16:50:20 +02:00
Thomas Haller
244cc0171a config: implement reloading of connectivity parameters
(cherry picked from commit b814c3122a)
2015-05-05 16:50:15 +02:00
Thomas Haller
b18de2309a connectivity: make NMConnectivity independent of NMConfig
(cherry picked from commit ac9dd4c832)
2015-05-05 16:50:10 +02:00
Thomas Haller
63293bba19 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.

(cherry picked from commit 82cfd5ad47)
2015-05-05 16:50:03 +02:00
Thomas Haller
3a5fb56b60 config: add handler for SIGHUP and a reload-configuration stub
(cherry picked from commit d62022e28a)
2015-05-05 16:49:58 +02:00
Thomas Haller
a56fe5ae0c config: use NMConfigData in NMConfig
(cherry picked from commit 50fce5a860)
2015-05-05 16:49:51 +02:00
Thomas Haller
5a7506a405 config: add new NMConfigData class
The NMConfig class should be immutable and its properties should
not change, with one exception: the NMConfigData property.

Later, when changing/reloading a configuration, NMConfig will only swap
the NMConfigData instance.

The NMConfigData instance itself is also immutable.

(cherry picked from commit 076478505d)
2015-05-05 16:49:44 +02:00
Thomas Haller
b4ad7434a8 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.

(cherry picked from commit 1ff5154369)
2015-05-05 16:49:38 +02:00
Thomas Haller
d165559ef2 config/trivial: fix returning FALSE instead of NULL in nm_config_new()
(cherry picked from commit 9387e8e8a7)
2015-05-05 16:49:31 +02:00
Thomas Haller
0799617515 config: forward declare NMConfig in nm-types.h
(cherry picked from commit 86ac1ad7bd)
2015-05-05 16:49:24 +02:00
Thomas Haller
9d5b4baf36 connectivity: add logging macros to nm-connectivity.c
They add a common prefix to all logging lines.

(cherry picked from commit 3ed4aa271a)
2015-05-05 16:49:18 +02:00
Thomas Haller
b4d7ac70f2 connectivity: refactor handling parameters of NMConnectivity
Currently the three parameters for the connectivity check (uri, interval, response)
don't get reset. Soon they might be modified at any time when reloading the
configuration.

When calling the asynchronous HTTP connectivity check, we want to
preserve the original parameters so that the result callback still can
access them later. Pass the uri and response parameter on as
ConCheckCbData.

(cherry picked from commit 5ee18c124b)
2015-05-05 16:49:11 +02:00
Thomas Haller
fc6f45e42a connectivity: refactor converting connectivity states to string
(cherry picked from commit 78e3b4866a)
2015-05-05 16:49:01 +02:00
Thomas Haller
6f4bf2818a connectivity: add missing G_PARAM_CONSTRUCT for NM_CONNECTIVITY_URI property
(cherry picked from commit a79e9fdbb0)
2015-05-05 16:48:49 +02:00
Thomas Haller
da87866882 connectivity/trivial: fix white space and line-break in nm-connectivity.c
(cherry picked from commit 7aab5bc81c)
2015-05-05 16:48:40 +02:00
Thomas Haller
5929a4cbec connectivity: make NMConnectivity:dispose() reentrant
(cherry picked from commit 3dce101f6b)
2015-05-05 16:48:35 +02:00
Thomas Haller
72d06eb9c8 connectivity: add code comment to nm_connectivity_check_cb()
(cherry picked from commit 6cb5db60de)
2015-05-05 16:48:22 +02:00
Dan Williams
1d8a2a2662 settings: remove 'do_export' argument from claim_connection()
It was always TRUE, and unused anyway.

(cherry picked from commit bbcf5444fd)
2015-05-05 16:37:06 +02:00
Dan Williams
de9a34cc42 settings/dbus: harden connection removal and object unexport
None of these functions was checking if the same operation had already
been performed, or if the object being removed/unexported was known.

(cherry picked from commit fe96dbc0ee)
2015-05-05 16:37:06 +02:00
Lubomir Rintel
89d96b87d8 manager: don't try to delete generated connection if it's already gone
Move the cleanup of the generated assumed connection to active connection
dispose. If the connection vanishes earlier (explicit deletion from client),
tear down the reference so that we don't try to remove it redundantly.

  NetworkManager[9221]: <info>  (eth2): device state change: deactivating -> disconnected (reason 'connection-removed') [110 30 38]
  NetworkManager[9221]: <info>  (eth2): deactivating device (reason 'connection-removed') [38]

  (NetworkManager:9221): GLib-GObject-WARNING **: g_object_weak_unref: couldn't find weak ref 0x496610(0x7c2ba0)

  Program received signal SIGTRAP, Trace/breakpoint trap.
  g_logv (log_domain=0x7ffff4d4f1a4 "GLib-GObject", log_level=G_LOG_LEVEL_WARNING, format=<optimized out>, args=args@entry=0x7fffffffd860) at gmessages.c:1046
  1046              g_private_set (&g_log_depth, GUINT_TO_POINTER (depth));
  (gdb) bt
  #0  0x00007ffff4a2cc60 in g_logv (log_domain=0x7ffff4d4f1a4 "GLib-GObject", log_level=G_LOG_LEVEL_WARNING, format=<optimized out>, args=args@entry=0x7fffffffd860) at gmessages.c:1046
  #1  0x00007ffff4a2ce9f in g_log (log_domain=<optimized out>, log_level=<optimized out>, format=<optimized out>) at gmessages.c:1079
  #2  0x000000000049780b in nm_dbus_manager_unregister_object (self=0x7c2ba0 [NMDBusManager], object=0x80f3e0) at nm-dbus-manager.c:921
  #3  0x000000000047cc83 in nm_settings_connection_signal_remove (self=self@entry=0x80f3e0 [NMIfcfgConnection]) at settings/nm-settings-connection.c:1752
  #4  0x000000000047cd22 in do_delete (connection=0x80f3e0 [NMIfcfgConnection], callback=0x479d60 <ignore_cb>, user_data=0x0) at settings/nm-settings-connection.c:687
  #5  0x00000000004b1eb6 in active_connection_remove (self=self@entry=0x8701c0 [NMManager], active=active@entry=0x8b02f0) at nm-manager.c:292
  #6  0x00000000004b2174 in _active_connection_cleanup (user_data=<optimized out>) at nm-manager.c:316
  #7  0x00007ffff4a25aeb in g_main_context_dispatch (context=0x7be3a0) at gmain.c:3111
  #8  0x00007ffff4a25aeb in g_main_context_dispatch (context=context@entry=0x7be3a0) at gmain.c:3710
  #9  0x00007ffff4a25e88 in g_main_context_iterate (context=0x7be3a0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3781
  #10 0x00007ffff4a261b2 in g_main_loop_run (loop=0x7be460) at gmain.c:3975
  #11 0x0000000000432f55 in main (argc=1, argv=0x7fffffffded8) at main.c:460
  (gdb)

https://bugzilla.gnome.org/show_bug.cgi?id=744812
(cherry picked from commit 74ed416d84)
2015-05-05 16:37:06 +02:00
Lubomir Rintel
a4369ef841 nm-settings: add nm_settings_has_connection()
Useful for checking if a connection is already deleted.

https://bugzilla.gnome.org/show_bug.cgi?id=744812
https://bugzilla.redhat.com/show_bug.cgi?id=1174164
(cherry picked from commit 8a00bb36ec)
2015-05-05 16:37:06 +02:00
Lubomir Rintel
5359322b6d bond: allow overriding the MTU
Set the MTU if 802-3-ethernet.mtu is present and non-zero. The ifcfg-rh writer
sets it if there's a MTU key.

https://bugzilla.redhat.com/show_bug.cgi?id=1177582
(cherry picked from commit a169a79a7d)
2015-05-05 16:37:06 +02:00
Lubomir Rintel
6a8a4d0c28 nm-device: avoid improper IPv6 MTU configuration
Ensure it's always (before address configuration starts and on updates) >= 1280
and not higher than the device MTU.

(cherry picked from commit fbf3a93c6bb88632ca4c8480ddbd04ca1dee151a)
2015-05-05 16:37:06 +02:00
Lubomir Rintel
9b79e6c732 nm-device: move device MTU setting from IP4Config to NMDevice
Just a refactoring, no functional change. This will make it easier to
coordinate the device MTU with IPv6 MTU.

(cherry picked from commit 86696e17fd205de91e36998d524584335163d32b)
2015-05-05 16:37:06 +02:00
Lubomir Rintel
777482aa82 nm-device: set ipv6 mtu at config commit time
Just a refactoring, doesn't make any actual difference. It is consistent with
IPv4 and will make it easier to implement a policy to recover from incorrect
MTUs settings.

(cherry picked from commit f77784b0fdf8abb1e3c796ffc4c2b6c624f17b18)
2015-05-05 16:37:06 +02:00
Thomas Haller
4c9f0fc2ab platform: fix memleak in build_rtnl_addr() using wrong put() method
'struct nl_addr' and 'struct nl_object' have non-compatible put()
functions.

(cherry picked from commit 76ba548959)
2015-05-05 04:20:22 +02:00
Yuri Chornoivan
1588a14a8b fix typo and do not translate an empty string
https://bugzilla.gnome.org/show_bug.cgi?id=748906
(cherry picked from commit f851a741a6)

Conflicts:
	libnm-core/nm-keyfile-reader.c
2015-05-04 18:39:50 +02:00
Dan Williams
d96b05bd36 rdisc: prevent solicitation loop for expiring DNS information (rh #1207730) (rh #1151665)
A solicitation loop could result for two cases:

1) a router sent DNS information, then removed that information without
sending it with lifetime=0
2) two routers exist, one sending DNS information and the other not, and
the first router which sends DNS information disappears

In these cases a solicitation would be generated when the DNS information
reached 1/2 its lifetime.  A router would then reply to the solicitation
without DNS information, which would then trigger another lifetime check,
which finds that the DNS info is still 1/2 lifetime.  Which triggers
another solicitation, etc.

Fix this by ensuring that a solicitation is never sent less than
rtr_solicitation_interval seconds after the last one.
2015-05-01 16:01:16 -05:00
Dan Williams
415b7b3e25 rdisc: fix double-addition of gateways & routes if priority increases
If a route or gateway's priority increased, the item would be added
to the array again without removing the older entry.  At the same time
don't bother adding an item with a zero lifetime, since it will just
be removed again by the clean_* functions.
2015-05-01 16:01:16 -05:00
Dan Williams
39fd8f7683 rdisc: split fake & linux test code; add testcases 2015-05-01 16:01:16 -05:00
Dan Williams
272943db4b rdisc: fix leak of DNS domains 2015-05-01 15:59:01 -05:00
Dan Williams
0be3678466 rdisc: move most RA processing logic into base class
Instead of having it all in the Linux implementation, move all the
timeout logic and most of the processing logic into the NMRDisc
base class so that it can be used by NMFakeRDisc as well. This
will help increase testability since now we can test the timeout
and expiry logic from the fake plugin too.
2015-05-01 15:59:01 -05:00
Dan Williams
5955f82f01 rdisc: add missing chain up to parent finalize/dispose 2015-05-01 15:59:01 -05:00
Thomas Haller
65b074164e logging: use _nm_log() to avoid duplicate check of whether logging is enabled
Use _nm_log() in places that already checked whether logging
is enabled. No need to check again as done by nm_log().

(cherry picked from commit 4526b55a51)

Conflicts:
	src/nm-route-manager.c
2015-04-29 15:15:39 +02:00
Thomas Haller
6d8d567444 logging: add logging macro _nm_log() that logs unconditionally
(cherry picked from commit fb9f8c69f7)
2015-04-29 15:15:19 +02:00
Thomas Haller
96c3f7b39f logging/trivial: rename _nm_log() to _nm_log_impl()
The actual logging implementation is not supposed to be called
directly, because there are macros that capture the call site
information __FILE__, __LINE__, and G_STRFUNC.

Rename the function to make clear that this is the actual
implementation.

(cherry picked from commit 211d241ab0)

Conflicts:
	src/dhcp-manager/systemd-dhcp/nm-sd-adapt.h
2015-04-29 15:15:17 +02:00
Thomas Haller
97f9b03119 logging: ensure that the first argument of the logging statement is a C string
We don't want to pass unknown format strings to the logging
macro. Catch that by concatenating "" with the format string.

(cherry picked from commit 2458ddf5e9)
2015-04-29 15:13:59 +02:00
Thomas Haller
2f53e0dfbc logging: always pass a static format string to logging functions
(cherry picked from commit bdec5e2e53)
2015-04-29 15:13:59 +02:00
Thomas Haller
b3cae064d1 ibft/logging: don't localize logging stagements
We don't localize any other nm-logging messages either.

(cherry picked from commit b04c99da0b)
2015-04-29 15:13:50 +02:00
Thomas Haller
edeaccc9eb logging: add error argument to _nm_log() to support "%m" format specifier
A gnu extension to printf adds the format specifier "%m"
to print @errno. To preserve the error number until the
point where the logging statement is constructed, pass
it as an additional argument to _nm_log().

This is not (yet) used from NM internal code. But systemd is adding
similar functionality to its logging functions. Add the same also to
nm-logging, to support systemd's usage of "%m".

(cherry picked from commit 5162426d41)
2015-04-29 15:12:45 +02:00
Thomas Haller
6e8c5b51b1 platform: don't accept lowering IPv6 hop-limit from RA (CVE-2015-2924)
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=6fd99094de2b83d1d4c8457f2c83483b2828e75a
http://seclists.org/oss-sec/2015/q2/46
https://bugzilla.redhat.com/show_bug.cgi?id=1209902
https://bugzilla.redhat.com/show_bug.cgi?id=1209903
(cherry picked from commit bdaaf9849b)

Conflicts:
	src/nm-iface-helper.c
	src/platform/nm-platform.h
2015-04-29 14:28:57 +02:00
Jiří Klimeš
a658561be9 platform: use driver name to detect IBM z-System CTC devices (rh #1212118)
We used to detect CTC devices according to the interface name. But that does
not work anymore due to systemd renaming the devices.
Let's use driver name for the detection instead. The driver is called 'ctcm'.

http://www-01.ibm.com/support/knowledgecenter/linuxonibm/com.ibm.linux.z.lgdd/lgdd_r_mpc_setup.html

https://bugzilla.redhat.com/show_bug.cgi?id=1212118

(cherry picked from commit 02c6a93343)
2015-04-29 13:28:58 +02:00