Commit graph

11635 commits

Author SHA1 Message Date
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
12a68c9e99 nm-remote-connection: take a reference to self while calling get_settings
(process:6888): GLib-GObject-WARNING **: invalid unclassed pointer in cast to 'GDBusProxy'

  Program received signal SIGTRAP, Trace/breakpoint trap.
  g_logv (log_domain=0x3149a3b224 "GLib-GObject", log_level=G_LOG_LEVEL_WARNING, format=<optimized out>, args=args@entry=0x7fffffffda70) at gmessages.c:1046
  1046              g_private_set (&g_log_depth, GUINT_TO_POINTER (depth));
  (gdb) bt
  #0  0x0000003148e50c70 in g_logv (log_domain=0x3149a3b224 "GLib-GObject", log_level=G_LOG_LEVEL_WARNING, format=<optimized out>, args=args@entry=0x7fffffffda70) at gmessages.c:1046
  #1  0x0000003148e50eaf in g_log (log_domain=log_domain@entry=0x3149a3b224 "GLib-GObject", log_level=log_level@entry=G_LOG_LEVEL_WARNING, format=format@entry=0x3149a42690 "invalid unclassed pointer in cast to '%s'") at gmessages.c:1079
  #2  0x0000003149a34171 in g_type_check_instance_cast (type_instance=type_instance@entry=0x6fc530, iface_type=<optimized out>) at gtype.c:4030
  #3  0x00007ffff7d6b016 in nmdbus_settings_connection_call_get_settings_finish (proxy=0x6fc530, out_settings=out_settings@entry=0x7fffffffdbb8, res=res@entry=0x6fe150, error=error@entry=0x0)
      at nmdbus-settings-connection.c:1303
  #4  0x00007ffff7ce8813 in updated_get_settings_cb (proxy=<optimized out>, result=0x6fe150, user_data=user_data@entry=0x6fc650) at nm-remote-connection.c:588
  #5  0x000000314a27640d in g_simple_async_result_complete (simple=0x6fe150 [GSimpleAsyncResult]) at gsimpleasyncresult.c:763
  #6  0x000000314a2df47c in reply_cb (connection=<optimized out>, res=0x6fe0e0, user_data=user_data@entry=0x6fe150) at gdbusproxy.c:2623
  #7  0x000000314a27640d in g_simple_async_result_complete (simple=0x6fe0e0 [GSimpleAsyncResult]) at gsimpleasyncresult.c:763
  #8  0x000000314a2d48cc in g_dbus_connection_call_done (source=<optimized out>, result=<optimized out>, user_data=user_data@entry=0x7fffec01a320) at gdbusconnection.c:5502
  #9  0x000000314a27640d in g_simple_async_result_complete (simple=0x6e5f40 [GSimpleAsyncResult]) at gsimpleasyncresult.c:763
  #10 0x000000314a27647c in complete_in_idle_cb (data=0x6e5f40) at gsimpleasyncresult.c:775
  #11 0x0000003148e49b6b in g_main_context_dispatch (context=0x687970) at gmain.c:3064
  #12 0x0000003148e49b6b in g_main_context_dispatch (context=context@entry=0x687970) at gmain.c:3663
  #13 0x0000003148e49f08 in g_main_context_iterate (context=0x687970, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3734
  #14 0x0000003148e4a232 in g_main_loop_run (loop=0x687a80) at gmain.c:3928
  #15 0x00000000004136a1 in main (argc=<optimized out>, argv=<optimized out>) at nmcli.c:632
  (gdb)

(cherry picked from commit 9d3b31e1ae)
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
Lubomir Rintel
4e6481cb73 release: bump version to 1.0.2 2015-05-05 13:35:36 +02:00
Lubomir Rintel
ec85912153 release: add CVE-2015-2924 to the NEWS 2015-05-05 13:35:36 +02:00
Lubomir Rintel
19c326ab91 build: don't drop libnm-util/nm-version.h on clean
Same behavior as for libnm-core/nm-version.h. It's created by configure,
not built with make. Removing it breaks 'make clean; make'

(cherry picked from commit aa5cfdd7e1)
2015-05-05 13:35:36 +02:00
Lubomir Rintel
1a53c7f2e6 build: work around automake-1.15 & intltool complaining about translations in build dir
make distcheck runs a build in dist directory subtirs and then runs intltool -m
which in turn complains about translations in a built file:

  The following files contain translations and are currently not in use. Please
  consider adding these to the POTFILES.in file, located in the po/ directory.

  sub/policy/org.freedesktop.NetworkManager.policy.in

The issue is reported to intltool upstream already:
https://bugs.launchpad.net/intltool/+bug/1117944

(cherry picked from commit 66c3b673e3)
2015-05-05 13:35:36 +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
Thomas Haller
7f13cb6acb test: fix parsing of command line arguments for setting nmtst_test_quick()
glib interprets the options either as "-m arg" or "-m=arg". Fix parsing
to check for both cases.

Also, g_test_init() removes the parsed options from argv, hence we must
check our original copy in __nmtst_internal.orig_argv.

Now the following all have the same outcome:

  $ NMTST_DEBUG=no-debug,quick ./src/rdisc/tests/test-rdisc-fake
  $ ./src/rdisc/tests/test-rdisc-fake -m quick
  $ ./src/rdisc/tests/test-rdisc-fake -m=quick

Fixes: a2edd6445f
(cherry picked from commit f529fedd17)
2015-05-04 09:18:21 +02:00
Dan Williams
d3ae05b765 trivial: update .gitignore for new rdisc tests
(cherry picked from commit e52dac9887)
2015-05-01 16:49:08 -05:00
Dan Williams
cd7207c31d merge: fix continuous router solicitation loop issue with DNS expiry (rh #1207730) (bgo #748085) 2015-05-01 16:19:13 -05: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
1bd99ff273 test: add nmtst_test_quick()
Utility function for long-running tests to check whether
they should run. It has the same use as g_test_quick(),
but it can also be set via NMTST_DEBUG environment variable.

You can set the compile time default via

  CFLAGS='-DNMTST_TEST_QUICK=FALSE' ./configure

and overwrite it at runtime via

  NMTST_DEBUG=no-default,quick ./tests/test-my
2015-05-01 15:59:00 -05:00
Thomas Haller
a8d3cf55c4 test: add EXIT_SKIP define 2015-05-01 15:50:20 -05:00
Thomas Haller
90d39cea24 merge branch 'logging-refact' into nm-1-0
Backport some refactoring on the logging functions
from master.
2015-04-29 15:17:27 +02: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