Commit Graph

15047 Commits

Author SHA1 Message Date
Thomas Haller
373d09b042 test: log message at g_test_assert_expected_messages()
When disabling assert-logging with no-expect-message,
print a line at every g_test_assert_expected_messages()
invocation.
2015-04-09 16:39:13 +02:00
Thomas Haller
745f2aceac test: add description of test behavior to nm-test-utils.h 2015-04-09 16:39:13 +02:00
Beniamino Galvani
eab389bd8a build: update systemd code
This is a direct dump from systemd git on 2015-04-08, git commit
431c3b6bab9c; it updates the existing files and imports systemd IPv4LL
implementation.

    SYSTEMD_DIR=../systemd
    COMMIT=431c3b6bab9ceb54cd144d8df24d764a8a5f8fcc

    (
       cd "$SYSTEMD_DIR"
       git checkout "$COMMIT"
       git reset --hard
       git clean -fdx
    )
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd/sd-id128/sd-id128.c ./src/systemd/src/libsystemd/sd-id128/sd-id128.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-identifier.c ./src/systemd/src/libsystemd-network/dhcp-identifier.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-identifier.h ./src/systemd/src/libsystemd-network/dhcp-identifier.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-internal.h ./src/systemd/src/libsystemd-network/dhcp-internal.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-lease-internal.h ./src/systemd/src/libsystemd-network/dhcp-lease-internal.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-network.c ./src/systemd/src/libsystemd-network/dhcp-network.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-option.c ./src/systemd/src/libsystemd-network/dhcp-option.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-packet.c ./src/systemd/src/libsystemd-network/dhcp-packet.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-protocol.h ./src/systemd/src/libsystemd-network/dhcp-protocol.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-internal.h ./src/systemd/src/libsystemd-network/dhcp6-internal.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-lease-internal.h ./src/systemd/src/libsystemd-network/dhcp6-lease-internal.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-network.c ./src/systemd/src/libsystemd-network/dhcp6-network.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-option.c ./src/systemd/src/libsystemd-network/dhcp6-option.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-protocol.h ./src/systemd/src/libsystemd-network/dhcp6-protocol.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/network-internal.c ./src/systemd/src/libsystemd-network/network-internal.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/network-internal.h ./src/systemd/src/libsystemd-network/network-internal.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-dhcp-client.c ./src/systemd/src/libsystemd-network/sd-dhcp-client.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-dhcp-lease.c ./src/systemd/src/libsystemd-network/sd-dhcp-lease.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-dhcp6-client.c ./src/systemd/src/libsystemd-network/sd-dhcp6-client.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-dhcp6-lease.c ./src/systemd/src/libsystemd-network/sd-dhcp6-lease.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/ipv4ll-internal.h ./src/systemd/src/libsystemd-network/ipv4ll-internal.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/ipv4ll-internal.h ./src/systemd/src/libsystemd-network/ipv4ll-internal.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/ipv4ll-network.c ./src/systemd/src/libsystemd-network/ipv4ll-network.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network//ipv4ll-packet.c ./src/systemd/src/libsystemd-network//ipv4ll-packet.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-ipv4ll.c ./src/systemd/src/libsystemd-network/sd-ipv4ll.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/async.h ./src/systemd/src/shared/async.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/fileio.c ./src/systemd/src/shared/fileio.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/fileio.h ./src/systemd/src/shared/fileio.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/list.h ./src/systemd/src/shared/list.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/log.h ./src/systemd/src/shared/log.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/macro.h ./src/systemd/src/shared/macro.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/path-util.c ./src/systemd/src/shared/path-util.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/path-util.h ./src/systemd/src/shared/path-util.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/refcnt.h ./src/systemd/src/shared/refcnt.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/siphash24.c ./src/systemd/src/shared/siphash24.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/siphash24.h ./src/systemd/src/shared/siphash24.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/socket-util.h ./src/systemd/src/shared/socket-util.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/sparse-endian.h ./src/systemd/src/shared/sparse-endian.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/strv.c ./src/systemd/src/shared/strv.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/strv.h ./src/systemd/src/shared/strv.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/time-util.c ./src/systemd/src/shared/time-util.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/time-util.h ./src/systemd/src/shared/time-util.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/utf8.c ./src/systemd/src/shared/utf8.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/utf8.h ./src/systemd/src/shared/utf8.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/util.c ./src/systemd/src/shared/util.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/util.h ./src/systemd/src/shared/util.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/unaligned.h ./src/systemd/src/shared/unaligned.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/in-addr-util.c ./src/systemd/src/shared/in-addr-util.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/in-addr-util.h ./src/systemd/src/shared/in-addr-util.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/_sd-common.h ./src/systemd/src/systemd/_sd-common.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-dhcp-client.h ./src/systemd/src/systemd/sd-dhcp-client.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-dhcp-lease.h ./src/systemd/src/systemd/sd-dhcp-lease.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-dhcp6-client.h ./src/systemd/src/systemd/sd-dhcp6-client.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-dhcp6-lease.h ./src/systemd/src/systemd/sd-dhcp6-lease.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-event.h ./src/systemd/src/systemd/sd-event.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-id128.h ./src/systemd/src/systemd/sd-id128.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-ipv4ll.h ./src/systemd/src/systemd/sd-ipv4ll.h
2015-04-08 16:12:44 +02:00
Thomas Haller
3c240a6d0b route-manager: merge branch 'th/route-manager-bgo740064'
https://bugzilla.gnome.org/show_bug.cgi?id=740064
2015-04-08 14:51:56 +02:00
Thomas Haller
bd0c44c1cf route-manager/test: add variations to test code 2015-04-08 14:50:43 +02:00
Thomas Haller
62c652c352 route-manager: refactor route-manager and route_sync()
Refactor the implementation of nm_route_manager_ip4_route_sync()
and nm_route_manager_ip6_route_sync().

