Commit graph

11852 commits

Author SHA1 Message Date
Lubomir Rintel
c2233f4484 tests: don't limit the valgrind tracebacks to 12 frames
The glib tracebacks are typically longer.

(cherry picked from commit d909e76d9e)
2015-06-19 11:52:50 +02:00
Thomas Haller
4fa342aefc valgrind: add comment to valgrind suppression explaining how to reproduce
(cherry picked from commit 0554474720)
2015-06-19 11:52:50 +02:00
Thomas Haller
dfa26cb007 valgrind: add valgrind suppression for Fedora 22
Fixes for example valgrind tests for ./libnm/tests/test-nm-client:

    ==25772== Conditional jump or move depends on uninitialised value(s)
    ==25772==    at 0x40198D8: index (strchr.S:106)
    ==25772==    by 0x400777C: expand_dynamic_string_token (dl-load.c:369)
    ==25772==    by 0x400777C: fillin_rpath (dl-load.c:439)
    ==25772==    by 0x4007FCF: _dl_init_paths (dl-load.c:816)
    ==25772==    by 0x4002F38: dl_main (rtld.c:1194)
    ==25772==    by 0x401750F: _dl_sysdep_start (dl-sysdep.c:249)
    ==25772==    by 0x4004C20: _dl_start_final (rtld.c:306)
    ==25772==    by 0x4004C20: _dl_start (rtld.c:412)
    ==25772==    by 0x4000C97: ??? (in /usr/lib64/ld-2.21.so)
    ==25772==    by 0x1: ???
    ==25772==    by 0xFFEFFF6B2: ???
    ==25772==    by 0xFFEFFF6EF: ???
    ==25772==
    {
       <insert_a_suppression_name_here>
       Memcheck:Cond
       fun:index
       fun:expand_dynamic_string_token
       fun:fillin_rpath
       fun:_dl_init_paths
       fun:dl_main
       fun:_dl_sysdep_start
       fun:_dl_start_final
       fun:_dl_start
       obj:/usr/lib64/ld-2.21.so
       obj:*
       obj:*
       obj:*
    }

(cherry picked from commit d84ac1baca)
2015-06-19 11:52:50 +02:00
Lubomir Rintel
0f95b5c345 builds: only enable TAP driver for glib >= 2.37.6
No TAP support for previous versions and --tap argument is silently ignored,
confusing the TAP driver.

(cherry picked from commit c47c06470a)
2015-06-19 11:52:50 +02:00
Lubomir Rintel
c099e9d43b tests: don't try to connect to the private socket
Even if we're running the tests as root we still want to use the mock
service instead of whatever version of daemon runs on the test host.

(cherry picked from commit 02e3d6c286)
2015-06-19 11:52:50 +02:00
Lubomir Rintel
2829fadcc1 tests: be a bit more helpful when valgrind tests fail
(cherry picked from commit dd959087a2)
2015-06-19 11:52:50 +02:00
Thomas Haller
38b2331440 test: fix running valgrind tests with NMTST_NO_VALGRIND
Fixes: 6463ce5dd9
(cherry picked from commit ce3d1533cc)
2015-06-19 11:52:50 +02:00
Lubomir Rintel
fe3e32c034 tests: use the TAP formatter
The test results in standard format are easily integrated into CI systems.

(cherry picked from commit 6463ce5dd9)
2015-06-19 11:52:50 +02:00
Lubomir Rintel
df11b267fd build: switch to parallel test harness
This will make it possible to use the TAP formatter.

(cherry picked from commit 380ed63318)
2015-06-19 11:52:50 +02:00
Lubomir Rintel
30d37abbc0 tests: call g_test_run() even when skipping the test
It will return the 77 exit code itself. For TAP output it will also generate
the proper test skip marker.

(cherry picked from commit 14f4674f64)
2015-06-19 11:52:50 +02:00
Lubomir Rintel
0e20868f4f tests: always spawn private d-bus
Parallel test runs would not be possible without this.

