Commit graph

26269 commits

Author SHA1 Message Date
Thomas Haller
54dcfeffa0
po: make update-po
(cherry picked from commit 9ee13a5656)
2020-09-08 12:54:02 +02:00
Thomas Haller
5bea8db7ca
initrd/tests: fix memleak in test_dhcp_vendor_class_id()
Having leaks in the tests, breaks running the test under valgrind. There
must be no leaks.

Fixes: c056cb9306 ('initrd: parse 'rd.net.dhcp.vendor-class' kernel cmdline arg')
(cherry picked from commit bff23d15d4)
2020-09-03 11:38:22 +02:00
Antonio Cardace
bba54613eb
initrd: fix memory leak
Signed-off-by: Antonio Cardace <acardace@redhat.com>
Fixes: 9f9609555d ('initrd: add configuration generator')
(cherry picked from commit d5c05d07c7)
2020-09-02 10:10:09 +02:00
Antonio Cardace
ad36890282
initrd: merge branch 'ac/dhcpclass-initrd'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/614

Signed-off-by: Antonio Cardace <acardace@redhat.com>

(cherry picked from commit 5748e986aa)
2020-09-01 17:07:01 +02:00
Antonio Cardace
15856a4fa2
initrd: parse 'rd.net.dhcp.vendor-class' kernel cmdline arg
This arguments makes NM set the ipv4.dhcp-vendor-class-identifier
property for all connections.

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

Signed-off-by: Antonio Cardace <acardace@redhat.com>
(cherry picked from commit c056cb9306)
2020-09-01 17:07:00 +02:00
Antonio Cardace
847488cb2f
core: add 'dhcp-vendor-class-identifier' validation function
So that it can be reused.

Signed-off-by: Antonio Cardace <acardace@redhat.com>
(cherry picked from commit 5cca669ff3)
2020-09-01 17:07:00 +02:00
Beniamino Galvani
dac89c0727 device: fix autoactivating virtual devices after a failure
When a virtual device fails, its state goes to FAIL and then
DISCONNECTED. In DISCONNECTED we call schedule_activate_check() to
schedule an auto-activation if needed. We also schudule the deletion
of the link through delete_on_deactivate_check_and_schedule(). The
auto-activation attempt fails because the link deletion unmanages the
device; as a result, the device doesn't try to auto-activate again.

To fix this:

 - don't allow the device to auto-activate if the device deletion is
   pending;

 - check again if the device can be auto-activated after its deletion.

https://bugzilla.redhat.com/show_bug.cgi?id=1818697
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/613
(cherry picked from commit e404585e60)
2020-08-31 11:48:35 +02:00
Thomas Haller
9f7736ea8e
gitlab-ci: fix workarounds for Ubuntu 16.04 in tests
The detection for Ubuntu 16.04 was broken. By now /etc/os-release
contains

    VERSION="16.04.7 LTS (Xenial Xerus)"

(cherry picked from commit 12e8557476)
2020-08-28 16:16:45 +02:00
Thomas Haller
32641b9fca
device: fix casting pointer to enum for sriov_reset_on_deactivate_cb()
Avoids a compiler warning:

    ../src/devices/nm-device.c:16079:26: error: cast to smaller integer type 'NMDeviceStateReason' from 'gpointer' (aka 'void *') [-Werror,-Wvoid-pointer-to-enum-cast]
            deactivate_ready (self, (NMDeviceStateReason) reason);
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: 121c58f0c4 ('core: set number of SR-IOV VFs asynchronously')
(cherry picked from commit 918ebd600a)
2020-08-28 12:54:12 +02:00
Antonio Cardace
43774ec13a
dhcp: merge branch 'ac/dhcp_vendor_class_opt'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/610

(cherry picked from commit 21e6ed2852)
2020-08-26 12:01:30 +02:00
Antonio Cardace
76820f04c7
dhcp: implement dhcp-vendor-class-identifier option for systemd's DHCP
client

