Commit Graph

10267 Commits

Author SHA1 Message Date
Thomas Haller
043ab29ca9 nmtst: add assertion functions for verify() connection
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:30 +02:00
Thomas Haller
80e1b05c31 nmtst: add nmtst_assert_connection_equals() function
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:30 +02:00
Thomas Haller
0da0293f7e nmtst: add nmtst_connection_normalize() function
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:30 +02:00
Thomas Haller
e478d1fb71 all: use _nm_utils_hash_values_to_slist()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:24:30 +02:00
Thomas Haller
ff142ce780 libnm-core: add _nm_utils_hash_values_to_slist()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:22:16 +02:00
Thomas Haller
d299c425d4 libnm: move declaration of NM_SETTING_SECRET_FLAGS_ALL to nm-core-internal.h
As NM_SETTING_SECRET_FLAGS_ALL is used in libnm/nm-vpn-plugin-utils.c,
it is exposed as internal API and should be declared in
nm-core-internal.h.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:22:16 +02:00
Thomas Haller
8fe1b79012 libnm-core: declare NM_SETTING_COMPARE_FLAG_INFERRABLE flag in "nm-core-internal.h"
As this flag is used by NM-core, move it to nm-core-internal.h
header file.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:22:16 +02:00
Thomas Haller
ef32da01fa all: add nm-core-internal.h header
Add a header file to expose private utility functions from libnm-core
that can be used by NetworkManager (core) and libnm.so. The header
is also used to give privileged access to libnm-core. Since NM links
statically, these functions are not exported and not part of public ABI.

This also removes the NM_UTILS_PRIVATE_CALL() macro and libnm.so no
longer exports nm_utils_get_private().

