Commit graph

23097 commits

Author SHA1 Message Date
worldofpeace
ed03fcbd17 build: add PPPD_PATH to config.h.meson
Without this using -Dpppd= was completely broken.

First observed in NixOS [0]

[0]: https://github.com/NixOS/nixpkgs/issues/72330

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/323
(cherry picked from commit e1ead6fa98)
(cherry picked from commit 4c11364201)
2019-11-01 07:37:27 +01:00
Beniamino Galvani
497101fd1e dhcp: include conditionals from existing dhclient configuration
Since commit 159ff23268 ('dhcp/dhclient-utils: skip over
dhclient.conf blocks') we skip blocks enclosed in lines containing '{'
and '}' because NM should ignore 'lease', 'alias' and other
declarations. However, conditional statements seem useful and should
not be skipped.

https://bugzilla.redhat.com/show_bug.cgi?id=1758550
(cherry picked from commit b58e4d311d)
(cherry picked from commit 58ffded2d0)
2019-10-10 14:59:56 +02:00
Thomas Haller
efb18be2cb release: bump version to 1.18.5 (development) 2019-10-09 15:06:56 +02:00
Thomas Haller
92b19a1e69 release: bump version to 1.18.4 2019-10-09 15:06:25 +02:00
Dan Williams
4857e34b03 cli: complete *-slave types (bond-slave, bridge-slave, team-slave)
While shorthand for "type ethernet slave-type <foo>" they are accepted
as types by nmcli so we might as well complete them.

https://bugzilla.redhat.com/show_bug.cgi?id=1654062

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/193
(cherry picked from commit f0e4137e1d)
2019-10-09 11:23:20 +02:00
Thomas Haller
bea517465a release: update NEWS 2019-10-08 16:54:58 +02:00
Thomas Haller
add572607e all: merge branch 'test-and-build-fixes-for-nm-1-18' into nm-1-18
Backport various kinds of build and test fixes. Now our gitlab-ci setup
on nm-1-18 is very similar to what we also do on nm-1-20 branch and
runs the same kind of tests.
2019-10-08 16:40:36 +02:00
Thomas Haller
173e6bbffb src/tests: show exit status in test failure of test_nm_utils_kill_child()
This test keeps randomly failing. Rework is, so that we see the actual
exit status in the output of the failed test.

(cherry picked from commit 49c6fa2ba7)
2019-10-08 16:37:49 +02:00
Thomas Haller
0ed8baa00f core/tests: avoid deprecated g_main_run()/g_main_loop_unref() in test
These are deprecated. Also, they are nowadays implemented as macros
that expand to

  #define g_main_run(loop) g_main_loop_run(loop) GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_main_loop_run)

This can cause compilation failure (in some environments).

(cherry picked from commit de6f0bc6db)
(cherry picked from commit 9e209138dc)
2019-10-08 16:37:10 +02:00
Thomas Haller
49069cad59 libnm-glib: don't use deprecated g_thread_supported() and g_thread_init()
Building the sources requires libnm newer than glib 2.32, but
g_thread_supported() and g_thread_init() are deprecated since
2.32.

This causes a build failure due to the deprecated warning.
2019-10-08 15:35:45 +02:00
Thomas Haller
67128fe6c0 checkpatch,gitlab-ci: let checkpatch script compare against latest upstream master
When opening a merge request from a fork of NetworkManager, then the
pipeline runs with the a checkout of the fork. That means, checkpatch
would compare the branch against "master" (or "nm-x-y" stable branches)
of the fork, instead of upstream.

That doesn't seem too useful. Instead, also add upstream NetworkManager
as git remote, fetch the branches, and use the branches from there as
base for checkpatch.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/255
(cherry picked from commit 3019648b4b)
(cherry picked from commit 9a37702311)
2019-10-08 15:26:52 +02:00
Thomas Haller
6dde55e22b gitlab-ci: workaround unit test failure for iproute2 bug in "ubuntu:devel"
"ubuntu:devel" ships iproute2 version "5.2.0-1ubuntu1". This has a well known
bug that prevents it from creating IP tunnels during the unit tests.

We already workaround that on Debian. Add the same workaround to match the
Ubuntu package.

(cherry picked from commit 44193d3def)
(cherry picked from commit 27c23b0748)
2019-10-08 15:26:52 +02:00
Thomas Haller
7b4f89ee9b build,tests: merge branch 'th/fix-python-test'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/287

(cherry picked from commit 18f890d491)

(cherry picked from commit f73879899b)
2019-10-08 15:26:52 +02:00
Thomas Haller
66980f57ab contrib/rpm: "Suggest" wpa_supplicant for NetworkManager-wifi package
"NetworkManager-wifi" package requires either wpa_supplicant or iwd.
When installing the package without explicitly installing supplicant
or iwd (and not having it installed yet), then we want to drag in
wpa_supplicant by default. That is accomplished by suggesting wpa_supplicant
package.

Otherwise, the user installing NetworkManager-wifi might get iwd,
which is only functioning if the user explicitly enables the backend
in "NetworkManager.conf".

https://bugzilla.redhat.com/show_bug.cgi?id=1743585
(cherry picked from commit 4b1cb404fd)
(cherry picked from commit c44c796a90)
2019-10-08 15:26:51 +02:00
Thomas Haller
5a32fa961e gitlab-ci: add building on Fedora 31
And don't build Fedora 28 by default. It's aleady end of life.
But for now keep it, so it can be triggered manually.

(cherry picked from commit b40a3aa727)
(cherry picked from commit 6a4129485a)
2019-10-08 15:26:51 +02:00
Thomas Haller
f19cf354a3 gitlab-ci: workaround build failure in Debian:sid due to iproute2 issue
Our platform unit tests try to add an IP tunnel using iproute2.
That fails with

    "add tunnel "ip6tnl0" failed: File exists"

This is a bug in iproute2-5.2.0, see [1].

Workaround the issue by downgrading the package.

[1] https://www.spinics.net/lists/netdev/msg584916.html

(cherry picked from commit be76d8b624)
2019-10-08 15:26:51 +02:00
Thomas Haller
1a0b344686 build/meson: use python3 interpreter for "generate-setting-docs.py"
Fedora 32 drops "python" from the path. Hence "/usr/bin/env python" won't
work anymore. Of course, who needs a way to invoke the interpreter that works
accross different distributions! WTF.

In this case, easy to work around. We run it from meson, so we have access to
the Python 3 binary. Just call python explicitly, like we do with autotools.

(cherry picked from commit 7c7ad97831)
(cherry picked from commit c162dc00e5)
2019-10-08 15:26:51 +02:00
Thomas Haller
be1a3ffa0e gitlab-ci: add manual build step to test on ubuntu:rolling and ubuntu:devel
Rolling is the latest release (regardless of whether LTS), currently
that would be 19.04.

Devel is the next release, currently that would be 19.10.

Add manual build steps to trigger those builds so we can manually verify
that they pass.

(cherry picked from commit 13b4cad989)
2019-10-08 15:26:51 +02:00
Thomas Haller
543daa0f5d tests: don't install bzip2 as REQUIRED_PACKAGES on Fedora/RHEL
(cherry picked from commit 3a1b2b9885)
(cherry picked from commit 2b01ac0932)
2019-10-08 15:26:51 +02:00
Thomas Haller
24554b6cce gitlab-ci: enable test build on Debian 10 (buster)
(cherry picked from commit bf1cadbdc7)
2019-10-08 15:26:51 +02:00
Thomas Haller
ce79b9a9b5 tests: don't install unnecessary package in gitlab-ci tests
REQUIRED_PACKAGES has two uses:

 - to setup a system for developing NetworkManager. This installs
   convenience packages like "cscope".

 - to install the packages required for unit testing in gitlab-ci.

For gitlab-ci we should only install the packages that we actually
need.

(cherry picked from commit 1a2a5b37b4)
(cherry picked from commit 6ff16a48bb)
2019-10-08 15:26:51 +02:00
Thomas Haller
a05cc0e573 gitlab-ci: merge branch 'th/gitlab-ci-centos'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/170

(cherry picked from commit 94ccc22d66)
2019-10-08 15:26:51 +02:00
Thomas Haller
8845384e06 tests: fix failure installing non-existing packages in REQUIRED_PACKAGES
Previously, dnf/yum used to ignore packages that didn't exist.
In Fedora 32, dnf starts to fail the entire command:

  No match for argument: python-gobject-base
  Error: Unable to find a match: python-gobject-base

Since this script is supposed to work with different RHEL/Fedora
versions, it's expected that not all packages are available everywhere.

Fix that, by installing packages that we know that they might be missing
one by one (and ignore the error).

(cherry picked from commit 185567559c)
(cherry picked from commit 888718d6f4)
2019-10-08 15:26:51 +02:00
Thomas Haller
298e57e446 tests: fix "clients/tests/test-client.py" concatenating binary for Python 3
Python 3 doesn't like this:

    ======================================================================
    ERROR: test_001 (__main__.TestNmcli)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "./clients/tests/test-client.py", line 785, in f
        self._nm_test_post()
      File "./clients/tests/test-client.py", line 767, in _nm_test_post
        content_new = ''.join([r['content'] for r in results])
    TypeError: sequence item 0: expected str instance, bytes found

(cherry picked from commit 97646d81ce)
(cherry picked from commit ae2d6c0bc9)
2019-10-08 15:26:51 +02:00
Thomas Haller
4023968251 tests: don't compare string literal with "is" in "clients/tests/test-client.py"
Recent Python versions warn about this:

  ./clients/tests/test-client.py:569: SyntaxWarning: "is" with a literal. Did you mean "=="?
    elif lang is de:
  ./clients/tests/test-client.py:572: SyntaxWarning: "is" with a literal. Did you mean "=="?
    elif lang is pl:

And rightly so: https://bugs.python.org/issue34850

(cherry picked from commit 989b26a843)
(cherry picked from commit 992c5abb53)
2019-10-08 15:26:51 +02:00
Thomas Haller
1fc4ab1186 tests: avoid deprecated GLib.IOChannel.add_watch() in "test-networkmanager-service.py"
test_001 (__main__.TestNmcli) ... /tmp/NetworkManager/tools/test-networkmanager-service.py:2346: PyGIDeprecationWarning: add_watch is deprecated; use GLib.io_add_watch() instead
  id1 = GLib.IOChannel(0).add_watch(GLib.IOCondition.HUP,

(cherry picked from commit ceae05cc4b)
(cherry picked from commit a2af6cc298)
2019-10-08 15:26:51 +02:00
Thomas Haller
34bdc6caa1 shared: add _NM_ENSURE_TYPE_CONST()
The sole purpose of this is more type-safe macros.

An alternative solution would be to define a function instead of a
macro. But if the function is unused (currently!) you get a compiler
warning (on some compilers even when marking the function as "static
inline", if it's in the source file). A workaround for that would be
to mark the function as _nm_unused, or to use a macro instead.

_NM_ENSURE_TYPE_CONST() is to aid the macro solution.

(cherry picked from commit 17dc6a9da6)
2019-10-08 15:26:50 +02:00
Thomas Haller
656109c3d0 gitlab-ci: also build on CentOS 7.5 and 7.6
(cherry picked from commit 896dc7d4d9)
2019-10-08 15:26:50 +02:00
Thomas Haller
07ccf36ed0 platform/tests: rename platform's "test-general.c"
Older versions of meson don't like building multiple artifacts
with the same name (even if they are in different directories). We
have multiple tests called "test-general.c", and it would be natural
to compile a test binary of the same name.

  Meson encountered an error in file src/tests/meson.build, line 14, column 2:
  Tried to create target "test-general", but a target of that name already exists.

It's generally a bad idea to have in our source tree multiple files with the
same name. Rename the test.

Fixes: 16cd84d346 ('build/meson: rename platform tests to use same name as autotools'):
(cherry picked from commit 041aa3d605)
2019-10-08 15:26:50 +02:00
Thomas Haller
78d8cde326 gitlab-ci: run "checkpatch" test on Fedora 29 image
Fedora 28 is no longer supported at this point. Run the "checkpatch"
test on a Fedora 29 image instead.

(cherry picked from commit c9873d4273)
2019-10-08 15:26:50 +02:00
Thomas Haller
87c0e8dc83 gitlab-ci: disable valgrind on Fedora 30 and Fedora 31 depending on glib2 package
Valgrind is known to report many false positives with certain glib2
versions. Workaround that by disabling it based on the installed
package version.

See-also: https://bugzilla.redhat.com/show_bug.cgi?id=1710417
See-also: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/155
(cherry picked from commit 5e11d4bf1f)
2019-10-08 15:26:50 +02:00
Thomas Haller
42e8930f80 build: disable "-Wunknown-pragmas" warning
clang on CentOS 7.6 (3.4.2-9.el7) warns:

      CC       clients/tui/newt/clients_tui_newt_libnmt_newt_a-nmt-newt-button.o
    In file included from ../clients/tui/newt/nmt-newt-button.c:26:
    In file included from ../shared/nm-default.h:280:
    ../shared/nm-glib-aux/nm-macros-internal.h:1617:2: error: unknown warning group -Wstringop-truncation, ignored [-Werror,-Wunknown-pragmas]
            NM_PRAGMA_WARNING_DISABLE ("-Wstringop-truncation");
            ^
    ../shared/nm-glib-aux/nm-macros-internal.h:419:9: note: expanded from macro NM_PRAGMA_WARNING_DISABLE
            _Pragma(_NM_PRAGMA_WARNING_DO(warning))
            ^
    <scratch space>:109:25: note: expanded from here
     GCC diagnostic ignored "-Wstringop-truncation"
                            ^

This warning totally defeats the purpose of why we use the pragma in the
first place.

(cherry picked from commit a307bd6ec4)
2019-10-08 15:26:50 +02:00
Thomas Haller
cdfee89c4c ci: merge branch 'th/gitlab-ci-valgrind'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/155

(cherry picked from commit faf55eb2f8)
2019-10-08 15:26:50 +02:00
Thomas Haller
73d4b36e2a clients/tests: increase timeout waiting for stub D-Bus service
I saw this timeout reached in our gitlab-ci. I think it was due to the machine
being busy and taking more than 2 seconds. Assuming the timeout was just too short,
increase it to 4 seconds.

(cherry picked from commit 7af1fc803e)
2019-10-08 15:26:50 +02:00
Thomas Haller
1f3b342ad4 platform: avoid compiler error passing NMP_OBJECT_CAST_OBJ_WITH_IFINDEX() to nm_hash_update_vals()
Clang (3.4.2-9.el7) on CentOS 7.6 fails related to nm_hash_update_vals().

Clang seems to dislike passing certain complex arguments to typeof().
I'd prefer to fix nm_hash_update_vals() to not have this problem,
but I don't know how.

This works around the issue.

(cherry picked from commit 5113c5bd00)
2019-10-08 15:26:50 +02:00
Thomas Haller
1ff0ba0fab platform: make nm_platform_kernel_support_get() macro an inline function
clang (3.4.2-9.el7) on CentOS 7.6 fails related to nm_hash_update_vals().

I am not even quoting the error message, it's totally non-understandable.

nm_hash_update_vals() uses typeof(), and in some obscure cases, clang dislikes
when the argument itself is some complex macro. I didn't fully understand why,
but this works around it.

I would prefer to fix nm_hash_update_vals() to not have this limitation.
But I don't know how.

There is probably no downside to have this an inline function instead of
a macro.

(cherry picked from commit ad06cc78dc)
2019-10-08 15:26:50 +02:00
Thomas Haller
82de6c9180 shared: fix _NM_ENSURE_TYPE_CONST() for const pointers with clang
Clang 3.4.2-9.el7 on CentOS7.6 complains about missing generic type match:

    ../dispatcher/nm-dispatcher.c:243:2: error: controlling expression type 'const Request *const' (aka 'const struct Request *const') not compatible with any generic association type
            _LOG_R_D (request, "start running ordered scripts...");
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: 17dc6a9da6 ('shared: add _NM_ENSURE_TYPE_CONST()')
(cherry picked from commit 3d42b2f1fa)
2019-10-08 15:26:50 +02:00
Thomas Haller
05576bd9cf tests: use "/run" instead of "/var/run"
(cherry picked from commit 10688e3d88)
2019-10-08 15:26:49 +02:00
Thomas Haller
3c9d9b0f51 gitlab-ci: run unit tests under valgrind in gitlab-ci
On Ubuntu 16.04 (trusty) valgrind fails due to rdrand being advertised
but not implemented.

Work around that by installing valgrind from Ubuntu 18.04 (bionic) via
the "contrib/scripts/nm-ci-install-valgrind-in-ubuntu1604.sh" script.

(cherry picked from commit 6d76a0974e)
2019-10-08 15:26:49 +02:00
Thomas Haller
cd8c375849 ci: randomize tests during our CI
This affects gitlab-ci and travis-ci, which both run this script.

(cherry picked from commit 70487d9ff8)
2019-10-08 15:26:49 +02:00
Thomas Haller
0f1900b4f7 build/meson: rename platform tests to use same name as autotools
First of all, all file names in our source-tree should be unique. We should
not have stuff like "libnm-core/tests/test-general.c" and "src/tests/test-general.c".
The problem here are the C source files, and consequently also the test
binaries have duplicate names. We should avoid that in general. However,
our binaries should have a matching name with the C source. If
"test-general.c" is not good enough, that needs renaming. Not building
"platform-test-general" out of it.

On the other hand, all our tests should have a filename "*/tests/test-*", like
they do for autotools.

Rename the meson platform tests.

It's also important because "tools/run-nm-test.sh" relies on the test
name to workaround valgrind warnings.

(cherry picked from commit 16cd84d346)
2019-10-08 15:26:49 +02:00
Thomas Haller
a96f601c8a contrib/rpm: fix comment in ./build_clean.sh -h output
(cherry picked from commit c307f07207)
2019-10-08 15:26:49 +02:00
Beniamino Galvani
f754f97900 device: don't reapply IP config on link up for disconnected devices
Only reapply the IP configuration on link up if the IP state is CONF
or DONE. Previously we also reapplied it when the device was
disconnected (IP state NONE) and this could lead to a situation where
an incomplete config was applied; then we intersected the desired
configuration with the external - incomplete - one, causing the
removal of part of desired configuration (for example the default
route).

Fixes: d0b16b9283 ('device: unconditionally reapply IP configuration on link up')

https://bugzilla.redhat.com/show_bug.cgi?id=1754511
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/291
(cherry picked from commit 64a9dd3804)
(cherry picked from commit 722cddfad8)
2019-10-08 14:25:20 +02:00
Beniamino Galvani
97e89e7d34 build: use regexp in gtkdoc --ignore-decorators option
gtkdoc-scan supports regular expressions in the --ignore-decorators
command-line option. Since it is easier to use a regexp than grepping
macros from a source file, revert the ugly solution from commit
2d941dc95a ('build: fix errors when building with gtk-doc 1.32').

(cherry picked from commit 11cf082a62)
(cherry picked from commit a369e61d2a)
2019-10-08 14:04:09 +02:00
Beniamino Galvani
1a3fccc682 build: fix errors when building with gtk-doc 1.32
gtkdoc-scan 1.32 performs stricter checks on structures definitions
and so it complains on:

 /build/networkmanager/src/NetworkManager/libnm/./nm-vpn-plugin-old.h:0: warning: partial declaration (struct) : typedef struct {
 	NM_DEPRECATED_IN_1_2
 	GObject parent;
 } NMVpnPluginOld NM_DEPRECATED_IN_1_2;

because of the unrecognized token 'NM_DEPRECATED_IN_1_2'.

Pass all allowed macros to gtkdoc-scan through the --ignore-decorators
argument.

https://gitlab.gnome.org/GNOME/gtk-doc/issues/98
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/238
(cherry picked from commit 2d941dc95a)
(cherry picked from commit d5ed990caf)
2019-10-08 14:04:09 +02:00
Thomas Haller
173782d733 wifi/p2p: fix crash due to invalid signal handler supplicant_group_iface_group_finished_cb()
Fixes: 00e64d1332 ('core/devices: Add P2P Wifi device and peer tracking')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/249

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/284
(cherry picked from commit 9aa6c676ef)
(cherry picked from commit 2d7195fc9d)
2019-09-23 13:27:21 +02:00
Beniamino Galvani
ade9864366 wifi: allow reapply when the seen-bssids property changed
wifi.seen-bssid is a synthetic read-only property that lists all the
bssids seen for that connection; it should be ignored during a
reapply.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/243
(cherry picked from commit 8cd8a5fbed)
(cherry picked from commit 81cc4ddb1a)
2019-09-13 14:31:47 +02:00
Beniamino Galvani
d6c3d9c9dc core: fix adding objects to NMIPConfig with @append_force
If the @append_force argument is set and the object is already in the
list, it must be moved at the end.

Fixes: 22edeb5b69 ('core: track addresses for NMIP4Config/NMIP6Config via NMDedupMultiIndex')
(cherry picked from commit 8b121c7048)
(cherry picked from commit 52241748e8)
2019-08-28 16:19:31 +02:00
Beniamino Galvani
eb56d48c0b core: add test to show nm_ipX_config_replace() bug
Add test to show a wrong result of ip_ipX_config_replace() due to a
bug in _nm_ip_config_add_obj(). When an address is added to the tail
of the index and another address with the same id already exists, the
existing object is left at the same place, breaking the order of
addresses.

(cherry picked from commit 24741bff8b)
(cherry picked from commit ebaf890057)
2019-08-28 16:19:30 +02:00
Thomas Haller
b629570a75 bluetooth: fix leak in get_managed_objects_cb()
Fixes: 1ae5d53354 ('bluez: add support for BlueZ 5')
(cherry picked from commit 25571bb639)
(cherry picked from commit 6118f808d9)
2019-08-23 13:19:11 +02:00