https://bugzilla.redhat.com/show_bug.cgi?id=1871042
Signed-off-by: Antonio Cardace <acardace@redhat.com>
(cherry picked from commit 5da0939a3f)
2020-08-26 11:57:21 +02:00
Antonio Cardace
18ff5984f7
dhcp: implement dhcp-vendor-class-identifier option for internal DHCP client
https://bugzilla.redhat.com/show_bug.cgi?id=1871042
Signed-off-by: Antonio Cardace <acardace@redhat.com>
(cherry picked from commit f8a7290153)
2020-08-26 11:57:21 +02:00
Antonio Cardace
c7c5b88a83
core: add support for dhcpv4 vendor class identifier option
https://bugzilla.redhat.com/show_bug.cgi?id=1871042
Signed-off-by: Antonio Cardace <acardace@redhat.com>
(cherry picked from commit f71f40bc20)
2020-08-26 11:57:20 +02:00
Antonio Cardace
8b791c9837
ifcfg-rh: add support for the DHCP_VENDOR_CLASS_IDENTIFIER option
https://bugzilla.redhat.com/show_bug.cgi?id=1871042
Signed-off-by: Antonio Cardace <acardace@redhat.com>
(cherry picked from commit e9ed5f02ba)
2020-08-26 11:57:20 +02:00
Antonio Cardace
555f2bfc61
libnm-core,clients: add support for ipv4.dhcp-vendor-class-identifier option
https://bugzilla.redhat.com/show_bug.cgi?id=1871042
Signed-off-by: Antonio Cardace <acardace@redhat.com>
(cherry picked from commit d7235394b2)
2020-08-26 11:57:19 +02:00
Antonio Cardace
00132cecb5
version: add NM_VERSION_1_26_4/NM_AVAILABLE_IN_1_26_4 macros
Signed-off-by: Antonio Cardace <acardace@redhat.com>
2020-08-26 11:57:07 +02:00
Thomas Haller
5c6d996825
release: bump version to 1.26.3 (development) 2020-08-19 09:39:39 +02:00
Thomas Haller
c3c6c426df
release: bump version to 1.26.2 2020-08-19 09:39:39 +02:00
Thomas Haller
50761daae8
NEWS: update
(cherry picked from commit 5409db9fbd)
2020-08-19 09:36:01 +02:00
Thomas Haller
853ab22cf6
gitlab-ci: enable fedora:33 build and generate pages on F32
(cherry picked from commit e1e1241aae)
2020-08-18 23:49:02 +02:00
Thomas Haller
2845a28c6a
tools: minor cleanup to ensure "from_meson" variable is yet set from extern
(cherry picked from commit 3b70efa9b6)
2020-08-18 23:06:10 +02:00
Thomas Haller
ca19b12dc2
contrib/rpm: enable LTO by default on RHEL-9 and newer
(cherry picked from commit 2c12786e3d)
2020-08-18 23:05:18 +02:00
Thomas Haller
75e8f4c36f
ndisc/tests: relax assertion in "test-ndisc-fake.c"
Still assertion failures:

  ERROR:../src/ndisc/tests/test-ndisc-fake.c:375:test_preference_changed_cb: assertion failed (_a->timestamp >= _ts): (9 >= 10)

(cherry picked from commit a5133e708e)
2020-08-17 15:55:55 +02:00
Thomas Haller
60f92ca403
contrib/rpm: prefer keyfile settings plugin from Fedora 33 and newer
This change is for Fedora 33 and newer. For now, also enable it for RHEL
9 and newer, but it must still be decided whether that will be done
there as well.

https://mail.gnome.org/archives/networkmanager-list/2020-May/msg00002.html
https://fedoraproject.org/wiki/Changes/NetworkManager_keyfile_instead_of_ifcfg_rh
https://lists.fedoraproject.org/archives/list/devel-announce@lists.fedoraproject.org/thread/OLOU27DAON2TYGTAVZ35GZE2BEIN42U3/
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/OLOU27DAON2TYGTAVZ35GZE2BEIN42U3/
https://pagure.io/fesco/issue/2432

https://bugzilla.redhat.com/show_bug.cgi?id=1857391
(cherry picked from commit 3e475e5cd1)
2020-08-17 15:41:57 +02:00
Thomas Haller
53d15e95c1
scripts: use "/bin/cat" in NM-log
Ubuntu 16.04 doesn't have merged /usr directories and cat is in
/bin/cat.

(cherry picked from commit 67cc4544f7)
2020-08-17 15:41:32 +02:00
Thomas Haller
18171a3a33
build: merge branch 'th/fix-lto'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/605