- merge the implementations for IPv4 and IPv6.

- pre-sort the routes and iterate them in a way that we don't
  need to lookup a route in other lists. Do this by iterating
  two sorted lists at a time in a merge-sort way.
  The runtime complexity of sync is now O(n*ln(n)).

- previously, the algorithm would merge routes it found in platform
  to priv->ipx_routes. That was wrong, because then we loose the
  information which routes we wanted to configure internally and which
  are present externally.
  Instead, priv->ipx_routes now contains all the routes that were
  explicitly configured via sync(). Hence, it knows what should be
  configured (@ipx_routes) and can compare to what is configured
  (@plat_routes).

https://bugzilla.gnome.org/show_bug.cgi?id=740064
2015-04-08 14:50:43 +02:00
Thomas Haller
e65639bde9 util: add nm_utils_array_remove_at_indexes() function 2015-04-08 14:39:17 +02:00
Thomas Haller
3179b45412 default-route-manager: cleanup logging macros 2015-04-08 14:39:16 +02:00
Thomas Haller
110200d5d4 default-route-manager: use NMPlatformVTableRoute 2015-04-08 14:39:16 +02:00
Thomas Haller
290faa003d platform: add VTable to handle IPv4 and IPv6 routes generically 2015-04-08 14:39:16 +02:00
Thomas Haller
57453189e0 test: add option in nmtst_platform_ip4_routes_equal() to ignore ordering
Same for nmtst_platform_ip6_routes_equal().

It's useful to check for equal routes ignoring the ordering.
2015-04-08 14:39:16 +02:00
Thomas Haller
ba8ce3bbe5 route-manager/test: check for exact expected error message 2015-04-08 14:39:16 +02:00
Thomas Haller
5fd3827e49 route-manager/test: fix usage of g_assert_expect_message()
Tests that use g_assert_expect_message() must initialize with
nmtst_init_assert_logging().

Otherwise, the caller can change the logging level via
  NMTST_DEBUG=log-level=DEBUG,log-domains=DEFAULT
which breaks the assertions.

nmtst_init_assert_logging() allows the caller to turn of
checking of assertions via
  NMTST_DEBUG=log-level=DEBUG,log-domains=DEFAULT,no-expect-message

Also, don't use g_message() in platform tests otherwise the test fail
because nmtst now sets g_log_set_always_fatal().
2015-04-08 14:39:16 +02:00
Thomas Haller
cdd3e1c302 platform/test: clear host part of routes in fake platform
Adding a route with host part non zero is rejected by kernel.
But NMLinuxPlatform works around it -- so must fake platform.
2015-04-08 14:39:16 +02:00
Thomas Haller
21b129084f platform/test: fake platform must use nm-logging for reporting errors
Just like linux platform does.
2015-04-08 14:39:16 +02:00
Thomas Haller
24288f713a platform/test: split initialization of platform tests out
test-route-manager soon wants a different initialization
2015-04-08 14:39:16 +02:00
Thomas Haller
b6d3b98655 test: setup logging during nmtst_init_assert_logging()
Before, when having a test with nmtst_init_assert_logging(),
the caller was expected to setup logging separately according
to the log level that the test asserts against.

