Commit Graph

15047 Commits

Author SHA1 Message Date
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
Dan Winship
8ce06b814c libnm: synchronize NMClient and NMRemoteSettings "is NM running" properties
Rename NMClient:manager-running and NMRemoteSettings:service-running
to both be :nm-running.
2014-08-07 15:43:43 -04:00
Dan Winship
7e791ce3fe libnm, libnm-glib: belatedly replace _nm_client_is_object_path()
_nm_client_is_object_path() had been copied from
g_variant_is_object_path() with a note that it should be replaced when
we depended on GLib > 2.24, but it got missed when we actually updated
the dependency. Fix it now. (Also fix a nearby typo.)
2014-08-07 15:43:42 -04:00
Dan Winship
50d45acecb Miscellaneous hardware-address-handling changes (bgo #734229) 2014-08-07 15:42:04 -04: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
44b9a8708b libnm-core, etc: add nm_utils_hwaddr_matches()
Add nm_utils_hwaddr_matches(), for comparing hardware addresses for
equality, allowing either binary or ASCII hardware addresses to be
passed, and handling the special rules for InfiniBand hardware
addresses automatically. Update code to use it.
2014-08-07 15:34:50 -04:00
Dan Winship
357efd26e4 libnm-core: include ETH_ALEN/INFINIBAND_ALEN defines in nm-utils.h
Include <linux/if_ether.h> and <linux/if_infiniband.h> from
nm-utils.h, to get ETH_ALEN and INFINIBAND_ALEN, and remove those
includes (as well as <net/ethernet.h> and <netinet/ether.h>, and
various headers that had been included to get the ARPHRD_* constants)
from other files where they're not needed now.
2014-08-07 14:04:14 -04:00
Dan Winship
ea456aaa81 all: remove use of struct ether_addr / ether_aton()
Lots of old code used struct ether_addr to store hardware addresses,
and ether_aton() to parse them, but more recent code generally uses
guint8 arrays, and the nm_utils_hwaddr_* methods, to be able to share
code between ETH_ALEN and INFINIBAND_ALEN cases. So update the old
code to match the new. (In many places, this ends up getting rid of
casts between struct ether_addr and guint8* anyway.)

(Also, in some places, variables were switched from struct ether_addr
to guint8[] a while back, but some code still used "&" when referring
to them even though that's unnecessary now. Clean that up.)
2014-08-07 12:11:49 -04:00
Dan Winship
0dcba8a9a0 libnm-core: rewrite nm_utils_hwaddr_ntoa()
Rather than returning from the middle of the loop, just rearrange
things so we can exit the loop like normal people.
2014-08-07 12:08:16 -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
Thomas Haller
86ab915f6a logging: merge branch 'th/bgo734230_device_logging'
https://bugzilla.gnome.org/show_bug.cgi?id=734230

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-07 12:53:16 +02:00
Thomas Haller
4b36f8b35b logging: use new logging macros in NMDevice subclasses
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-06 19:22:02 +02:00
Thomas Haller
950989c45c logging: extract logging macros for devices to nm-device-logging.h
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-06 19:22:02 +02:00
Dan Winship
e9fbf805a8 trivial: fix spacing in src/devices/wifi/nm-wifi-ap.h
This file had a bad mix of tabs and spaces. Fix it.
2014-08-05 10:54:39 -04:00
Thomas Haller
67ad3fcb5b platform/tests: disable platform root test 'test-link-linux' for now
This test is quite broken and fails often. It does not fail
always, but the changes for a failure are high.

We certainly should fix that, but for now exclude the test from
`make check`.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-04 16:17:49 +02:00
Thomas Haller
242d350fcf libnm-util/test: fix tests not to write a core file
test_libnm_linking() executes ./test-libnm-linking which
is supposed to crash. When the user set `ulimit -c unlimited`
before, this will leave a left-over core file.

In case of `make distcheck`, this is quite bad because it lets
the make target fail:

    ERROR: files left in build directory after distclean:
    ./libnm-util/tests/core.31481

Fix this by setting the (soft) rlimit for writing core files
to 0 before executing the test binary.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-04 16:17:36 +02:00
Geoffrey Thomas
5c31ed880d supplicant: fix invalid parameter type in AddBlob D-Bus call
Types passed to dbus-glib need to be GTypes, not D-Bus type. While the
DBUS_TYPE_G_* macros are GTypes from libdbus-glib, the other DBUS_ types
aren't.

Signed-off-by: Geoffrey Thomas <gthomas@mokafive.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-04 14:59:03 +02:00
Thomas Haller
536029a96d libnm-util/tests: fix build for older glib with unknown G_SPAWN_DEFAULT
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-04 13:30:37 +02:00
Christian Kirbach
7eb6f5128a po: update German (de) translation (bgo #734150)
https://bugzilla.gnome.org/show_bug.cgi?id=734150

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-02 00:53:33 +02:00
Thomas Haller
ab8966d935 core: cleanup getting iface for NMDevice for logging
Since refactoring logging, these calls are not needed.
Just forgot to remove them.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-02 00:51:36 +02:00
Thomas Haller
833ff17cd7 build: fix out-of-tree build for libnm-core
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-01 22:08:09 +02:00