Commit Graph

31926 Commits

Author SHA1 Message Date
Fernando Fernandez Mancera
8e17e0c0bd merge: branch 'ff/fix_l3cfg_onlink'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1510
2023-01-26 11:11:51 +01:00
Fernando Fernandez Mancera
f187e63fa8 l3-config-data: do not check route table to get direct routes
Kernel enforces that all route nexthop are reachable but it doesn't care
if the drect route to the nexthop is in a different route table.
2023-01-26 11:10:08 +01:00
Fernando Fernandez Mancera
cbf70b4dca Revert "nm-netns: add onlink routes for ECMP routes"
ECMP IPv4 route nexthops requires an onlink route but we should trust
l3cfg when generating and managing such routes.

This reverts commit 737cb5d424.
2023-01-26 11:10:08 +01:00
Fernando Fernandez Mancera
9c492c6fc4 Revert "l3cfg: do not add dependent routes for non-default routes"
We must trust l3cfg when generating dependent onlink routes for all kind
of routes not default routes only. This was done by
"nm_platform_ip_route_sync()" so there is not change in behaviour at
all.

"nm_platform_ip_route_sync()" could be needed for other situation where
l3cfg cannot add the dependent onlink routes, so we are not removing
that logic.

This reverts commit 6b4123db1c.
2023-01-26 11:07:00 +01:00
Lubomir Rintel
4d75c43f1a dns-manager: always apply options from [global-dns]
Currently, the use of [global-dns] section for setting DNS options is
conditioned on presence of a nameserver in a [global-dns-domain-*] section.
Attempt to use the section for options alone results in an error:

  [global-dns]
  options=timeout:1

Or via D-Bus API:

  # busctl set-property org.freedesktop.NetworkManager \
      /org/freedesktop/NetworkManager org.freedesktop.NetworkManager \
      GlobalDnsConfiguration 'a{sv}' 2 \
          "options" as 1 "timeout:1" \
          "domains" a{sv} 0
  ...
  Nov 24 13:15:21 zmok.local NetworkManager[501184]: <debug> [1669292121.3904]
      manager: set global DNS failed with error: Global
      DNS configuration is missing the default domain

The insistence on existence of [global-dns-domain-*] would make sense if
other [global-dns-domain-...] sections were present.

However, the user might only want to set the options in resolv.conf and
still use connection-provide nameservers for the actual resolving.

Lift the limitation by allowing the [global-dns] to be used alone, while
still insist on [global-dns-domain-*] being there in presence of other
domain-specific options.

https://bugzilla.redhat.com/show_bug.cgi?id=2019306
(cherry picked from commit 1f0d1d78d2)
2023-01-26 10:11:45 +01:00
Lubomir Rintel
164cc81569 config-data: style fix
(cherry picked from commit 051819a78e)
2023-01-26 10:11:43 +01:00
Lubomir Rintel
e2246cb54b dns-manager: style fix
(cherry picked from commit f2f806f77d)
2023-01-26 10:11:42 +01:00
Lubomir Rintel
d976683417 release: bump version to 1.41.91 (1.42-rc2) (development) 2023-01-26 09:55:15 +01:00
Thomas Haller
9297f319f0 glib-aux/trivial: fix code comment about nmtst_is_debug()
Fixes: c1b57a2c72 ('glib-aux/tests: enable TRACE logging level when debugging nmtst tests')
(cherry picked from commit 93424dc2c2)
2023-01-26 09:20:18 +01:00
Thomas Haller
be848b3384 libnm: valide IPv4 ECMP routes in NMIPRoute as unicast routes
Kernel does not allow ECMP routes for route types other than unicast.
Reject that in NetworkManager settings too.

Fixes: 3cd02b6ed6 ('libnm,platform: fix range for "weight" property of next hops for routes')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1507
(cherry picked from commit 4f719da32d)
2023-01-26 09:20:18 +01:00
Lubomir Rintel
bd4f5333e8 config: fix a reversed conditional
This effectively makes [*global-dns-domain-*] sections in configuration be
ignored unless [*global-dns] is also present. This happens because
nm_config_keyfile_has_global_dns_config() mixes the group names up and
attempts to loop up [.intern.global-dns-domain-*] in user configuration and
[global-dns-domain-*] in the internal one.