(cherry picked from commit b8ac53905d)
2020-08-17 15:40:06 +02:00
Thomas Haller
8fbf6aeced
contrib/rpm: enable LTO by default on Fedora 33
With Fedora 33, LTO will be enabled by default via CFLAGS in
redhat-rpm-config ([1]).

That basically sets "CFLAGS=-flto -ffat-lto-objects".

Note that we have our own configure/meson option to enable LTO.
With "--with-lto" we set CFLAGS="-flto -flto-partition=none". This
is necessary due ([2], [3]).

So, disable Fedora's automatism, but turn on the suitable configure
option to get working LTO.

[1] 5baaf4a99c
[2] e6cf4213a7 ('build: fix building with LTO')
[3] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48200#c28

(cherry picked from commit 839ba57c7f)
2020-08-17 15:40:06 +02:00
Thomas Haller
aabbd0e8de
build: disable "-Wstringop-overflow" warning with LTO enabled
No amount of _Pragma was able to disable this warning.

    In function ‘strncpy’,
        inlined from ‘_nm_strndup_a_step’ at ./shared/nm-glib-aux/nm-macros-internal.h:1367:3,
        inlined from ‘nms_keyfile_nmmeta_check_filename’ at src/settings/plugins/keyfile/nms-keyfile-utils.c:61:0:
    /usr/include/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
      106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
          |          ^
    src/settings/plugins/keyfile/nms-keyfile-utils.c: In function ‘nms_keyfile_nmmeta_check_filename’:
    src/settings/plugins/keyfile/nms-keyfile-utils.c:44: note: length computed here
       44 |  len = strlen (filename);
          |
    lto1: all warnings being treated as errors

Oddly enough, gcc is still emitting the warning even with "-Wno-stringop-overflow",
but at least it doesn't break the build.

(cherry picked from commit 407a1f1e98)
2020-08-17 15:40:05 +02:00
Thomas Haller
6f82699ef7
clients/tests: ensure that we run nmcli before client tests for LTO
nmcli is build with libtool, so "clients/cli/nmcli" is really a shell script
that invokes the real nmcli (at "clients/cli/.libs/nmcli").

When building with LTO for some reasons "clients/cli/nmcli" still
does some build steps during the first invocation.

That means, if we run `make check-local-clients-tests-test-client` it
would first do the final build step. This takes a while, and the test
times out (worse, we do that build step many times in parallel).

Avoid that by invoking "clients/cli/nmcli" first.

(cherry picked from commit 00e3fc036a)
2020-08-17 15:40:05 +02:00
Thomas Haller
bfa5a58642
build: fix generating "NetworkManager.ver" with LTO
We use a linker version script "NetworkManager.ver", to hide
symbols from NetworkManager that are not used. That is important
due to our habit of using internal helper libraries that we link
statically everywhere, without handpicking the symbols we actually
need. We want the tooling to get rid of unnecessary symbols.

However, NetworkManager loads shared libraries for settings and device
plugins. These libraries require symbols from the NetworkManager binary,
but which one depends on build options. Hence, we also generate
"NetworkManager.ver" by the "tools/create-exports-NetworkManager.sh"
script.

For that the script uses "nm" to find symbols that are undefined in the
plugin libraries but defined in NetworkManager. With autotools the
script looked at "./src/.libs/libNetworkManager.a" to find the present
symbols. Note that for meson that already didn't work, and we build
instead an intermediate NetworkManager binary first (with all symbols
exposed). With LTO, "nm" doesn't find all symbols in
"./src/.libs/libNetworkManager.a", and consequently they are not
exported and dropped/hidden.

This also causes unit tests to fail with LTO, because our test script
"tools/check-exports.sh" catches such bugs.

Fix that by also with autotools generate a complete "NetworkManager-all-sym"
binary that is used to generate "NetworkManager.ver", before rebuilding
"NetworkManager" again.

(cherry picked from commit c92a3ca5c2)
2020-08-17 15:40:05 +02:00
Thomas Haller
043bf59602
build: prefer python3 over python2 in autotools's configure script
On Debian sid, pygobject no longer builds "python-gobject" for
python2. Still, python2 may be installed and detected preferably
by AM_PATH_PYTHON(). Add workaround.

(cherry picked from commit 54a1cfa973)
2020-08-17 15:40:05 +02:00
Thomas Haller
f5aafb9da4
core: avoid deprecated matchfilecon SELinux API instead of selabel
The matchfilecon API is deprecated for a very long time. Since selinux 3.1
the functions are also marked as deprecated in the header, which causes
compiler warnings and build failures.

