Commit graph

6148 commits

Author SHA1 Message Date
Thomas Haller
fb623df747 ifnet/test: rename test check_ifnet to test-ifnet
All our other test binaries are named "test-*" so rename this
one too. Also we gitignore "test-*.log" files, but didn't ignore
"check_ifnet.log".
2015-05-26 16:35:00 +02:00
Beniamino Galvani
90a7ad8dec ifnet/tests: convert to GLib test functions 2015-05-26 14:47:22 +02:00
Beniamino Galvani
fe765d30da ifnet/tests: fix GCC 5 warning about possible misuse of logical not
With GCC 5, -Wlogical-not-parentheses is enabled by -Wall and warns
about suspicious code like:

  int a;
  ...
  if (!a > 1) { ... }

Fix the following warning:

test_all.c: In function ‘test_is_static’:
test_all.c:114:32: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
  ASSERT (!is_static_ip6 ("eth0") == TRUE, "is static",
                                  ^
2015-05-26 14:47:22 +02:00
Lubomir Rintel
6463ce5dd9 tests: use the TAP formatter
The test results in standard format are easily integrated into CI systems.
2015-05-26 13:51:45 +02:00
Lubomir Rintel
14f4674f64 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.
2015-05-26 13:51:44 +02:00
Lubomir Rintel
f627d6db8e tests: move all asserts into tests
Otherwise the TAP formatter would produce a plan-less output.
2015-05-26 13:51:44 +02:00
Beniamino Galvani
a6f5aeeb28 dns: fall back to writing resolv.conf when other methods are not available
After commits:

de0d623680 dns: don't fall back to other methods when resolvconf or netconfig fail
e573977b80 dns: allow runtime selection of resolv.conf manager

the method used to write /etc/resolv.conf is specified by a
configuration parameter and NM doesn't try other methods if the chosen
one has not success.

Restore the fallback to the 'none' method if resolvconf or netconfig
executables are not available, so that when the value of 'rc-manager'
is misconfigured the system continues to work properly.

https://bugzilla.gnome.org/show_bug.cgi?id=749286
2015-05-26 13:33:47 +02:00
Thomas Haller
d43be83aaa libnm: enforce that "nm-utils-private.h" header is not used inside src/
Let "nm-utils-private.h" and "nm-types.h" conflict.
2015-05-20 12:42:19 +02:00
Thomas Haller
670ca44721 libnm: rename DNSOptionDesc and @dns_option_descs to have an "nm"-prefix
Declarations in header files should always have an "nm" related
prefix.

Fixes: 019943bb5d
2015-05-20 12:42:19 +02:00
Thomas Haller
533f9fa2d2 libnm: move internal dns-option helpers to "nm-core-internal.h"
"nm-utils-private.h" should not be used outside of libnm-core/.
core/ should only use public API or "nm-core-internal.h".

Also, "nm-setting-ip-config.h" is a public header and should
not contain internal defines. Move them to "nm-core-internal.h"
too.

Fixes: 019943bb5d
2015-05-20 12:42:14 +02:00
Dan Williams
e47eca8761 systemd: fix build with toolchains not exporting CLOCK_BOOTTIME
See 123322c6d6 for the NM-side fix.  We
need this too for the systemd code.
2015-05-19 16:02:28 -05:00
Dan Williams
2a7a19e767 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.
2015-05-19 09:25:16 -05:00
Dan Williams
5cf226463a 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.
2015-05-19 09:25:16 -05:00
Dan Williams
d4e0a1e8cc 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.
2015-05-19 09:25:16 -05:00
Dan Williams
81db512997 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.
2015-05-19 09:25:16 -05:00
Thomas Haller
652853e0d0 connectivity: use default on missing connectivity.interval config
Manual page claims that a missing configuration option for connectivity
interval means "300". That was not the case for a long time (never?).

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

Based-on-patch-by: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
2015-05-19 15:34:41 +02:00
Thomas Haller
5b04fde302 config: return internal field directly in nm_config_data_get_connectivity_interval()
We already initialize connectivity.interval apprepriately in constructor().
No need to MAX() it again.
2015-05-19 15:29:20 +02:00
Thomas Haller
ae0608eef5 config: minor fix in read_entire_config()
Calling read_entire_config() without passing a @cli argument would
always have caused an assert due to unset @o_config_main_file.
That is not a real problem as that situation didn't arise. Still
fix it.
2015-05-19 11:59:09 +02:00
Beniamino Galvani
8e46a737db dns: don't update error when writing private resolv.conf
When update_dns() fails, callers expect 'error' argument to point to a
non-NULL error; but we are reusing the same variable when calling
update_resolv_conf() to update the private resolv.conf and thus the
function may return an empty error on failure.

Don't reuse the same error and pass a NULL argument instead, since we
don't care about errors when updating private resolv.conf.

Fixes: 5f9d348c20
2015-05-19 10:38:55 +02:00
Beniamino Galvani
045938074d dns: accept NULL error argument in update_resolv_conf() 2015-05-19 10:38:52 +02:00
Thomas Haller
9ac4d88ff7 core: replace g_test_initialized() by nm_utils_get_testing() 2015-05-19 09:57:47 +02:00
Thomas Haller
d4dd9ba3cf keyfile: readd owner check of files (bgo #701112)
Commit 5dc4be54e6 dropped the
owner check for keyfiles to allow running `make check` as root.
Re-add it, but disable the check for tests.

https://bugzilla.gnome.org/show_bug.cgi?id=701112
2015-05-19 09:57:46 +02:00
Thomas Haller
b9d8dc050a core/tests: add nm_utils_get_testing() function
Code that is testable often needs special hooks to work
both for unit-tests and production.

Add a function nm_utils_get_testing() that returns whether
the code is run as part of a unit-test.

For non-testing mode, nm_utils_get_testing() will return
zero (NM_UTILS_TEST_NONE). For unit tests, the test should call
_nm_utils_set_testing() to configure tested functions.
By specifing the @flags attribute, the test can enable/disable
specific behaviors.

https://bugzilla.gnome.org/show_bug.cgi?id=701112
2015-05-19 09:57:46 +02:00
Thomas Haller
eb2efaa228 device: fix wrong assert in NMDeviceFactory
nm_device_factory_manager_find_factory_for_link_type()
easily can see a link-type NM_LINK_TYPE_UNKNOWN because
there are many link types that NetworkManager cannot detect.

Just return NULL early.

Fixes: 71bde20c30
2015-05-18 15:20:22 +02:00
Beniamino Galvani
09e216b8ab ifcfg-rh/tests: add missing file to EXTRA_DIST
'ifcfg-test-dns-options' was not included in the archive for
distribution and 'make distcheck' failed. Add it.
2015-05-14 16:55:15 +02:00
Beniamino Galvani
58236b0ab2 ifcfg-rh: use GLib test functions in new testcases for DNS options 2015-05-13 17:15:35 +02:00
Beniamino Galvani
66e63c1632 ifcfg-rh/tests: add tests for RES_OPTIONS parsing 2015-05-13 17:15:35 +02:00
Beniamino Galvani
a1d76a019e core: capture DNS options from resolv.conf 2015-05-13 17:15:35 +02:00
Beniamino Galvani
bb9c7e2c18 ifcfg-rh: support RES_OPTIONS 2015-05-13 17:15:34 +02:00
Beniamino Galvani
e7ff906f91 dns-manager: add support for DNS options 2015-05-13 17:15:34 +02:00
Beniamino Galvani
b02f59d4a4 core: add DNS options property to NMIP4Config and NMIP6Config 2015-05-13 17:15:34 +02:00
Thomas Haller
500cbcba21 platform/test: include call location in signal assertions
Hard to debug failures, if we don't print where the failure
happens.
2015-05-13 14:31:05 +02:00
Thomas Haller
050c644cce platform/test: make asserting signals more flexible
Support accepting more then one signal at a time.
It is to be expected, that one change in platform raises
several signals. Extend the assertion helpers to express
that.
2015-05-13 14:31:05 +02:00
Thomas Haller
4bdd83127d route-manager/test: fix missing initialization of temporary variables on stack
Up to now, this code was correct. Later we will add another field
to NMPlatformIP4Route which causes the test to operate on
uninitialized data.

Instead of explicitly initializing the field, just clear the whole
struct.
2015-05-13 14:31:05 +02:00
Thomas Haller
f167346534 platform: fix nm_platform_link_cmp() to consider ifindex 2015-05-13 14:31:05 +02:00
Thomas Haller
0c258402c7 platform: fix memleak in link_delete()
Turns out, the valgrind suppression was hiding a memleak
2015-05-13 14:24:06 +02:00
Beniamino Galvani
1d3eff45d2 device: set Ethernet MTU for PPPoE connections in stage2/config
Try to set the MTU of the parent Ethernet interface to match the
requested PPP MTU and MRU. This allows the negotiation of a PPP MTU
and MRU greater than 1492.
2015-05-13 13:29:51 +02:00
Dan Williams
6fdfb03107 Revert "ppp-manager: don't use kernel pppoe (rh #1034860, rh #1061641)"
We switched to user-mode PPPoE client to work around a bug in kernel
PPPoE code that caused pppd not to be notified when the connection was
terminated with a PADT before the LCP Termination Request.

The kernel bug has now been fixed upstream with commit 287f3a943fef
"pppoe: Use workqueue to die properly when a PADT is received", queued
for v4.1.

Since the issue affected only very particular scenarios and could
somehow be solved with the right configuration (see bugzilla entry),
we can safely revert the patch and restore the use of kernel mode
PPPoE.

This reverts commit 7955806a02.

https://bugzilla.gnome.org/show_bug.cgi?id=742939
2015-05-13 13:29:38 +02:00
Beniamino Galvani
0a04be41d4 device: set MTU on IP interface
Fixes: 7ba2a058f2
2015-05-13 13:29:38 +02:00
Thomas Haller
78c1849b53 core: fix compile error due to missing pointer cast
Fixes: 72baf9fa24
2015-05-13 12:30:37 +02:00
Lubomir Rintel
72baf9fa24 manager: AddAndActivateConnection(): don't save until the connection is activatable
https://bugzilla.redhat.com/show_bug.cgi?id=1174164
2015-05-12 17:26:25 +02:00
Thomas Haller
067202b34e core: use explict NMLogDomain enum instead of int
A while ago (f4f3f4d69b) we added an
enum to represent the logging domain. Use it.
2015-05-12 16:46:48 +02:00
Thomas Haller
0d7012faab 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
2015-05-12 14:37:36 +02:00
Thomas Haller
843205521f device: fix configuring static ip addresses
When a connection had static IP addresses, an early event
from plaform would clear them from priv->con_ip4_config.

Fix that, by don't initializing priv->con_ip4_config
before we commit the first time.

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

Fixes: 557667df12
2015-05-11 21:44:26 +02:00
Lubomir Rintel
26aeb12749 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.
2015-05-11 19:28:13 +02:00
Lubomir Rintel
d6aef9c188 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>
2015-05-11 19:28:13 +02:00
Lubomir Rintel
c8236ea694 build: re-add a line accidentally removed by the last merge 2015-05-11 11:35:52 +02:00
Beniamino Galvani
c029502912 ipv4ll: use internal implementation 2015-05-11 10:48:48 +02:00
Beniamino Galvani
c6302f3227 device: fix device state transition after IPv4LL failure
Don't terminate the entire connection if IPv4LL configuration fails
but instead call nm_device_check_ip_failed() to check the result of
IPv6 as well.
2015-05-11 10:48:48 +02:00
Beniamino Galvani
33d4232c3d device/trivial: move nm_device_check_ip_failed()
Move nm_device_check_ip_failed() upwards as it will be used by IPv4LL
code.
2015-05-11 10:48:48 +02:00