summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-01-26dns-manager: always apply options from [global-dns]lr/global-dnsLubomir Rintel6-24/+55
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-26config: fix a reversed conditionalLubomir Rintel1-2/+2
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: da0ded49279c ('config: drop global-dns.enable option in favor of .config.enable')
2023-01-26config-data: style fixLubomir Rintel1-4/+7
2023-01-26dns-manager: style fixLubomir Rintel1-2/+2
2023-01-25po: update Ukrainian translationYuri Chornoivan1-818/+849
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1508
2023-01-25platform: detect EINVAL as failure to set the MTUThomas Haller1-1/+2
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-24contrib/copr: better detect git-ref in "nm-copr-build.sh"Thomas Haller1-0/+1
2023-01-24contrib/rpm: fix condition in "NetworkManager.spec" (3)Thomas Haller1-1/+1
Fixes: 096b9955d67d ('contrib/fedora: make "lto" in the spec file configurable') Fixes: 7a62845424c4 ('contrib/rpm: fix condition in "NetworkManager.spec"')
2023-01-24contrib/rpm: fix condition in "NetworkManager.spec" (2)Thomas Haller1-1/+1
Fixes: 096b9955d67d ('contrib/fedora: make "lto" in the spec file configurable') Fixes: 7a62845424c4 ('contrib/rpm: fix condition in "NetworkManager.spec"')
2023-01-24contrib/rpm: fix condition in "NetworkManager.spec"Thomas Haller1-1/+1
Fixes: 096b9955d67d ('contrib/fedora: make "lto" in the spec file configurable')
2023-01-24contrib/fedora: make "lto" in the spec file configurableThomas Haller4-2/+31
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: 0566e9dc63fb ('contrib: support disabling "LTO" in "nm-copr-build.sh"')
2023-01-24contrib: support disabling "LTO" in "nm-copr-build.sh"Thomas Haller1-2/+13
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-24gitlab-ci: fix CentOS Linux 9 containers during ".gitlab-ci/fedora-install.sh"Fernando Fernandez Mancera2-9/+11
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1511
2023-01-23contrib/fedora: install "python36-gobject" when building with meson on centos7Thomas Haller1-0/+4
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-23contrib/fedora: disable "qt" build of examples for spec fileThomas Haller1-0/+1
Otherwise, we require a C++ compiler, but our build requirements don't install g++. So build will fail.
2023-01-23contrib/fedora: explicitly set "pppd" path in configure scriptThomas Haller1-2/+4
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-23merge: branch 'pr/1479'Beniamino Galvani3-4/+53
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1479
2023-01-23ndisc: Accept routes from on-link prefixes form raAlexander Lochmann3-4/+53
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-20libnm: valide IPv4 ECMP routes in NMIPRoute as unicast routesThomas Haller1-4/+19
Kernel does not allow ECMP routes for route types other than unicast. Reject that in NetworkManager settings too. Fixes: 3cd02b6ed6e7 ('libnm,platform: fix range for "weight" property of next hops for routes') https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1507
2023-01-20meson: increase "default_test_timeout" to 3 minutesThomas Haller2-2/+2
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-20glib-aux/trivial: fix code comment about nmtst_is_debug()Thomas Haller1-1/+1
Fixes: c1b57a2c7294 ('glib-aux/tests: enable TRACE logging level when debugging nmtst tests')
2023-01-19release: bump version to 1.43.0 (development)1.43.0-devThomas Haller2-3/+3
2023-01-19release: bump version to 1.41.90 (1.42-rc1)1.42-rc1Thomas Haller2-2/+2
2023-01-19gitlab-ci: set OMP_NUM_THREADS=1 to avoid libgomp crash for msgmergeThomas Haller1-0/+1
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-19platform/tests: temporarily disable failing check in ↵Thomas Haller2-6/+3
"/route/test_cache_consistency_routes" (3) This test is not (yet) stable. Disable for now.
2023-01-19platform/tests: temporarily disable failing check in ↵Thomas Haller1-5/+6
"/route/test_cache_consistency_routes" (2) This test is not (yet) stable. Disable for now.
2023-01-19libnm/doc: document "weight" attribute for IPv4 routesThomas Haller1-0/+7
2023-01-19NEWS: updateFernando Fernandez Mancera1-12/+97
2023-01-19gitlab-ci: avoid clean step in "run-test.sh" for manual invocationThomas Haller1-11/+12
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-19platform/tests: temporarily disable failing check in ↵Thomas Haller1-0/+5
"/route/test_cache_consistency_routes" Hm, it seems to fail on some systems. Disable the test for now.
2023-01-19l3cfg: schedule an update after every commit-type/config-data ↵ff/fix_ecmp_empty_lstFernando Fernandez Mancera2-9/+21
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-19platform: merge branch 'th/platform-cache-consistency-routes'Thomas Haller19-239/+929
https://bugzilla.redhat.com/show_bug.cgi?id=2060684 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1494
2023-01-19platform/tests: add test for cache consistency for IP routesThomas Haller2-1/+230
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-19platform/tests: add nmtstp_assert_platform() helperThomas Haller2-0/+320
2023-01-19platform/tests: extend nmtstp_env1_add_test_func() to create more interfacesThomas Haller5-60/+93
nmtstp_env1_add_test_func() prepares a certain environment (with dummy interface) that is used by some tests. Extend it, to allow creating more than one interface (currently up to two).
2023-01-19platform: allow setting multi_idx instance for NMPlatformThomas Haller7-16/+51
The major point of NMDedupMultiIndex is that it can de-duplicate the objects. It thus makes sense the everybody is using the same instance. Make the multi-idx instance of NMPlatform configurable. This is not used outside of unit tests, because the daemon currently always creates one platform instance and everybody then re-uses the instance of the platform. While this is (currently) only used by tests, and that the performance optimization of de-duplicating is irrelevant for tests, this is still useful. The test can then check whether two separate NMPlatform objects shared the same instance and whether it was de-duplicated.
2023-01-19platform: add NMP_OBJECT_TYPE_NAME() macroThomas Haller1-0/+2
2023-01-19platform: abort handling routes in _rtnl_handle_msg() when resync is requiredThomas Haller1-0/+2
There really is nothing left to do. Skip the rest and do a resync.
2023-01-19platform: resync route cache upon NLM_F_REPLACE flagThomas Haller1-14/+37
There really is no way around this. As we don't cache all the routes (e.g. ignored based on rtm_protocol or rtm_type), we cannot know which route was replaced, when we get a NLM_F_REPLACE message. We need to request a new dump in that case, which can be expensive, if there are a lot of routes or if replace happens frequently. The only possible solutions would be: 1) NetworkManager caches all routes, but it also needs to make sure to get *everything* right. In particular, to understand every relevant route attribute (including those added in the future, which is impossible). 2) kernel provides a reasonable API (rhbz#1337855, rhbz#1337860) that allows to sufficiently understand what is going on based on the netlink notifications.
2023-01-19platform: parse routes of any type to handle replaceThomas Haller1-9/+11
When you issue ip route replace broadcast 1.2.3.4/32 dev eth0 then this route may well replace a (unicast) route that we have in the cache. Previously, we would right away ignore such messages in _new_from_nl_route(), which means we miss the fact that a route gets replaced. Instead, we need to parse the message at least so far, that we can detect and handle the replace.
2023-01-19platform: better handle `ip route replace` for ignored routesThomas Haller4-20/+19
We don't cache certain routes, for example based on the protocol. This is a performance optimization to ignore routes that we usually don't care about. Still, if the user does `ip route replace` with such a route, then we need to pass it to nmp_cache_update_netlink_route(), so that we can properly remove the replaced route. Knowing which route was replaces might be impossible, as our cache does not contain all routes. Likely all that nmp_cache_update_netlink_route() can to is to set "resync_required" for NLM_F_REPLACE. But for that it should see the object first. This also means, if we ever write a BPF filter to filter out messages that contain NLM_F_REPLACE, because that would lead to cache inconsistencies.
2023-01-19platform: minor cleanup in nmp_cache_update_netlink_route()Thomas Haller1-7/+6
It reads nicer. It will also work better with the change that follows.
2023-01-19platform: fix nmp_lookup_init_route_by_weak_id() to honor the route-tableThomas Haller3-21/+46
The route table is part of the weak-id. You can see that with: ip route replace unicast 1.2.3.4/32 dev eth0 table 57 ip route replace unicast 1.2.3.4/32 dev eth0 table 58 afterwards, `ip route show table all` will list both routes. The replace operation is only per-table. Note that NMP_CACHE_ID_TYPE_ROUTES_BY_WEAK_ID already got this right. Fixes: 10ac675299cb ('platform: add support for routing tables to platform cache')
2023-01-19platform: avoid printing raw pointer values in logThomas Haller3-63/+73
2023-01-19glib-aux/tests: enable TRACE logging level when debugging nmtst testsThomas Haller1-1/+1
By setting "NMTST_DEBUG" to any non-empty string, "is_debug" is enabled. So "NMTST_DEBUG='debug,...'" is mostly redundant. Note however you can still disable debug mode explicitly, like "NMTST_DEBUG=no-debug,...", which can make sense if you want to set other flags but not enabling debug mode (like "NMTST_DEBUG=no-debug,quick"). You can also explicitly set the log level ("NMTST_DEBUG='log-level=TRACE,...'" or enable trace debugging with "NMTST_DEBUG='d,...'", where "d" (or "D") is shorthand for "NMTST_DEBUG=log-level=TRACE,no-expect-message,...". Anyway. If you explicitly set the log level with "log-level=" or "d", debug logging is enabled with the "debug" flag. But it only logged at level "<debug>". That seems not best. Instead, enable "<trace>" level by default in debug mode. That's useful, because there is not a clear distinction between "<debug>" and "<trace>" level. When debugging, you really want all the information you got, you can also filter out later (`grep` is a thing).
2023-01-19glib-aux/tests: add nmtst_keeper_add() test helperThomas Haller1-0/+21
2023-01-19glib-aux: rename and change nm_g_ptr_array_copy() to nm_g_ptr_array_new_clone()Thomas Haller2-29/+19
There is g_ptr_array_copy() in glib, but only since 2.68 so we cannot use it. We had a compat implementation nm_g_ptr_array_copy(), however that one always requires an additional parameter, the free function of the new array. g_ptr_array_copy() always does a deep clone, and uses the source array's free function. We don't have access to the free function (seems quite a limitation of GPtrArray API), so our nm_g_ptr_array_copy() cannot be exactly the same. Previously, nm_g_ptr_array_copy() aimed to be as similar as possible to g_ptr_array_copy(), and it would require the caller that the free function is the same as the array's. That seems an unnecessary limitation, and our compat implementation still looks different and has a different name. If we were able to fully re-implement it, we would instead add it to "nm-glib.h". Anyway. As our implementation already differs, there is no need for the arbitrary limitation to only perform deep copies. Instead, also allow shallow copies. Rename the function to nm_g_ptr_array_new_clone() to make it clearly distinct from g_ptr_array_copy().
2023-01-18curl: use CURLOPT_PROTOCOLS_STR instead of deprecated CURLOPT_PROTOCOLSThomas Haller2-0/+11
CURLOPT_PROTOCOLS [0] was deprecated in libcurl 7.85.0 with CURLOPT_PROTOCOLS_STR [1] as a replacement. Well, technically it was only deprecated in 7.87.0, and retroactively marked as deprecated since 7.85.0 [2]. But CURLOPT_PROTOCOLS_STR exists since 7.85.0, so that's what we want to use. This causes compiler warnings and build errors: ../src/core/nm-connectivity.c: In function 'do_curl_request': ../src/core/nm-connectivity.c:770:5: error: 'CURLOPT_PROTOCOLS' is deprecated: since 7.85.0. Use CURLOPT_PROTOCOLS_STR [-Werror=deprecated-declarations] 770 | curl_easy_setopt(ehandle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); | ^~~~~~~~~~~~~~~~ In file included from ../src/core/nm-connectivity.c:13: /usr/include/curl/curl.h:1749:3: note: declared here 1749 | CURLOPTDEPRECATED(CURLOPT_PROTOCOLS, CURLOPTTYPE_LONG, 181, | ^~~~~~~~~~~~~~~~~ This patch is largely taken from systemd patch [2]. Based-on-patch-by: Frantisek Sumsal <frantisek@sumsal.cz> [0] https://curl.se/libcurl/c/CURLOPT_PROTOCOLS.html [1] https://curl.se/libcurl/c/CURLOPT_PROTOCOLS_STR.html [2] https://github.com/curl/curl/commit/6967571bf20624bc4cfa68fb8f90cbc53a87c6f2 [3] https://github.com/systemd/systemd/pull/25982/commits/e61a4c0b7c79eabbe4eb50ff2e663734fde769f0 Fixes: 7a1734926a4d ('connectivity,cloud-setup: restrict curl protocols to HTTP and HTTPS')
2023-01-18core: fix enum argument in prototype of nm_utils_kill_process_sync(), etc.Thomas Haller1-3/+3
This avoids a new compiler warning with gcc 13.0.0-0.9.fc38: ../src/core/nm-core-utils.c:482:1: error: conflicting types for 'nm_utils_kill_child_async' due to enum/integer mismatch; have 'void(pid_t, int, NMLogDomain, const char *, guint32, void (*)(pid_t, gboolean, int, void *), void *)' {aka 'void(int, int, NMLogDomain, const char *, unsigned int, void (*)(int, int, int, void *), void *)'} [-Werror=enum-int-mismatch] 482 | nm_utils_kill_child_async(pid_t pid, | ^~~~~~~~~~~~~~~~~~~~~~~~~ In file included from ../src/core/nm-core-utils.c:9: Fixes: 067202b34e5a ('core: use explict NMLogDomain enum instead of int')
2023-01-18gitlab-ci: bump ci-templates tag to generate new container imagesThomas Haller2-6/+6