Since 5e74891b58, the logging
level can be reset via NMTST_DEBUG also for tests that
assert logging. In this case, it would be useful, if the test
would not overwrite the logging level that is set externally
via NMTST_DEBUG.

Instead, let the test pass the logging configuration to
nmtst_init_assert_logging(), and nmtst will setup logging
-- either according to NMTST_DEBUG or as passed in.

This way, setting the log level works also for no-expect-message
tests:

  NMTST_DEBUG="debug,no-expect-message,log-level=TRACE" $TEST
2015-04-08 14:39:16 +02:00
Thomas Haller
07f95c371c platform: don't write debug message to stderr
Use nm-logging instead.
2015-04-08 14:39:16 +02:00
Thomas Haller
3abeb7f2b9 test: fix enabling DEBUG logging for tests
For glog messages to print any debug messages, we must set G_MESSAGES_DEBUG.
nmtst does this for us if we set @is_debug. But fix the condition to
also set G_MESSAGES_DEBUG if set set c_log_level to DEBUG or TRACE.
2015-04-08 14:39:16 +02:00
Thomas Haller
0a2c0d12e8 test: fix parsing of NMTST_SEED_RAND 2015-04-08 14:39:15 +02:00
Thomas Haller
44a963c894 test: change message about random seed in nmtst
Make it clear, that you can overwrite the seed by setting the
environment variable NMTST_SEED_RAND.
2015-04-08 14:39:15 +02:00
Beniamino Galvani
aabc6fc57b wifi: indicate 2ghz and 5ghz wifi device capabilities
Add new capabilities CAP_FREQ_2GHZ and CAP_FREQ_5GHZ to indicate the
frequency bands supported by a Wifi device.

Add also CAP_FREQ_VALID, which is set when the values of the other 2
capabilities are available.

Original patch by Dan Williams <dcbw@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=723295
2015-04-08 10:48:38 +02:00
Lubomir Rintel
d78f4614a0 device: use "new-activation" reason when deactivating for another activation
"user-requested" has a side effect of disabling autoconnect.

Fixes: 600489003f
2015-04-08 10:00:14 +02:00
Lubomir Rintel
1ad193a017 device,libnm,cli: add "new-activation" reason for device state change
It will be used when the device is disconnected for new connection activation.
2015-04-08 10:00:11 +02:00
Lubomir Rintel
c1c3d7e145 device: translate NM_DEVICE_STATE_REASON_UNKNOWN to "unknown" 2015-04-08 09:59:24 +02:00
Beniamino Galvani
8af18182f3 build: move systemd DHCP files to a common directory
Create a new directory 'src/systemd' and move systemd DHCP files
there. This new directory will contain all the files imported from
systemd.
2015-04-08 09:17:51 +02:00
Thomas Haller
7914a6b6bd dispatcher: fix crash due to wrong signature of variant for argument of "Action" D-Bus call
Fixes: 8da83a2ba3

