Commit graph

12588 commits

Author SHA1 Message Date
Thomas Haller
b8cb56eda7 core: declare nm_agent_manager_get() using NM_DEFINE_SINGLETON_GETTER()
Also move the initilization of the instance into the constructed()
method.

NMAgentManager now owns a reference to the DBUS manager and Auth
manager and the dispose() function properly unregisters itself from
both.

(cherry picked from commit 3af40acf31)
2015-12-01 13:17:23 +01:00
Thomas Haller
9c280a9a73 core: declare nm_supplicant_manager_get() using NM_DEFINE_SINGLETON_GETTER()
(cherry picked from commit d45c1b84f4)
2015-12-01 13:16:58 +01:00
Thomas Haller
cbe410e560 core: declare nm_firewall_manager_get() using NM_DEFINE_SINGLETON_GETTER()
(cherry picked from commit 22409e0481)
2015-12-01 13:14:01 +01:00
Thomas Haller
53737e87e2 core: declare nm_inotify_helper_get() using NM_DEFINE_SINGLETON_GETTER()
Refactor NMInotifyHelper to implement the singleton getter using
NM_DEFINE_SINGLETON_GETTER().

For one this means that the getter no longer increments the reference
count. This was anyway wrong, because no caller of nm_inotify_helper_get()
unrefered the returned reference, hence leaking the singleton.

Also, the getter can no longer fail to create the singleton instance.
Note that none of the callers actually coped with a failure to get
the singleton.
Instead return an instance that does nothing.
One downside (upside?) of this is that we only try once to initialize
the inotify handle.

(cherry picked from commit f4bf50bf4a)
2015-12-01 13:11:06 +01:00
Thomas Haller
6cb1cea4c1 core: declare nm_vpn_manager_get() using NM_DEFINE_SINGLETON_GETTER()
(cherry picked from commit e2739cfc1b)
2015-12-01 13:10:28 +01:00
Thomas Haller
4ab08c3e45 core: declare nm_dhcp_manager_get() using NM_DEFINE_SINGLETON_GETTER()
(cherry picked from commit fc575d6783)
2015-12-01 13:07:05 +01:00
Thomas Haller
7fcb56eaba core: declare nm_dns_manager_get() using NM_DEFINE_SINGLETON_GETTER()
(cherry picked from commit e439637ada)
2015-12-01 13:01:37 +01:00
Thomas Haller
0b654d984c core: declare nm_sleep_monitor_get() using NM_DEFINE_SINGLETON_GETTER()
Also no longer increment the reference count in the getter and
properly disconnect the signals in NMManager:dispose().

Also use the defines for the signal names instead of plain strings.

