Commit graph

11902 commits

Author SHA1 Message Date
Thomas Haller
08ecafd2bf build: add --enable-more-asserts configure option and nm_assert() macro
NM already has two kinds of assertions:
 - g_assert*(), conditionally compiled via #ifndef G_DISABLE_ASSERT
 - g_return*(), conditionally compiled via #ifndef G_DISABLE_CHECKS

In theory, one should be able to disable both asserts and NM should
still work correctly (and possibly more efficient). In practice,
hardly anybody is testing such a configuration and it might be broken.
Especially, we don't disable asserts for production builds, both because
of less test coverage and because it might reduce our ability to debug.

Add a new configure option --enable-more-asserts, which defines
NM_MORE_ASSERTS and nm_assert(). This is for expensive asserts,
that -- contrary to the asserts above -- are disabled by default.
This is useful for extended debugging.
2015-04-10 18:06:59 +02:00
Thomas Haller
4ab540939c test: print NMTST_SEED_RAND value with g_print()
For tests with assert-logging enabled, we already printed
the message with g_print(), instead of g_message().

We always want to print this value, because it is important
to reproduce a test failure. Hence, just (always) print
directly to stdout.

Also, add a leading newline, because the output was attached
to the previous line.
2015-04-10 18:06:20 +02:00
Thomas Haller
0aca44c857 test: fix compiler warning in g_test_assert_expected_messages_internal()
-Wformat of gcc determines that the string arguments are NULL.

Fixes: 373d09b042
2015-04-10 15:06:23 +02:00
Thomas Haller
7c5d361c66 platform/trivial: rename object_type_from_nl_object() to _nlo_get_object_type()
The function names in linux-platform should get better prefixes
indicating whether they are related to libnl or nm objects.

Add a prefix _nlo_ for functions that operate on libnl objects.
2015-04-09 17:45:59 +02:00
Thomas Haller
850af91f22 platform/trivial: move code around so that libnl related stuff is together
Reorder some functions in nm-platform, so that we first have independent
libnl wrappers/utils, then NMPlatform type definition, and then the
rest.
2015-04-09 17:31:11 +02:00
Thomas Haller
ee64b8585b platform/trivial: add OBJECT_TYPE_MAX enum value 2015-04-09 17:31:11 +02:00
Thomas Haller
4c9a836774 test: make valgrind suppressions file configurable
Add a configure option --with-valgrind-suppressions=path to allow
specifying a different suppressions file.
2015-04-09 17:02:49 +02:00
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
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
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