https://bugzilla.gnome.org/show_bug.cgi?id=747456
2015-04-07 19:18:15 +02:00
Dan Winship
773f047eef libnm-core: fix VPN error domain (bgo #745997)
In theory, NM_VPN_PLUGIN_ERROR should have names under
org.freedesktop.NetworkManager.VPN.Plugin, but for historical reasons,
it's actually org.freedesktop.NetworkManager.VPN.Error.
2015-04-07 11:30:36 -04:00
Dan Winship
37a5bfcbeb supplicant-manager, wifi: (trivial) fix signal argument types
A few places in the NMSupplicantInterface API and in NMDeviceWifi's
use of it were still using "GHashTable *properties" where they should
have been using "GVariant *properties". (This didn't cause any actual
problems because nothing was looking at those arguments.)

(Also fix a comment typo.)
2015-04-06 16:13:03 -04:00
Thomas Haller
b5b568a49a libnm-core: add libnm-core/nm-dbus-utils.c to POTFILES.in
Fixes: 9668bfd682
2015-04-05 11:17:09 +02:00
Dan Winship
7b17faaa3f dispatcher: belatedly remove no-longer-used dbus-glib define 2015-04-04 08:23:48 -04:00
Dan Winship
96a0a6bcaa core: merge branch 'more-gdbus-bgo746901'
https://bugzilla.gnome.org/show_bug.cgi?id=746901
2015-04-03 17:01:47 -04:00
Dan Williams
689bf383e9 firewall: clean up call completion and use GCancellable 2015-04-03 16:58:41 -04:00
Dan Winship
5a1b6b4bbd core: port NMManager's aipd proxy to GDBus 2015-04-03 16:58:41 -04:00
Dan Winship
473cfec01c bluetooth: port bluez4 code to gdbus 2015-04-03 16:58:40 -04:00
Dan Winship
8da83a2ba3 core: port the daemon side of the dispatcher to gdbus 2015-04-03 16:58:40 -04:00
Dan Winship
da7d3ed5e1 core: port nm-sleep-monitor-upower to gdbus 2015-04-03 16:58:40 -04:00
Dan Winship
2e8acfa9d8 core: trivial NMSleepMonitor fixes
Fix nm-sleep-monitor-upower.c indentation, and fix the type of the
(unused) first argument in NMManager's NMSleepMonitor signal handlers.
2015-04-03 16:58:40 -04:00
Dan Winship
5c9032cb5d firewall: port nm-firewall-manager to gdbus 2015-04-03 16:58:40 -04:00
Dan Winship
9f42c6df9a core: use _nm_dbus_error_has_name() 2015-04-03 16:58:40 -04:00
Dan Winship
ec6f350f44 libnm-core: add _nm_dbus_error_has_name()
Add a method for checking the D-Bus error name of an error.
2015-04-03 16:58:40 -04:00
Dan Winship
9926ba376a libnm, core: use typechecked proxy_call methods 2015-04-03 16:58:40 -04:00
Dan Winship
9668bfd682 libnm-core: add _nm_dbus_proxy_call_sync(), _nm_dbus_proxy_call_finish()
Add versions of g_dbus_proxy_call_sync() and
g_dbus_proxy_call_finish() that also typecheck the response and return
an error if it is incorrect.
2015-04-03 16:58:40 -04:00
Dan Winship
1a0bc83c39 libnm, core: use _nm_dbus_signal_connect() 2015-04-03 16:58:40 -04:00
Dan Winship
4e61f4bf35 libnm-core: add _nm_dbus_signal_connect()
Add _nm_dbus_signal_connect(), for connecting to D-Bus signals on a
GDBusProxy, with typechecking and pre-parsing of the parameters
variant.
2015-04-03 16:58:40 -04:00
Lubomir Rintel
353570224f device,cli: allow re-activation of already active connections (bgo #730492)
https://bugzilla.gnome.org/show_bug.cgi?id=730492
https://bugzilla.redhat.com/show_bug.cgi?id=1182085
2015-04-03 19:00:43 +02:00
Lubomir Rintel
0e8a14cc5f cli: don't look up a device for activation request unless we have to
Let the server decide which device to use if the user didn't explicitly
specify the interface, wireless access point or a wimax nsp.

The server will just reuse the device for an already active connection
or potentially do a better guess.

https://bugzilla.gnome.org/show_bug.cgi?id=730492
2015-04-03 18:59:33 +02:00
Lubomir Rintel
4cb97cf66f manager: remove a connection from device if we're activating it on another device
The connection now might be being activated on another device. Defer the
removal until we're sure the activation request will proceed and only add the
active connection afterwards.

https://bugzilla.gnome.org/show_bug.cgi?id=730492
2015-04-03 18:59:33 +02:00
Lubomir Rintel
6fc3736c7a manager: pick an available device if none was specified upon connection activation
This offloads some complexity from the client.

https://bugzilla.gnome.org/show_bug.cgi?id=730492
2015-04-03 18:59:33 +02:00
Lubomir Rintel
6e94f302b2 manager: reuse a device connection is active on if none was given upon activation
If a connection is already active let's keep it on the same device. This makes
it possible to reactivate a connection without client knowing which device is
it active on.

https://bugzilla.gnome.org/show_bug.cgi?id=730492
2015-04-03 18:59:33 +02:00