(cherry picked from commit a8ebd1aa1a)
2015-12-01 12:57:42 +01:00
Jiří Klimeš
816762515b wifi: only try adding supplicant interface 5 times on errors (bgo #753971)
When wpa_supplicant keeps returning an error, NetworkManager was trying over
and over again. Which resulted in endless messages:
<error> [1448462154.584916] [supplicant-manager/nm-supplicant-interface.c:879] interface_add_cb(): (AAA): error adding interface: wpa_supplicant couldn't grab this interface.
NetworkManager[17073]: <info>  (AAA): supplicant interface state: starting -> down

Testcase:
$ iw list | grep -A 3 "interface combinations"
	interface combinations are not supported
	HT Capability overrides:
		 * MCS: ff ff ff ff ff ff ff ff ff ff
		 * maximum A-MSDU length
$ sudo iw wlan0 interface add AAA type managed
...
$ sudo iw dev AAA del

Fixes: 3a2e6de0d3

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

(cherry picked from commit 7e93ceb640)
2015-11-30 15:00:44 +01:00
Jiří Klimeš
717b494a00 cli: fix an error in setting s390-options in nmcli editor
nmcli> set eth.s390-options portno=
(process:4711): libnm-CRITICAL **: nm_setting_wired_add_s390_option: assertion 'value_len > 0 && value_len < 200' failed

(cherry picked from commit 6ffe4b61f7)
2015-11-28 19:56:27 +01:00
Jiří Klimeš
00bfaa4ed7 cli: fix an error in nmcli editor when setting vpn.data/vpn.secrets
nmcli> set vpn.data haha=
(process:3951): libnm-CRITICAL **: nm_setting_vpn_add_data_item: assertion 'strlen (item) > 0' failed
nmcli> set vpn.secrets haha=
(process:3951): libnm-CRITICAL **: nm_setting_vpn_add_secret: assertion 'strlen (secret) > 0' failed

(cherry picked from commit 5f9b8b887d)
2015-11-28 19:56:20 +01:00
Thomas Haller
9012e61bfb platform/tests: drop "platform" test binary
"platform" implements a iproute2 like command-line
tool based on NMPlatform.

It is badly maintained and mostly unused. If we want
to test something, we should write tests that are run
automatically during `make check`. Manual tests just
don't fly.

(cherry picked from commit f122879c83)
2015-11-27 15:55:01 +01:00
Thomas Haller
84c01376ea platform/tests: remove "dump" test-program
The program ran over the platform links and printed them.
Our to-string methods of platform objects are already supposed
to print all fields. So this only duplicates code to print a link.

If you want to see what links were picked up by platfrom run:

  NMTST_DEBUG=log-level=TRACE ./src/platform/tests/monitor

or just

  ./src/platform/tests/monitor

Yes, this has less the iproute2 feeling, but it gives you a more
native access to the platform objects -- which is what you want
for debugging platform.

(cherry picked from commit d13d17f84a)
2015-11-27 15:54:22 +01:00
Thomas Haller
55403cd032 nmtst: refactor NMTST_BUSY_WAIT() and rename to NMTST_WAIT*()
(cherry picked from commit 998772805c)
2015-11-27 15:53:12 +01:00
Thomas Haller
a950a54516 test: add NMTST_BUSY_WAIT() util
(cherry picked from commit 4eb48d8c87)
2015-11-27 15:52:12 +01:00
Thomas Haller
61fd1ecf5c nmtst: support shorthand "NMTST_DEBUG=TRACE" to set logging level
(cherry picked from commit c97f7b54fe)
2015-11-27 15:49:34 +01:00
Jiří Klimeš
2149db231d clients: (trivial) remove unused commented code in nm-vpn-helpers
(cherry picked from commit 191f213c49)
2015-11-26 15:01:16 +01:00
Jiří Klimeš
50867ad4e4 clients: move clients/tui/vpn-helpers.c to clients/common/nm-vpn-helpers.c
The file has not been used up to now. But it is going to be used by both
nmtui and nmcli later.

(cherry picked from commit b8d6bd1a98)
2015-11-26 15:01:08 +01:00
Beniamino Galvani
d1be467d38 ip4-config: properly handle gateway in nm_ip4_config_replace()
When @src didn't have a gateway and @dst did, the function left @dst's
gateway set to 0.0.0.0; fix this and unset the gateway in such case.

Fixes: 063677101a
(cherry picked from commit d1a776bff9)
2015-11-26 10:13:10 +01:00
Thomas Haller
b776301662 platform/tests: use "nm-test-utils.h" in "monitor.c"
This gives us a way to externally configure the logging level like:

  NMTST_DEBUG=log-level=TRACE ./src/platform/tests/monitor

(cherry picked from commit ca8e40e1dc)
2015-11-25 15:16:04 +01:00
Jiří Klimeš
c7cb2e8c1c clients: check errors of polkit_unix_session_new_for_process_sync()
polkit_unix_session_new_for_process_sync() can fail. And calling
polkit_agent_listener_register() with NULL PolkitSubject results in errors.

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

(cherry picked from commit 542200f539)
2015-11-25 12:14:02 +01:00
Thomas Haller
be8619261d core: don't handle SIGUSR1 and SIGUSR2 signals for pre 2.36.0 glib
https://bugzilla.gnome.org/show_bug.cgi?id=758614

Reported-by: Glenn Washburn <development@efficientek.com>
(cherry picked from commit 8aab22fe45)
2015-11-25 10:58:22 +01:00
Thomas Haller
5196e53071 nm-glib: add nm_glib_check_version() util
(cherry picked from commit 4c4b67e515)
2015-11-25 10:58:18 +01:00
Glenn Washburn
061b7bbde8 dhcp-helper: call g_type_init() to support pre 2.36.0 glib
https://bugzilla.gnome.org/show_bug.cgi?id=758614

(cherry picked from commit 7a97d16944)
2015-11-25 10:57:12 +01:00
Fran Diéguez
ad572bedbe po: updated Galician (gl) translation (bgo #758631)
Some errors fixed by Jiri Klimes

https://bugzilla.gnome.org/show_bug.cgi?id=758631
2015-11-25 09:51:35 +01:00
Jiří Klimeš
a261e9c3e5 device: use nm_utils_find_helper() to find out ping/ping6 binary (bgo #758566)
https://bugzilla.gnome.org/show_bug.cgi?id=758566

(cherry picked from commit 795a3943ea)
2015-11-24 14:35:46 +01:00
Thomas Haller
1e7d952731 tests: merge branch 'th/test-run-valgrind'
(cherry picked from commit 5276f6896b)
2015-11-24 11:15:27 +01:00
Thomas Haller
f29aee87ec nmtst/valgrind: allow calling 'run-test-valgrind.sh' script directly
When you want to run valgrind for a test, you either had to
invoke valgrind manually, or doing it via `make check` (provided
you configured --with-valgrind).

Make it more convenient to run valgrind by passing the test
to run to the "run-test-valgrind.sh" wrapper.

This also allows to pass -p/-s to the test, which is not possible
during `make check` because selecting tests conflicts with "--tap".
The following invocations are largely equivalent and work as
expected:

  $ ./tools/run-test-valgrind.sh ./src/platform/tests/test-link-linux -p /link/software/detect/vlan

  $ NMTST_DEBUG=no-debug,p=/link/software/detect/vlan ./tools/run-test-valgrind.sh ./src/platform/tests/test-link-linux

(cherry picked from commit 4dacf0b1ad)
2015-11-24 11:14:50 +01:00
Thomas Haller
243d0facb8 nmtst: support -p and -s arguments from gtestutils via $NMTST_DEBUG
For tests based on glib's test framework, you can select which tests to
run by passing -p/-s on the command line.

Usually, we want to invoke our tests via `make check` which conveniently
calls valgrind (run-test-valgrind.sh) or spawns a private D-Bus server
(libnm-test-launch.sh, libnm-glib-test-launch.sh). At that point, it is
not directly possible to specify command line arguments for the tests,
which is why it is convenient to specify arguments via $NMTST_DEBUG
environment variable.

Parse "p" and "s" arguments from $NMTST_DEBUG and pass them to g_test_init()
to select which tests to run.

  NMTST_DEBUG=p=/core/general/test_setting_ip4_changed_signal ./libnm-core/tests/test-general

However, there is a problem here: in gtestutils, -p/-s conflicts with --tap,
which is how our Makefile invokes the tests. Thus the new options explicitly
don't work when being called during `make check`. Which makes this much
less useful. I only noticed that afterwards, so still keep the patch
because it might still be convenient during developing tests to set the
environment variable once, and then repeatedly spawn the tests, without
specifying -p/-s.

(cherry picked from commit 73cb579108)
2015-11-24 11:14:48 +01:00
Thomas Haller
7eed71d860 nmtst: pass -m=quick when specifying quick test in $NMTST_DEBUG
When the environment variable indicates that we want to run quick
tests, pass "-m=quick" to g_test_init().

(cherry picked from commit a6a2fd7eef)
2015-11-24 11:14:47 +01:00
Thomas Haller
8bdb2aaeea nmtst: detect whether the test runs as tap test
Same as gtestutils does, look for --tap command line argument.

(cherry picked from commit c8174f0f9f)
2015-11-24 11:14:46 +01:00
Thomas Haller
c3aafd9dab nmtst: initialize g_test_init() after parsing NMTST_DEBUG
(cherry picked from commit 5031fc3c71)
2015-11-24 11:14:42 +01:00
Lubomir Rintel
dd32d973b0 release: bump version to 1.0.9 (development) 2015-11-23 18:03:04 +01:00
Lubomir Rintel
faea1ff074 release: bump version to 1.0.8 2015-11-23 17:54:42 +01:00
Thomas Haller
0414e61e9a main: add argument --print-config to NetworkManager
(cherry picked from commit e1ea4b725e)
2015-11-22 13:46:21 +01:00
Lubomir Rintel
2c7ea3d7c3 release: update NEWS 2015-11-20 19:56:34 +01:00
Thomas Haller
0178baea2c default-route: fix deleting default-route when disconnecting device (bgo #757587)
When deconfiguring a device, we must also explicitly clear the
default-route -- unless the device was assumed.

This can easily reproduced by disconnecting the cable from the
wired connection that has the default rout. Prevously, the
default-route was not cleared and lingered around.

https://bugzilla.gnome.org/show_bug.cgi?id=757587
(cherry picked from commit c2831875e3)
2015-11-20 15:26:12 +01:00
Thomas Haller
c8d688874f default-route: introduce _LOG2*() logging macros to log entry-messages
(cherry picked from commit 661ce49973)
2015-11-20 15:24:25 +01:00
Thomas Haller
1bfd5b098d logging: introduce an alternative set of logging macros
We already have the macros _LOGD(), _LOGI(), etc. to provide context sensitive
logging (such as printing the object pointer as prefix).

In some implementations, we would like to have a second set of logging
macros, that shall be used differently. For example, use the default
_LOGD() for messages that are explicitly issued by one objects, and use
_LOG2D() in a static context when no object is around.

The "_LOG2" prefix is not great from a naming point of view. However, it is
meant to be a second (alternative) set of logging macros with the same
usage pattern as the _LOGD() macros.

(cherry picked from commit ed5ebf7e74)
2015-11-20 15:24:25 +01:00
Thomas Haller
4297db4f4c macros: add nm_sprintf_buf() helper macro
(cherry picked from commit abd607257b)
2015-11-20 15:15:18 +01:00
Anders Jonsson
05acff5507 po: update Swedish (sv) translation (bgo #758366)
https://bugzilla.gnome.org/show_bug.cgi?id=758366
2015-11-20 09:24:24 +01:00
Jiří Klimeš
1d4a5b9c8b wifi: do update BSSID cache in activation_success_handler() (rh #1094298)
Even if update_seen_bssids_cache() is called by set_current_ap() it did not
really update the cache because it was called in NM_DEVICE_STATE_PREPARE state.
So the cache was only updated by periodic_update() when the connection roamed
to another AP.

Fixes: 1283816b41

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

(cherry picked from commit d4ebffcfb9)
2015-11-19 14:52:49 +01:00
Thomas Haller
dc54bb31f8 valgrind: add suppression for glib's g_thread_return()
(cherry picked from commit 47008aaaf9)
2015-11-18 12:17:27 +01:00
Thomas Haller
f3491f0c83 valgrind: update suppression file for glib's thread pool
(cherry picked from commit 8c01dc59f8)
2015-11-18 12:16:42 +01:00
Jiří Klimeš
3650cff2a1 ifcfg: fix a possible double-free error on invalid WEP key (rh #1281324)
https://bugzilla.redhat.com/show_bug.cgi?id=1281324

(cherry picked from commit f902444325)
2015-11-18 09:22:41 +01:00
Jiří Klimeš
09d34ac02d nm-online: do not put \r to a translatable string (bgo #758102)
msgmerge complains with
"warning: internationalized messages should not contain the '\r' escape sequence"

Found by Anders Jonsson <anders.jonsson@norsjovallen.se>

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

(cherry picked from commit 2c8c4ce2e4)
2015-11-16 15:26:15 +01:00
Jiří Klimeš
85a52fc1b1 all: fix typos in the code and update translations for that (bgo #758102)
Found by Anders Jonsson <anders.jonsson@norsjovallen.se>

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

(cherry picked from commit b92397f925)
2015-11-16 14:42:30 +01:00
Milo Casagrande
8109b084a0 po: update Italian (it) translation (bgo #758103)
https://bugzilla.gnome.org/show_bug.cgi?id=758103
2015-11-16 13:16:52 +01:00
Piotr Drąg
84c7a9c794 po: update Polish (pl) translation (bgo #758067)
https://bugzilla.gnome.org/show_bug.cgi?id=758067

(cherry picked from commit ec46ddf113)
2015-11-16 13:05:57 +01:00
Beniamino Galvani
46f741cce4 libnm-core/tests: fix bit shift
Use a maximum shift amount of 63 for guint64.

Fixes: 0a3c1f5774
(cherry picked from commit ac78c18855)
2015-11-15 11:18:51 +01:00