Fixes: da0ded4927 ('config: drop global-dns.enable option in favor of .config.enable')
(cherry picked from commit de1c06daab)
2023-01-26 09:20:18 +01:00
Lubomir Rintel
b36af7ce3f release: bump version to 1.43.1 (development) 2023-01-26 09:05:56 +01:00
Lubomir Rintel
5e234fa0c9 libnm/client: don't consider client running if we got no NMManager
We silently tolerate NetworkManager not responding at all (easily
reproduced with e.g. pkill -STOP NetworkManager):

  $ LIBNM_CLIENT_DEBUG=trace nmcli c show dummy666
  libnm-dbus[23540]: <debug> [3316.81989] nmclient[ddafb84b8deebe4a]: new NMClient instance
  libnm-dbus[23540]: <debug> [3316.81998] nmclient[ddafb84b8deebe4a]: starting async initialization...
  libnm-dbus[23540]: <debug> [3316.82461] nmclient[ddafb84b8deebe4a]: name owner changed: (null) -> ":1.2"
  libnm-dbus[23540]: <debug> [3316.82464] nmclient[ddafb84b8deebe4a]: fetch all
  libnm-dbus[23540]: <debug> [3341.85715] nmclient[ddafb84b8deebe4a]: GetManagedObjects() call failed: Timeout was reached
  libnm-dbus[23540]: <debug> [3341.85740] nmclient[ddafb84b8deebe4a]: async init complete with success
  Error: dummy666 - no such connection profile.
  libnm-dbus[23540]: <debug> [3341.86723] nmclient[ddafb84b8deebe4a]: release all
  libnm-dbus[23540]: <debug> [3341.86798] nmclient[ddafb84b8deebe4a]: disposed
  $

As a comment in _dbus_get_managed_objects_cb() explains, this is sort of
intentional. NetworkManager might just be shutting down and the libnm
users will eventually see the objects once a new daemon starts up.

This may make some sense for long-running clients ("nmcli monitor",
various desktop environments), but not for one-shot invocations that
require the daemon running, such as those of "nmcli c ...".

Let's not consider the client running unless we actually got the manager
object. That way the error message will make more sense:

  $ LIBNM_CLIENT_DEBUG=trace nmcli c show dummy666
  libnm-dbus[24730]: <debug> [5360.95480] nmclient[8cb898d3c891e210]: new NMClient instance
  libnm-dbus[24730]: <debug> [5360.95487] nmclient[8cb898d3c891e210]: starting async initialization...
  libnm-dbus[24730]: <debug> [5360.95901] nmclient[8cb898d3c891e210]: name owner changed: (null) -> ":1.2"
  libnm-dbus[24730]: <debug> [5360.95904] nmclient[8cb898d3c891e210]: fetch all
  libnm-dbus[24730]: <debug> [5385.98487] nmclient[8cb898d3c891e210]: GetManagedObjects() call failed: Timeout was reached
  libnm-dbus[24730]: <debug> [5385.98497] nmclient[8cb898d3c891e210]: async init complete with success
  Error: NetworkManager is not running.
  libnm-dbus[24730]: <debug> [5385.98571] nmclient[8cb898d3c891e210]: release all
  libnm-dbus[24730]: <debug> [5385.98698] nmclient[8cb898d3c891e210]: disposed
  $

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1502
2023-01-26 09:04:09 +01:00
Lubomir Rintel
fd7175969c libnm/client: drop an unused argument
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1502
2023-01-26 09:04:07 +01:00
Lubomir Rintel
b76ebc3bfc merge: branch 'lr/global-dns'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1377
2023-01-26 09:02:31 +01:00
Lubomir Rintel
1f0d1d78d2 dns-manager: always apply options from [global-dns]
Currently, the use of [global-dns] section for setting DNS options is
conditioned on presence of a nameserver in a [global-dns-domain-*] section.
Attempt to use the section for options alone results in an error:

  [global-dns]
  options=timeout:1

Or via D-Bus API:

  # busctl set-property org.freedesktop.NetworkManager \
      /org/freedesktop/NetworkManager org.freedesktop.NetworkManager \
      GlobalDnsConfiguration 'a{sv}' 2 \
          "options" as 1 "timeout:1" \
          "domains" a{sv} 0
  ...
  Nov 24 13:15:21 zmok.local NetworkManager[501184]: <debug> [1669292121.3904]
      manager: set global DNS failed with error: Global
      DNS configuration is missing the default domain

The insistence on existence of [global-dns-domain-*] would make sense if
other [global-dns-domain-...] sections were present.