(cherry picked from commit d0e25ac8be)
2015-06-19 11:52:50 +02:00
Lubomir Rintel
62172a9a9e tests: move all asserts into tests
Otherwise the TAP formatter would produce a plan-less output.

(cherry picked from commit f627d6db8e)
2015-06-19 11:52:49 +02:00
Thomas Haller
483a019110 build: add --enable-more-logging configure option
NM core uses nm-logging which is entirely configurable at runtime.
Other components use glib-logging, which can also be partly configured
via G_MESSAGES_DEBUG.

It makes sense to have a compile time option to enable some
logging statements that are only useful for heavy debugging.

For glib-logging, this is a way to enable/disable extra logging.
For nm-logging, we could alternatively configure a least log-level
that is enabled at compile time (that way, we could configure to prune all
LOGL_TRACE logging). While that might be useful (too), this gives
an alternative way to disable/enable logging.

Add a configure option --enable-more-logging and a NM_MORE_LOGGING define
for that.

If we don't find this useful after a while, we can simply remove it,
because our logging statements are not part of a "stable" behavior.

(cherry picked from commit 63593a19d8)
2015-06-19 11:52:49 +02:00
Thomas Haller
b67fbe9561 core: make nm_assert() always compile condition
Even if asserts are not enabled, still let the compiler see what we would
assert. Otherwise, we get warnings about unused variables or we migth miss
compile errors inside nm_assert().

(cherry picked from commit fe3e1849b7)
2015-06-19 11:52:49 +02:00
Thomas Haller
63e30f5024 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.

(cherry picked from commit 08ecafd2bf)
2015-06-19 11:52:49 +02:00
Thomas Haller
d1a865628b test: make valgrind suppressions file configurable
Add a configure option --with-valgrind-suppressions=path to allow
specifying a different suppressions file.