Before, this functionality was partly declared in nm-utils-private.h.
This was wrong because nm-utils-private.h is for functionality
entirely private to libnm-core.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 15:22:16 +02:00
Sandeep Shedmake
1a9f6bcbd3 po: updated Marathi (mr) translation (bgo #735212)
https://bugzilla.gnome.org/show_bug.cgi?id=735212

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-22 11:10:53 +02:00
Jiří Klimeš
6999a688b0 platform: (trivial) don't shadow link(3) in NMLinuxPlatform
Reported by Jordan Messina

(cherry picked from commit c54e6a95ff0957fb9d5c51505c8c3dd036600ff5)
2014-08-21 11:16:43 +02:00
Dan Winship
449ff11b78 libnm-core: clarify a comment about InfiniBand hardware address matching 2014-08-20 16:14:15 -04:00
Dan Williams
32a53f786d trivial: don't shadown link(3) in NMFakePlatform 2014-08-20 14:57:49 -05:00
Dan Williams
e7381662fe trivial: don't shadow rand(3)
Reported by Jordan Messina

(cherry picked from commit 365ca198c0d688e759cd2481d9446ba16f8e78ca)
2014-08-20 14:18:14 -05:00
Thomas Haller
b59a82d82e core: print warning message when skipping invalid device plugin file
https://mail.gnome.org/archives/networkmanager-list/2014-August/msg00042.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-20 19:14:44 +02:00
Dan Williams
6a19e68a7d libnm-core: clear secrets from NMSimpleConnection and NMSettingsConnection dispose()
A few of the settings plugins were calling nm_connection_clear_secrets()
from their finalize() method, but this call can emit signals, and by
the time finalize() runs, the object has a refcount of 0.  Signals
cannot be emitted from a finalized object, but instead could be
emitted from dispose() before the object is finalized.

Instead of moving the nm_connection_clear_secrets() to dispose() in each
plugin, make the behavior generic instead.  The settings plugins' parent
object is NMSettingsConnection, so clear secrets there.  Plus,
NMSettingsConnection caches system & agent secrets with NMSimpleConnection
objects, so clear secrets in NMSimpleConnection's dispose too.
2014-08-20 10:53:00 -05:00
Geoffrey Thomas
c75d878aa2 supplicant: fix expected return type of AddBlob D-Bus call
Commit fb6cde50 changed from setBlobs in the old wpa_supplicant D-Bus
interface, which returned an integer status code, to AddBlob in the new
one, which doesn't, but didn't account for that change. That caused
error messages of the form "Couldn't set network certificates: Too few
arguments in reply." on valid connection requests.

Signed-off-by: Geoffrey Thomas <gthomas@mokafive.com>
2014-08-20 09:32:12 -05:00
Thomas Haller
00af27f0ba cli: succeed in master bring-up when device state reaches IP_CONFIG (bgo #733641)
When connecting a master connection, no slave devices will be activated
automatically. The user is supposed to activate them individually.

Hence nmcli should not wait for the connection to be fully activated
because that is not going to happen (unless the user connects a slave
connection from another terminal).

Instead, for master connections behave differently and signal success
once the master device reaches IP_CONFIG state.

This revises behavior introduced by commit
47710f8211.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
2014-08-19 13:42:31 +02:00
Thomas Haller
fe6b002f0f settings: fix memory leak in get_settings_auth_cb()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-19 00:23:35 +02:00
Thomas Haller
25aa0a0705 libnm-core: fix crash in NMSettingAdsl:verify()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-19 00:13:11 +02:00
Dan Winship
645ab39bb6 libnm, libnm-glib: fix cut-and-paste-os
Several nm-device-*.c files apparently originally used
nm-device-ethernet.c as a template, but missed a reference to "eth" in
class_init.
2014-08-18 11:10:42 -04:00
Jiří Klimeš
26eafd3420 trivial: fix a typo in show_access_point_info() function name 2014-08-18 13:58:43 +02:00
Jiří Klimeš
45358f51fc cli: fix crash in nmcli device wifi with multiple wifi devices (bgo #734466)
And separate details for particular devices with an empty line.

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

Reported-by: Martin Pitt <martinpitt@gnome.org>
2014-08-18 13:58:43 +02:00
Thomas Haller
722712b0df keyfile: fix crash due to uninitialized variable when reading invalid connection
Fixes: 2bfccab710
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-17 23:16:42 +02:00
Thomas Haller
83479263c4 build: adjust make cscope paths for recent refactoring
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-17 23:04:11 +02:00
Dan Winship
9a9c2f4f84 Make NMConnection an interface, and NMRemoteConnection an NMObject (bgo #734746) 2014-08-16 10:22:56 -04:00
Dan Winship
0fdd71fe6e libnm: make NMRemoteConnection an NMObject 2014-08-16 10:17:53 -04:00
Dan Winship
e1ba13a426 libnm-core, libnm, core: make NMConnection an interface
The fact that NMRemoteConnection has to be an NMConnection and
therefore can't be an NMObject means that it needs to reimplement bits
of NMObject functionality (and likewise NMObject needs some special
magic to deal with it). Likewise, we will need a daemon-side
equivalent of NMObject as part of the gdbus port, and we would want
NMSettingsConnection to be able to inherit from this as well.

Solve this problem by making NMConnection into an interface, and
having NMRemoteConnection and NMSettingsConnection implement it. (We
use some hacks to keep the GHashTable of NMSettings objects inside
nm-connection.c rather than having to be implemented by the
implementations.)

Since NMConnection is no longer an instantiable type, this adds
NMSimpleConnection to replace the various non-D-Bus-based uses of
NMConnection throughout the code. nm_connection_new() becomes
nm_simple_connection_new(), nm_connection_new_from_hash() becomes
nm_simple_connection_new_from_hash(), and nm_connection_duplicate()
becomes nm_simple_connection_new_clone().
2014-08-16 10:17:53 -04:00
Dan Winship
5ed054aca9 libnm: get rid of redundant NMRemoteConnection properties
NMRemoteConnection had two DBusGConnection properties
(NMRemoteConnection:bus and NMRemoteConnection:dbus-connection) and
two D-Bus path properties (NMConnection:path and
NMRemoteConnection:dbus-path). The former of each pair were the
traditional names, and the latter were added for compatibility with
NMObject.

In libnm, we can just drop NMRemoteConnection:bus, and use the
NMObject-compatible :dbus-connection name instead.

For the path properties, we need to rename either NMConnection:path or
NMObject:dbus-path. Since NMObject already has "nm_object_get_path()"
rather than "nm_object_get_dbus_path()", and it already mistakenly
referred to the property as "NMObject:path" in the gtk-docs, it seemed
to make sense to rename that one rather than the NMConnection one.

(And then, for consistency, rename "nm_object_get_connection()" to
"nm_object_get_dbus_connection()" to also match its property.)
2014-08-16 10:17:53 -04:00
Dan Winship
4870786a2f libnm-core: add missing NMConnection signal class handlers
Add class handlers for the "secrets-cleared" and "changed" signals.
("secrets-updated" already had one.)
2014-08-16 10:17:53 -04:00
Dan Winship
32c26a859b libnm-core: move some fake NMConnection methods over to NMSetting
nm_connection_lookup_setting_type() and
nm_connection_lookup_setting_type_by_quark() have nothing to do with
NMConnection. So move them to NMSetting (and rename them to
nm_setting_lookup_type() and nm_setting_lookup_type_by_quark()).
2014-08-16 10:17:53 -04:00
Dan Winship
2bfccab710 libnm-core: drop nm_connection_create_setting()
This was only used in one place, and is trivial to implement inline
there.
2014-08-16 10:17:52 -04:00
Dan Winship
c81fb49aa5 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-16 10:17:14 -04:00
Dan Williams
76ac21b26d keyfile: allow "," as unmanaged-devices separator
Only using ";" (the GKeyFile default) often confuses people.
2014-08-15 14:40:02 -05:00
Thomas Haller
68653de291 contrib/rpm: fix --quick option of build_clean.sh
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-14 00:17:07 +02:00
Thomas Haller
c6a1ca53cd build: fix generate-setting-docs.py to work with python3
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-12 13:04:35 +02:00
Peter Korsgaard
123322c6d6 core: fix build with toolchains not exporting CLOCK_BOOTTIME
E.G. uClibc 0.9.33 and earlier.

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

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-11 13:16:22 +02:00
Dan Williams
2bd5cf51b8 dhcp: fix killing wrong process ID on dhclient release
The prototype of dhclient_start() changed in 30cdd1248 but that
commit didn't update stop() correctly.  Clearly treating a gboolean
as pid_t isn't going to work.  Second, we don't want to watch the
child process on DHCP release because we're just going to kill it
shortly after.
2014-08-08 13:51:47 -05:00
Dan Winship
b64c82a3ed libnm-util: don't warn about unrecognized properties
libnm-util is expected to end up behind the curve in terms of knowing
about new NMSetting properties, so if it sees an unknown property, it
should just assume that there will also be a backward-compatibility
equivalent rather than printing a warning.

(In particular, it should not warn when it sees the
"ipv4.address-labels" property now that it now longer knows about it.)
2014-08-08 12:15:10 -04:00
Dan Winship
58a66cc70b core: fix a warning and a leak
For devices where we don't set the hardware address at construct time,
the first call to nm_device_update_hw_address() was hitting a
return-if-fail.

Also, when updating the hardware address, we were leaking the old
value.
2014-08-08 11:17:03 -04:00
Thomas Haller
2ac34e437f libnm-glib/test: fix test failure for test-remote-settings-client
Due to behavioral change of test-networkmanager-service.py, the test
/remote_settings/remove_connection fails (test_remove_connection() at
test-remote-settings-client.c:318).

Fixes: 66a3480329
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-08 11:39:44 +02:00
Thomas Haller
df2711f197 nmtst: fix memory leak in nmtst_create_minimal_connection()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-07 22:26:28 +02:00
Dan Winship
964b9f3513 libnm-core, libnm-util: convert test-crypto, test-setting-8021x.c to gtestutils
Rather than having test-crypto and test-setting-8021x be programs that
you have to pass arguments to to get them to run a single test, just
have them run all of the tests themselves.

This lets us get rid of the big "check-local" rule in Makefile.am and
just use TESTS to run everything.

https://bugzilla.gnome.org/show_bug.cgi?id=734388
2014-08-07 15:57:19 -04:00
Dan Winship
7cd69584eb Merge branch 'libnm-nmobj' (bgo #734228) 2014-08-07 15:54:42 -04:00
Dan Winship
66a3480329 libnm: add a test for connection-deleted-while-being-created
Since NMRemoteSettings doesn't announce new connections until it has
fetched their properties, it's possible that a connection could get
deleted while we're waiting for it to be created. NMRemoteSettings has
code to deal with this, so add a test to make sure that it works.
2014-08-07 15:43:43 -04:00
Thomas Haller
d83f3777ad nmtst: add nmtst_create_minimal_connection() function
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-07 15:43:43 -04:00
Dan Winship
9ec70a8877 libnm: fix a g_signal_handler_find() call in NMRemoteSettings
NMRemoteSettings was looking for a signal handler on an
NMRemoteConnection using only G_SIGNAL_MATCH_FUNC, which means it
would get tripped up if a connection was known to two different
NMRemoteSettings objects at once. Although that can't happen now, it
might in the future if NMRemoteConnection became an NMObject, so use
G_SIGNAL_MATCH_DATA too.
2014-08-07 15:43:43 -04:00
Dan Winship
f8762f7d3f libnm: remove NMRemoteConnection::updated signal
Remove NMRemoteConnection::updated, which since 0.9.10 has been
redundant with NMConnection::changed. (We still handle the incoming
D-Bus signal, we just don't re-emit it as "updated", since the call to
nm_connection_replace_settings() already results in it emitting
"changed".)
2014-08-07 15:43:43 -04:00
Dan Winship
57e802f3aa libnm: port NMRemoteSettings to NMObject
NMRemoteSettings duplicates a bunch of NMObject's functionality that
it doesn't need to. In libnm-glib, it wouldn't have been possible to
port NMRemoteSettings to NMObject without breaking ABI, but now in
libnm we can do that.

As a side effect of this, NMRemoteSettings gains a "connections"
property, and "connection-added" and "connection-removed" signals
(with the former replacing the old "new-connection" signal). This also
removes the "connections-loaded" signal, since the connections will
now always be loaded (via the initialization of the "connections"
property) during init()/init_async().

Also, this removes NMRemoteConnection's "removed" signal, since it's
redundant with the new NMRemoteSettings::connection-removed (and
having the signal on NMRemoteSettings instead is more consistent with
other objects).
2014-08-07 15:43:43 -04:00
Dan Winship
d7e99f8375 libnm: add NMRemoteConnection:visible property
Rather than having a private "visible" signal, have a public "visible"
property.
2014-08-07 15:43:43 -04:00
Dan Winship
c4a86eba52 libnm: remove redundant NM name watching code
NMClient was watching to see whether NetworkManager was running, but
its parent class NMObject was already doing that anyway, so NMClient
doesn't need to do it itself.

This also requires making NMClient:init_async() wait for NMObject's
init_async() code to finish before calling GetPermissions, rather than
running the two in parallel like before (since we don't know if NM is
running or not until after NMObject's init_async() returns). This is
probably more correct anyway in terms of inheritance, and it's not as
much slower than the original code as it sounds, since previously
we were calling NameHasOwner twice (in serial) anyway.
2014-08-07 15:43:43 -04:00