However, the user might only want to set the options in resolv.conf and
still use connection-provide nameservers for the actual resolving.

Lift the limitation by allowing the [global-dns] to be used alone, while
still insist on [global-dns-domain-*] being there in presence of other
domain-specific options.

https://bugzilla.redhat.com/show_bug.cgi?id=2019306
2023-01-26 09:02:16 +01:00
Lubomir Rintel
de1c06daab config: fix a reversed conditional
This effectively makes [*global-dns-domain-*] sections in configuration be
ignored unless [*global-dns] is also present. This happens because
nm_config_keyfile_has_global_dns_config() mixes the group names up and
attempts to loop up [.intern.global-dns-domain-*] in user configuration and
[global-dns-domain-*] in the internal one.

Fixes: da0ded4927 ('config: drop global-dns.enable option in favor of .config.enable')
2023-01-26 09:02:16 +01:00
Lubomir Rintel
051819a78e config-data: style fix 2023-01-26 09:02:16 +01:00
Lubomir Rintel
f2f806f77d dns-manager: style fix 2023-01-26 09:02:16 +01:00
Yuri Chornoivan
66c9a5e849 po: update Ukrainian translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1508
2023-01-25 13:03:31 +01:00
Thomas Haller
621b41ebfa platform: detect EINVAL as failure to set the MTU
Some drivers will reject an invalid MTU size with EINVAL.

Quote from [1]:

  While investigating, I did notice that do_change_link in
  nm-linux-platform.c really ought to count -EINVAL as an MTU out-of-range
  error and not just -ERANGE. Even if the hardware supports a large MTU,
  if the transmit FIFO is set too small, stmmac_change_mtu [2] will return
  -EINVAL. For example, on my device, the maxmtu is 9000 but in practice I
  can't set an MTU larger than 4096 unless I first run ethtool
  --set-channels eno1 tx 3.

[1] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1198#note_1738311
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c?h=v6.1#n5577
2023-01-25 09:05:58 +01:00
Thomas Haller
fce8e572d0 contrib/copr: better detect git-ref in "nm-copr-build.sh" 2023-01-24 14:58:52 +01:00
Thomas Haller
36ad5cbb3b contrib/rpm: fix condition in "NetworkManager.spec" (3)
Fixes: 096b9955d6 ('contrib/fedora: make "lto" in the spec file configurable')
Fixes: 7a62845424 ('contrib/rpm: fix condition in "NetworkManager.spec"')
2023-01-24 12:29:04 +01:00
Thomas Haller
13dfdaf3a0 contrib/rpm: fix condition in "NetworkManager.spec" (2)
Fixes: 096b9955d6 ('contrib/fedora: make "lto" in the spec file configurable')
Fixes: 7a62845424 ('contrib/rpm: fix condition in "NetworkManager.spec"')
2023-01-24 11:46:44 +01:00
Thomas Haller
7a62845424 contrib/rpm: fix condition in "NetworkManager.spec"
Fixes: 096b9955d6 ('contrib/fedora: make "lto" in the spec file configurable')
2023-01-24 11:31:54 +01:00
Thomas Haller
096b9955d6 contrib/fedora: make "lto" in the spec file configurable
When we build a copr image, we run the "nm-copr-build.sh" script.
That script, should honor "LTO=0|1|" to explicitly enable/disable
LTO. Since the copr script only builds a SRPM, which then gets build
we need that the default LTO flag in the SRPM is templated.

Fixes: 0566e9dc63 ('contrib: support disabling "LTO" in "nm-copr-build.sh"')
2023-01-24 10:36:34 +01:00
Thomas Haller
0566e9dc63 contrib: support disabling "LTO" in "nm-copr-build.sh"
The "nm-copr-build.sh" script is run by our copr to generate the SRPM of
NetworkManager (via `curl ... | bash`).

Building with LTO takes a long time, for testing it can be nice to disable
that. Add an environment variable for that. It can be used when manually
building an RPM in copr.
2023-01-24 08:46:14 +01:00
Fernando Fernandez Mancera
74f66ee276 gitlab-ci: fix CentOS Linux 9 containers during ".gitlab-ci/fedora-install.sh"
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1511
2023-01-24 08:17:44 +01:00
Thomas Haller
128c000f0c contrib/fedora: install "python36-gobject" when building with meson on centos7
With the meson build configuration, there is obviously python3 installed
and in the path. The build script will pick that up as preferred python.