(cherry picked from commit 4c9a836774)
2015-06-19 11:52:49 +02:00
Dan Williams
98c310ea8b merge: replace usage of dbus-glib in supplicant code with GDBus (bgo #744598)
(cherry picked from commit 19c0de8b88)
2015-06-19 11:51:49 +02:00
Thomas Haller
274be6cf88 supplicant: remove unused variable
(cherry picked from commit 02130cc157)
2015-06-19 11:51:25 +02:00
Dan Williams
9db6d6ad42 supplicant: remove unused nm-call-store.c/.h
(cherry picked from commit 9adbc05e1b)
2015-06-19 11:51:25 +02:00
Dan Williams
0de28bd08b supplicant: convert interface/config to GDBus
(cherry picked from commit 59c8192b22)
2015-06-19 11:51:25 +02:00
Dan Williams
7ea33e5c92 supplicant: clean up some whitespace
(cherry picked from commit 47fe1b3196)
2015-06-19 11:51:25 +02:00
Dan Williams
7b9cc94e66 supplicant: make NMSupplicantInterface independent of NMSupplicantManager
The Interface held a reference to the manager to listen for the 'available'
signal.  Instead of that, let's make the child unaware of the master to
keep the inheritance cleaner.

(cherry picked from commit 7ed2d7a809)
2015-06-19 11:51:25 +02:00
Dan Williams
42870c8ee5 supplicant: clean up NMSupplicantInterface::dispose()
(cherry picked from commit 0e8f5b2e57)
2015-06-19 11:51:25 +02:00
Dan Williams
669b8f70bb supplicant: convert NMSupplicantManager to GDBus
(cherry picked from commit 9f5f141100)
2015-06-19 11:51:24 +02:00
Dan Williams
fae1a4f864 supplicant: clean up NMSupplicantManager::dispose()
(cherry picked from commit 742b28fb1f)
2015-06-19 11:51:24 +02:00
Lubomir Rintel
8cffaf3bf5 vxlan: o.fd.NM.Device.Proxy is a boolean
(cherry picked from commit 203e48033b)
2015-06-18 22:27:41 +02:00
Lubomir Rintel
55e402e5ac manager: use proper reason when stealing a connection
The user-requested reason is not really appropriate and blocks autoreconnect.
We added a new reason precisely for that.

Fixes: 4cb97cf66f
(cherry picked from commit 2bfbf33720)
2015-06-18 21:45:52 +02:00
Lubomir Rintel
7f84150e9f systemd-dhcp: fix build with Linux 3.2.0 headers
Fixes build on Ubuntu 12.04.

systemd/src/libsystemd-network/dhcp-network.c: In function '_bind_raw_socket':
systemd/src/libsystemd-network/dhcp-network.c:75:17: error: 'BPF_XOR' undeclared (first use in this function)
systemd/src/libsystemd-network/dhcp-network.c:75:17: note: each undeclared identifier is reported only once for each function it appears in
make[4]: *** [libsystemd_nm_la-dhcp-network.lo] Error 1

(cherry picked from commit 3811a68389)
2015-06-18 13:23:56 +02:00
Lubomir Rintel
529a16279d build: correctly set DISTCHECK_CONFIGURE_FLAGS
Fixes: 84021454eb
(cherry picked from commit 5a3eb7aee3)
2015-06-18 12:11:38 +02:00
Lubomir Rintel
946453ef9a build: don't default to -Werror
It seems like a poor default for various downstream toolchains. We can't
anticipate the compiler warnings for future compiler versions and older
ones are prone to false positives. Also, older gdbus-codegen is known
to generate code that triggers compiler warnings.

Let's keep it enabled for maintainer builds and distcheck so that we're
sure a tool chain that builds releases without warnings exists.

(cherry picked from commit 84021454eb)
2015-06-18 12:11:37 +02:00
Lubomir Rintel
2b8f484566 tests: avoid calling GLib.IOChannel.unix_new()
The Ubuntu 12.04 introspection data don't contain it. However, the default
constructor works just well and even looks a bit more Python-y.

(cherry picked from commit b9b7bb1958)
2015-06-18 12:11:37 +02:00
Lubomir Rintel
483595e0f4 libnm-core,libnm-util: avoid calling a constructor
It yields completely unpredictable results on Ubuntu 12.04 (the global variable
successfully comparing to NULL despite demonstrably not NULL). Possibly a
toolchain bug.

(cherry picked from commit ccb0ca4493)
2015-06-18 12:11:37 +02:00
Lubomir Rintel
9e6a02d7a1 build: use compat version of g_clear_pointer()
Ubuntu 12.04 has an ancient version of glib, which we nevertheless support.

(cherry picked from commit eb2b8c2798)
2015-06-18 12:11:37 +02:00
Dan Williams
b8e9b91531 merge: more isolated pieces of dcbw/devices-for-all (bgo #749401)
(cherry picked from commit c428935d9f)
2015-06-17 22:35:42 +02:00
Dan Williams
eb396b8fb6 core: rearrange some VLAN code and clean up dispose()
Move parent-related stuff before its callers and clean up dispose
so that we no longer need priv->disposed.

(cherry picked from commit 2a7a19e767)
2015-06-17 18:52:43 +02:00
Dan Williams
b5f5aa0960 platform: move InfiniBand property reading into the platform and prefer netlink
Add a netlink implementation for reading InfiniBand properties, but fall back to
sysfs when that isn't supported by the kernel.

(cherry picked from commit 5cf226463a)
2015-06-17 18:52:43 +02:00
Dan Williams
2236cc5eb8 core: earlier software capability detection
We need to know whether we can create interfaces of any given
NMDevice subclass or not.  So don't rely on just the NMPlatformLink
for that information, because we won't have a platform link for
software devices before we create them.

(cherry picked from commit d4e0a1e8cc)
2015-06-17 18:52:42 +02:00
Dan Williams
dee7f89b62 core: check duplicate devices by interface name not UDI
We can't have devices with duplicate interface names so we might
as well use that for dupe checking instead of the (mostly useless)
UDI.

(cherry picked from commit 81db512997)
2015-06-17 18:52:42 +02:00
Thomas Haller
a81830c766 platform/test: fix valgrind warning about NULL arguments to mount()
==21573== Syscall param mount(type) points to unaddressable byte(s)
    ==21573==    at 0x854B9BA: mount (syscall-template.S:81)
    ==21573==    by 0x158922: main (test-common.c:295)
    ==21573==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
    ==21573==
    {
       <insert_a_suppression_name_here>
       Memcheck:Param
       mount(type)
       fun:mount
       fun:main
    }

Fixes: d6aef9c188
(cherry picked from commit 0d7012faab)
2015-06-17 18:47:45 +02:00
Lubomir Rintel
faf46ad316 linux-platforms: don't enumerate devices via udev if udevd is not running
We'd be able to do so for already existing devices, but not for devices that
are added afterwards, since gudev is hardwired not to listen for events from
kernel.

(cherry picked from commit 26aeb12749)
2015-06-17 18:47:45 +02:00
Lubomir Rintel
2ba6845a6e platform/test: unshare the netns namespace so that root tests don't mess with the system
Mount a private sysfs instance. Otherwise gudev sees the devices from the
parent netns as opposed to our netns.

We do, however need a writable /sys/devices subtree for testing the bridge
code. There doesn't seem to be any other way to get a writable subtree of a
read-only filesystem than remounting it with no parameters after the initial
mount. We use this to get a writable sysfs instance and then bindmount it so
that it fits properly in the sysfs hierarchy.

Co-Authored-By: Thomas Haller <thaller@redhat.com>
(cherry picked from commit d6aef9c188)
2015-06-17 18:47:45 +02:00
Thomas Haller
4609138e3e platform: fix compiler warning about non-initialized pointer
When compiling with -fexceptions (as we build our RPM), we must
initialize all variables with a cleanup attribute.

Fixes: 29ccb8851c
Fixes: f8a9574f7e
(cherry picked from commit f55a272ade)
2015-06-17 18:42:52 +02:00
Dan Williams
5a81162c43 merge: device factory cleanups and first parts of devices-for-all (bgo #747429)
(cherry picked from commit 6270db5f0b)
2015-06-17 16:33:38 +02:00
Dan Williams
ed0c228187 core: let plugins indicate links which should be ignored
Instead of hacky stuff in the Manager, let plugins themselves indicate
which links should be ignored (because they are really child links that
are controlled by a different device that the plugin handles).

(cherry picked from commit 8fa0f4690f)
2015-06-17 16:33:16 +02:00
Dan Williams
d5e0a6ff86 core: move permanent and initial MAC address reading to NMDevice and NMPlatform
Ethernet, WiFi, and VLAN used the same implementation for initial address.

Ethernet and WiFi used the same implementation (and duplicated code) for
permanent MAC address, plus they both used ethtool in what should be
generic code, which is better done in the platform.

(cherry picked from commit aba250a7d4)
2015-06-17 16:19:19 +02:00
Dan Williams
c7ce5612ca platform: move driver & firmware version reading into the platform
(cherry picked from commit ddaea22332)
2015-06-17 16:19:19 +02:00
Dan Williams
081aeaf3e6 platform: add nm_platform_link_get_by_address()
(cherry picked from commit fa74ed7ca1)
2015-06-17 16:19:19 +02:00
Dan Williams
f8a9574f7e platform: ensure created interface matches requested type
If the caller requested that a bond be created, don't return success
if there was an existing bridge with the same name.

(cherry picked from commit 29ccb8851c)
2015-06-17 16:19:19 +02:00
Dan Williams
4b9f506bfd platform: return link objects from add functions
(cherry picked from commit 2abda4bfa5)
2015-06-17 16:19:19 +02:00
Dan Williams
19aa9f1325 core: move virtual interface name handling into device plugins
Instead of having a bunch of logic in the Manager for determining the
VLAN and Infiniband virtual interface names, move the type-specific
logic into the plugins themselves.

(cherry picked from commit 179d56c73c)
2015-06-17 16:19:19 +02:00