Update the code to use selabel API instead.

(cherry picked from commit 173533c3b2)
2020-08-17 15:40:05 +02:00
Thomas Haller
12fa5897ad
all: avoid wrong compiler warning about uninitalized variables with LTO
Seems with LTO the compiler can sometimes think that thes variables are
uninitialized. Usually those code paths are only after an assertion was
hit (g_return*()), but we still need to workaround the warning.

(cherry picked from commit 70971d1141)
2020-08-17 15:40:05 +02:00
Thomas Haller
20cc1385dd
tests: fix handling of $NMTST_LIBTOOL in "tools/run-nm-test.sh" script
(cherry picked from commit 0bd8160029)
2020-08-17 15:40:05 +02:00
Thomas Haller
df626ef80b
n-dhcp4: merge branch 'th/fix-lto-compiler-warnings'
https://github.com/nettools/n-dhcp4/pull/20

(cherry picked from commit 689ebd0d60)
2020-08-17 15:39:45 +02:00
Thomas Haller
2ea10a4c23
n-dhcp4/connection: avoid compiler warning in n_dhcp4_c_connection_connect() about fd_udp uninitialized
With LTO and optimizations enabled, we get a compiler warning about fd_udp
not initialized:

  ../src/n-dhcp4-c-connection.c: In function ‘n_dhcp4_c_connection_connect’:
  ../src/n-dhcp4-c-connection.c:196:13: error: ‘fd_udp’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
    196 |         r = epoll_ctl(connection->fd_epoll,
        |             ^
  ../src/n-dhcp4-c-connection.c:185:16: note: ‘fd_udp’ was declared here
    185 |         int r, fd_udp;
        |                ^

6c6e936898
(cherry picked from commit 4e0e002092)
2020-08-17 15:39:44 +02:00
Thomas Haller
9a021d7227
n-dhcp4/packet: avoid compiler warning in n_dhcp4_c_socket_packet_recv()
gcc-10.2.1-1.fc32 with optimizations and LTO enabled can think that "len"
is uninitialized. Let packet_recv_udp() always set the length.

  ../src/n-dhcp4-socket.c: In function ‘n_dhcp4_c_socket_packet_recv.constprop’:
  ../src/n-dhcp4-incoming.c:210:29: error: ‘len’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
    210 |         incoming->n_message = n_raw;
        |                             ^
  ../src/n-dhcp4-socket.c:558:16: note: ‘len’ was declared here
    558 |         size_t len;
        |                ^

142eedcfc3
(cherry picked from commit 08318a0bac)
2020-08-17 15:39:44 +02:00
Thomas Haller
99b362c944
core: fix selecting of best-default-route to consider only unicast routes
Fixes: 5d0d13f570 ('platform: add support for local routes')
(cherry picked from commit 2a1bac6b8a)
2020-08-14 16:54:01 +02:00
Thomas Haller
cf3cff4f12
core: only expose "type unicast" routes on D-Bus
Currently, we would not mark non-unicast routes with their type, so they
would wrongly appear as unicast routes in the D-Bus API.

That is wrong. For now, just hide them.

Fixes: 5d0d13f570 ('platform: add support for local routes')
(cherry picked from commit 5035687a7b)
2020-08-14 16:53:57 +02:00
Thomas Haller
4e6fcb4a71
settings: suppress wrong warning about wait-device-timeout for devices that are still busy
Imagine we wait for a device, the device appears and starts activating.
That might take a while (during which it has a pending action). In the
meantime, the "connection.wait-device-timeout" timeout expires.

Now we want to log a warning about profiles that don't have their
device upon timeout. However, that the device is still busy at that
point is irrelevant. Skip logging a message about those profiles.

Fixes: 3df662f534 ('settings: rework wait-device-timeout handling and consider device compatibility')
(cherry picked from commit d9568ca3ee)
2020-08-13 10:19:30 +02:00
Thomas Haller
f0d8d6f157
initrd: always set "connection.wait-device-timeout" even if profile has no interface-name set
Since commit 3df662f534 ('settings: rework wait-device-timeout
handling and consider device compatibility'), "connection.wait-device-timeout"
works with profiles in general and doesn't require an interface-name
set.

Remove that restriction and let initrd generator create profiles that
always wait.

(cherry picked from commit 52af5e901e)
2020-08-12 17:43:38 +02:00
Beniamino Galvani
68e82810e7
initrd: merge branch 'bg/initrd-wait-rh1853348'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/599

(cherry picked from commit 9f4ab95c01)
2020-08-12 17:30:22 +02:00
Beniamino Galvani
98ccd2a10e
initrd: wait for bootdev or all devices if rd.neednet=1
The network-legacy dracut module waits for all ethernet devices if the
command line contains rd.neednet=1. It also waits for the device
specified by 'bootdev='.

Do the same.

https://bugzilla.redhat.com/show_bug.cgi?id=1853348
(cherry picked from commit f114e16fdd)
2020-08-12 17:30:21 +02:00
Beniamino Galvani
e2830af77a
initrd: disable STP on bridges
NM enables by default STP on bridges, which causes a forwarding delay
of 15 seconds on boot. Disable it.

(cherry picked from commit 0a006c0412)
2020-08-12 17:30:21 +02:00
Thomas Haller
df5785f22e
core: merge branch 'th/settings-wait-device-timeout'
https://bugzilla.redhat.com/show_bug.cgi?id=1853348

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/603

(cherry picked from commit 63daaa6d21)
2020-08-12 16:46:24 +02:00
Thomas Haller
7ab8c5ba25
settings: rework wait-device-timeout handling and consider device compatibility
A profile can configure "connection.wait-device-timeout" to indicate
that startup complete is blocked until a suitable device around.
This is useful for NetworkManager-wait-online and initrd mode.

Previously, we looked at NMPlatform whether a link with matching
interface-name was present. That is wrong because it cannot handle
profiles that rely on "ethernet.mac-address" setting or other "match"
settings. Also, the mere presence of the link does not yet mean
that the NMDevice was created and ready. In fact, there is a race here:
NMPlatform indicates that the device is ready (unblocking NMSettings),
but there is no corresponding NMDevice yet which keeps NetworkManager
busy to block startup complete.

Rework this. Now, only check whether there is a compatible device for
the profile.

Since we wait for compatible devices, it works now not only for the
interface name. Note that we do some optimizations so that we don't have
to re-evaluate all profiles (w.r.t. all devices) whenever something on the
device changes: we only care about this when all devices finally become
ready.

Also, we no longer start the timeout for "connection.wait-device-timeout"
when the profile appears. Instead, there is one system-wide start time
(NMSettingsPrivate.startup_complete_start_timestamp_msec). That simplifies
code and makes sense: we start waiting when NetworkManager is starting, not
when the profile gets added. Also, we wait for all profiles to become
ready together.

(cherry picked from commit 3df662f534)
2020-08-12 16:46:23 +02:00
Thomas Haller
1745b4e0c0
settings: let NMSettings reference NMManager
NMSettings needs access to the list of all devices, which is tracked
by NMManager. Of course, this ties NMSettings and NMManager closer
together. Note that NMManager already owns a reference to NMSettings,
so they are in fact related.

The alternatives of just letting NMSettings reference NMManager (and
vice versa) would be more complicated, and likely not help to simplify
the code (on the contrary).

(cherry picked from commit d27a6055b9)
2020-08-12 16:46:23 +02:00
Antonio Cardace
61e0b949b3
bond: merge branch 'ac/bond_reapply'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/598
(cherry picked from commit ac6f21cae4)
2020-08-06 18:05:59 +02:00
Antonio Cardace
88a399637a
bond: let 'reapply()' reapply all supported options
Reapply now handles all the options supported by kernel and NM, meaning
that some options are simply not allowed to be set while keeping the
bond up, one of those options is the mode for instance.

https://bugzilla.redhat.com/show_bug.cgi?id=1847814
(cherry picked from commit 746dc119a6)
2020-08-06 17:57:23 +02:00
Antonio Cardace
63b5274dda
bond: fix can_reapply_change() false positives
can_reapply_change() would wrongly return true for
unsupported reapply values because it used 'nm_setting_bond_get_option_default()'
that is ill-named because it returns the overriden option other than
its default value.

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

Fixes: 9bd07336ef ('bond: bond options logic rework')
(cherry picked from commit 04d6ca1fb8)
2020-08-06 17:57:12 +02:00