However, we will also need working pygobject to build the documentation.
But we only have that for python2 installed. Fix that, by installing
"python36-gobject".
2023-01-23 21:39:00 +01:00
Thomas Haller
ea16997c4a contrib/fedora: disable "qt" build of examples for spec file
Otherwise, we require a C++ compiler, but our build requirements
don't install g++. So build will fail.
2023-01-23 18:24:56 +01:00
Thomas Haller
a9cb294b73 contrib/fedora: explicitly set "pppd" path in configure script
We have "BuildRequires: ppp-devel". While in Fedora 37 that has a
dependency on "ppp" package, that is not the case on Centos7. I didn't
test others, but the point is it's not always there.

"/usr/sbin/pppd" is provided by "ppp" package, and we might not have it
installed via the build requirements. But we only need it to detect the
path, which is not necessary on RHEL/Fedora. Just set the path
explicitly with the respective configure option.
2023-01-23 18:24:56 +01:00
Beniamino Galvani
5b19818fdc merge: branch 'pr/1479'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1479

(cherry picked from commit 46f6e0bc29)
2023-01-23 18:02:27 +01:00
Alexander Lochmann
02c3f7c946 ndisc: Accept routes from on-link prefixes form ra
It is possible that an ra leads to two routes having
the same prefix as well as the same prefix length.
One of them, however, refers to the on-link prefix,
and the other one to a route from the route information field.
(Moreover, they might have different route preferences.)
Hence, if both routes differ in the on-link property,
both are added, and the route from the route information
option receives a metric penalty.
Fixed #1163.

(cherry picked from commit 11832e2ba3)
2023-01-23 18:02:27 +01:00
Beniamino Galvani
46f6e0bc29 merge: branch 'pr/1479'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1479
2023-01-23 17:56:08 +01:00
Alexander Lochmann
11832e2ba3 ndisc: Accept routes from on-link prefixes form ra
It is possible that an ra leads to two routes having
the same prefix as well as the same prefix length.
One of them, however, refers to the on-link prefix,
and the other one to a route from the route information field.
(Moreover, they might have different route preferences.)
Hence, if both routes differ in the on-link property,
both are added, and the route from the route information
option receives a metric penalty.
Fixed #1163.
2023-01-23 16:50:08 +00:00
Thomas Haller
4f719da32d libnm: valide IPv4 ECMP routes in NMIPRoute as unicast routes
Kernel does not allow ECMP routes for route types other than unicast.
Reject that in NetworkManager settings too.

Fixes: 3cd02b6ed6 ('libnm,platform: fix range for "weight" property of next hops for routes')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1507
2023-01-20 15:09:31 +01:00
Thomas Haller
9ee42c0979 meson: increase "default_test_timeout" to 3 minutes
Obviously, it would be nice if our unit tests are fast. However, with
valgrind and a busy machine, some of the tests can take a relatively
long time. In particular those, that are marked as "slow" (if you want
to skip them during development, do so via "NMTST_DEBUG=quick"
environment, or "CFLAGS=-DNMTST_TEST_QUICK=TRUE", see
"nm-test-utils.h").

Anyway. Our tests almost never hit the timeout, and if they do, the most
likely reason is that something was just slower then expected, and the
timeout is a bogus error.

Timeouts only act as last fail safe. It more important to avoid a false
(premature) timeout failure, than to minimize the wait time when the
test really hangs. Because a real hang is a bug anyway, that we will
discover and need to fix.

Increase the default test timeout for meson tests to 3 minutes.

Also, "test-route-linux" is known to take a long time. Increase that
timeout even further.
2023-01-20 13:22:38 +01:00
Thomas Haller
93424dc2c2 glib-aux/trivial: fix code comment about nmtst_is_debug()
Fixes: c1b57a2c72 ('glib-aux/tests: enable TRACE logging level when debugging nmtst tests')
2023-01-20 13:22:32 +01:00
Thomas Haller
700cd20d4d release: bump version to 1.43.0 (development) 2023-01-19 20:26:31 +01:00
Thomas Haller
093bbd0fcf release: bump version to 1.41.90 (1.42-rc1) 2023-01-19 20:15:14 +01:00
Thomas Haller
01730f5943 gitlab-ci: set OMP_NUM_THREADS=1 to avoid libgomp crash for msgmerge
It's not clear why this happens. But since recently in our gitlab-ci,
all the Fedora machines will fail. It happens in the step

  check_run_clean 6 && test $IS_FEDORA = 1 -o $IS_CENTOS = 1 && ./contrib/fedora/rpm/build_clean.sh -g -w crypto_gnutls -w debug -w iwd -w test -W meson

which explains why it only affects Fedora configurations.

It does not always fail, but the probability of failure is high.
The failure is:

  ...
  rm -f et.gmo && /usr/bin/msgmerge --for-msgfmt -o et.1po et.po NetworkManager.pot && /usr/bin/msgfmt -c --statistics --verbose -o et.gmo et.1po && rm -f et.1po
  libgomp: Thread creation failed: Resource temporarily unavailable
  make[3]: *** [Makefile:383: et.gmo] Error 1

Maybe some new resource restricting in gitlab. Let's add this workaround.
I don't really understand the cause, but this seems to avoid it, which is
good enough for me.
2023-01-19 19:31:28 +01:00
Thomas Haller
f2db9be627 platform/tests: temporarily disable failing check in "/route/test_cache_consistency_routes" (3)
This test is not (yet) stable. Disable for now.
2023-01-19 17:10:43 +01:00
Thomas Haller
20f71b392c platform/tests: temporarily disable failing check in "/route/test_cache_consistency_routes" (2)
This test is not (yet) stable. Disable for now.
2023-01-19 16:27:28 +01:00
Thomas Haller
5be942eac5 libnm/doc: document "weight" attribute for IPv4 routes 2023-01-19 16:11:19 +01:00
Fernando Fernandez Mancera
d02be1c123 NEWS: update 2023-01-19 16:07:57 +01:00
Thomas Haller
1e883ab6e6 gitlab-ci: avoid clean step in "run-test.sh" for manual invocation
When we run `NM_TEST_SELECT_RUN=x ./.gitlab-ci/run-test.sh` to run one
step only, we should not do the final clean, so that the build artifacts
are preserved.
2023-01-19 15:04:46 +01:00
Thomas Haller
8ec69afd8b platform/tests: temporarily disable failing check in "/route/test_cache_consistency_routes"
Hm, it seems to fail on some systems. Disable the test for now.
2023-01-19 13:25:52 +01:00
Fernando Fernandez Mancera
e266c420b2 l3cfg: schedule an update after every commit-type/config-data register/unregister
When we register/unregister a commit-type or when we add/remove a
config-data to NML3Cfg, that act only does the registration/addition.
Only on the next commit, are the changes actually done. The purpose
of that is to add/register multiple configurations and commit them later
when ready.

However, it would be wrong to not do the commit a short time after. The
configuration state is dirty with need to be committed, and that should
happen soon.

Worse, when a interface disappears, NMDevice will clear the ifindex and
the NML3Cfg instance, thereby unregistering all config data and commit
type. If we previously commited something, we need to do another follow-up
commit to cleanup that state.

That is for example important with ECMP routes, which are registered in
NMNetns. When NML3Cfg goes down, it always must unregister to properly
cleanup. Failure to do so, causes an assertion failure and crash. This
change fixes that.

Fix that by automatically schedule and idle commit on
register/unregister/add/remove of commit-type/config-data.
It should *always* be permissible to call a AUTO commit from
an idle handler, because various parties cannot use NML3Cfg
independently, and they cannot know when somebody else does a
commit.

Note that NML3Cfg remembers if it presiouvly did a commit
("commit_type_update_sticky"), so even if the last commit-type gets
unregistered, the next commit will still do a sticky update (one more
time).

The only remaining question is what happens during quitting. When
quitting, NetworkManager we may want to leave some interfaces up and
configured. If we were to properly cleanup the NML3Cfg we might need a
mechanism to handle that. However, currently we just leak everything
during quit, so that is not a concern now. It is something that needs
to be addressed in the future.

https://bugzilla.redhat.com/show_bug.cgi?id=2158394
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1505
2023-01-19 12:40:33 +01:00
Thomas Haller
adad1d4358 platform: merge branch 'th/platform-cache-consistency-routes'
https://bugzilla.redhat.com/show_bug.cgi?id=2060684

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1494
2023-01-19 11:54:10 +01:00
Thomas Haller
87522ad316 platform/tests: add test for cache consistency for IP routes
Routes can be added with `ip route add|change|replace|append|prepend`.
Add a test that randomly tries to add such routes, and checks that
the cache stays consistent.

https://bugzilla.redhat.com/show_bug.cgi?id=2060684
2023-01-19 11:53:08 +01:00