Commit graph

33277 commits

Author SHA1 Message Date
Stanislas FAYE 10d4557720 Make team obsoletes in rhel-10 only if NM-team is not enabled in the rpm 2024-05-31 11:33:58 +00:00
Stanislas FAYE 3f3472c971 Use the versions number from which packages are obsoleted directly instead of using global variables 2024-05-31 11:33:58 +00:00
Stanislas FAYE 613f16de51 rpm: Disable team and ifcfg-rh only in rhel distros and rhel-10+
Resolves: https://issues.redhat.com/browse/RHEL-32948
2024-05-31 11:33:58 +00:00
Íñigo Huguet 3bb642697a merge: branch 'ih/conf4sys_meson'
contrib: configure-for-system: use meson by default and allow specifying the build directory

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1947
2024-05-31 07:08:47 +00:00
Íñigo Huguet 714d02697f contrib: configure-for-system: use meson by default
With the deprecation of autotools, use meson by default. For the moment,
it's still possible to build with autotools passing -a/--autotools.

Additionally, as we allow to specify different build directories other
than './build', let's not asume that the user wants to overwrite it
by default. Instead, the script will asume ./build if the user doesn't
specify the build directory, but only if it doesn't exist. If it does,
the user will have to force overwritting it with `--meson ./build`.
2024-05-31 07:08:22 +00:00
Íñigo Huguet a07627fdcc contrib: configure-for-system: specify meson build dir
Instead of forcing to use ./build directory, let's make the the user
specify what directory he wants to use. This will allow to have multiple
build directories with different configurations as meson is designed to
allow, without having to overwrite the existing build one.
2024-05-31 07:08:22 +00:00
Fernando Fernandez Mancera bd1763ebea merge: branch 'ff/fix_install_debuginfo'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1951
2024-05-30 15:58:01 +02:00
Fernando Fernandez Mancera a4bbdeaf54 src: fix code formatting to last clang version 2024-05-30 15:23:37 +02:00
Fernando Fernandez Mancera 4e50d7d53f gitlab: fix helper scripts to support DNF5
As Fedora 41 (currently Rawhide) is migrating to DNF5 [1], the
debuginfo-install command is not available anymore according to the
documentation. Instead, the user need to add the package suffix
"-debuginfo" when using the install command.

The implementation of the debuginfo-install plugin is under development
and tracked upstream. [2]

[1] https://fedoraproject.org/wiki/Changes/SwitchToDnf5
[2] https://github.com/rpm-software-management/dnf5/issues/389
2024-05-30 15:23:32 +02:00
Stanislas Faye 710fbe8875 merge: branch 'sf/add-security-vulnerability-template'
gitlab: Add security vulnerability issue template

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1953
2024-05-30 11:45:16 +00:00
Stanislas FAYE 033cb389ff gitlab: Add security vulnerability issue template
Add security vulnerability issue template and automatically make the
issue confidential with the workflow::triage label.
2024-05-30 11:44:19 +00:00
Fernando Fernandez Mancera dfff21f559 gitlab: adjust ci.template
The recommendations from freedesktop [1] about how to maintain a Gitlab
project changed therefore we must adapt the rules.

Solves: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1549

[1] https://gitlab.freedesktop.org/freedesktop/freedesktop/-/issues/540#what-it-means-for-me-a-maintainer-of-a-project-part-of-gitlabfreedesktoporg
2024-05-29 15:11:02 +02:00
Íñigo Huguet fdc6ac38f8 merge: branch 'ih/release_chgs'
Release: document how to release and stop doing "dev" releases on stable branches.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1932
2024-05-29 06:45:26 +00:00
Íñigo Huguet 8eb00c0991 release.sh: stop doing "-dev" releases on stable branches
Note: here I refer to the numbers in a version as MAJOR.MINOR.MICRO.

Having stable and development releases do make sense for the MINOR
version, because we maintain separate branches for them and they
evolve separately. We have 1.47.z where we put all the changes so
anyone can pick the latest development release and test it. At the
same time, we have 1.46.z with the latest stable released version.

However, it does not make sense to have 1.46.2 and 1.46.3-dev because
the latter is not a development version. It is identical to 1.46.2,
only the version number has been bumped, there are no changes to test.
When we add commits, we will be actually testing 1.46.3-dev + some
commits, which is exactly the same as testing 1.46.2 + some commits.

So, basically, someone can use the releases of a development BRANCH,
like 1.47.4, to test the development version of NM. But using a
development MICRO version is exactly the same as using a
non-development one.

From now on, we will just increment the MICRO version each time we do a
release on a stable branch and won't create the '-dev' tag. Update
release.sh to do it this way.
2024-05-29 08:44:02 +02:00
Íñigo Huguet 3ceeffb6b8 doc: document how to do a release of NM and VPN plugins
Although VPN plugins are developed separately, better to document here
how to do the release of those that we maintain to avoid having to do
the changes on every repository each time.
2024-05-29 08:43:58 +02:00
Beniamino Galvani b8061dd4f6 merge: branch 'bg/vpn'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1938

Resolves: https://issues.redhat.com/browse/RHEL-21875
2024-05-27 09:50:22 +02:00
Beniamino Galvani d1ffdb28eb vpn: allow IP configurations with routes and without addresses
Usually, when the method is "auto" we want to avoid configuring routes
until the automatic method completes. To achieve that, we clear the
"allow_routes_without_address" flag of l3cds when the method is "auto".

For VPNs, IP configurations with only routes are perfectly valid,
therefore set the flag.
2024-05-27 09:45:22 +02:00
Beniamino Galvani a3ce13c947 core: add nm_l3_config_data_set_allow_routes_without_address()
Add a function to set the allow-routes-without-address flag for
l3cds. It will be used in the next commit.
2024-05-27 09:45:22 +02:00
Beniamino Galvani b31febea22 core: rename l3cd's "dhcp_enabled" to "allow_routes_without_address"
The name "dhcp_enabled" is misleading because the flag is set for
method=auto, which doesn't necessarily imply DHCP. Also, it doesn't
convey what the flag is used for. Rename it to
"allow_routes_without_address".
2024-05-27 09:45:21 +02:00
Beniamino Galvani 97f185e1f8 vpn: allow IP configurations without addresses
An IPv4-over-IPv6 (or vice-versa) IPsec VPN can return IP
configurations with routes and without addresses. For example, in this
scenario:

         +---------------+         +---------------+
         |  fd01::10/64  <-- VPN -->  fd02::20/64  |
         |     host1     |         |     host2     |
         +-------^-------+         +-------^-------+
                 |                         |
         +-------v-------+         +-------v-------+
         |    subnet1    |         |    subnet2    |
         | 172.16.1.0/24 |         | 172.16.2.0/24 |
         +---------------+         +---------------+

host1 and host2 establish a IPv6 tunnel which encapsulates packets
between the two IPv4 subnets. Therefore, in routed mode, host1 will
need to configure a route like "172.16.2.0/24 via ipsec1" even if the
host doesn't have any IPv4 address on the VPN interface.

Accept IP configurations without address from the VPN; only check that
the address and prefix are sane if they are provided.
2024-05-27 09:45:21 +02:00
Íñigo Huguet 802b3f5af5 merge: branch 'typo-fixes'
various typo fixes detected by lintian

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1940
2024-05-23 10:23:03 +00:00
Michael Biebl b2e8610cc5 typo fix: Uknown -> Unknown
Detected by lintian:
I: network-manager: spelling-error-in-binary Uknown Unknown [usr/lib/x86_64-linux-gnu/NetworkManager/1.47.90/libnm-device-plugin-wifi.so]
2024-05-23 10:22:33 +00:00
Michael Biebl e5bf2d24cd typo fix: overriden -> overridden
Detected by lintian:
I: network-manager: typo-in-manual-page overriden overridden [usr/share/man/man5/NetworkManager.conf.5.gz:396]
I: network-manager: typo-in-manual-page overriden overridden [usr/share/man/man5/nm-system-settings.conf.5.gz:396]
2024-05-23 10:22:33 +00:00
Michael Biebl 22314df2ab typo fix: identifer -> identifier
Detected by lintian:
I: network-manager: typo-in-manual-page identifer identifier [usr/share/man/man5/nm-settings-nmcli.5.gz:3018]
I: network-manager: typo-in-manual-page identifer identifier [usr/share/man/man5/nm-settings.5.gz:3018]
2024-05-23 10:22:33 +00:00
Íñigo Huguet 7206eaf8df merge: branch 'ih/pot_in'
po: add nm-setting-generic.c for translation

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1933
2024-05-23 05:57:50 +00:00
Íñigo Huguet f84282a880 po: add nm-setting-generic.c for translation
Translatable strings were added to nm-setting-generic.c. Add this file to
POTFILES.in.

Fixes: 9322c3e9db ('libnm: add generic.device-handler property')
2024-05-23 05:57:31 +00:00
Íñigo Huguet efc6a32f58 merge: branch 'th/print-config-crash'
[th/print-config-crash] config: fix crash in assertion during `NetworkManager --print-config`

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1935
2024-05-23 05:57:14 +00:00
Thomas Haller 5472f28a40 config: fix crash in assertion during NetworkManager --print-config
Fixes: f6345180b1 ('core/config: fix duplicate entires in `NetworkManager --print-config` output')
2024-05-23 05:56:52 +00:00
Íñigo Huguet c53cc41c97 merge: branch 'ih/conn_timestamp'
manager: save timestamps when shutting down

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1946
2024-05-23 05:54:31 +00:00
Íñigo Huguet 4bf11b7d66 manager: save timestamps when shutting down
Connection timestamps are updated (saved to disk) on connection up and
down. This way, the last used connection will take precedence for
autoconnect if they have the same priority.

But as we don't actually do connection down when NM stops, the last
connection timestamp of all active connections is the timestamp of when
they were brought up. Then, the activation order might be wrong on next
start.

One case where timestamps are wrong (although it is not clear how
important it is because the connections are activated on different
interfaces):
1. Activate con1 <- timestamp updated
2. Activate con2 <- timestamp updated
3. Deactivate con2 <- timestamp updated
4. Stop NM <- timestamp of con2 is higher than con1, but con1 was still
   active when con2 was brought down.

Other case that is reproducible (from
https://issues.redhat.com/browse/RHEL-35539):
1. Activate con1
2. Activate con2 on same interface:
   - As a consequence con1 is deactivated and its timestamp updated
   - The timestamp of con2 is also updated
3. Stop NM <- timestamp of con1 and con2 is the same, next activation
   order will be undefined.

Fix by saving the timestamps on NM shutdown.
2024-05-22 12:49:59 +02:00
Gris Ge 60c4da0011 merge: branch 'ovs_checkpoint'
checkpoint: fix port reactivation when controller is deactivating

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1928
2024-05-21 02:13:03 +00:00
Gris Ge a68d2fd780 checkpoint: fix port reactivation when controller is deactivating
Problem:

    Given a OVS port with `autoconnect-ports` set to default or false,
    when reactivation required for checkpoint rollback,
    previous activated OVS interface will be in deactivate state after
    checkpoint rollback.

The root cause:

    The `activate_stage1_device_prepare()` will mark the device as
    failed when controller is deactivating or deactivated.
    In `activate_stage1_device_prepare()`, the controller device is
    retrieved from NMActiveConnection, it will be NULL when NMActiveConnection
    is in deactivated state. This will cause device been set to
    `NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED` which prevent all follow
    up `autoconnect` actions.

Fix:
    When noticing controller is deactivating or deactivated with reason
    `NM_DEVICE_STATE_REASON_NEW_ACTIVATION`, use new function
    `nm_active_connection_set_controller_dev()` to wait on controller
    device state between NM_DEVICE_STATE_PREPARE and
    NM_DEVICE_STATE_ACTIVATED. After that, use existing
    `nm_active_connection_set_controller()` to use new
    NMActiveConnection of controller to move on.

Resolves: https://issues.redhat.com/browse/RHEL-31972

Signed-off-by: Gris Ge <fge@redhat.com>
2024-05-14 11:39:21 +08:00
Íñigo Huguet 0e64af01cc merge: branch 'ih/ip6_privacy_defaults'
ip6: revert to using sysctl ipv6.conf.default for ip6-privacy

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1937
2024-05-10 12:01:28 +00:00
Íñigo Huguet 7ec363a79a ip6: revert to using sysctl ipv6.conf.default for ip6-privacy
Commit 797f3cafee ('device: fall back to saved use_tempaddr value
instead of rereading /proc') changed the behaviour of how to get the
last resort default value for ip6-privacy property.

Previously we read it from /proc/sys/net/ipv6/conf/default, buf after
this commit we started to read /proc/sys/net/ipv6/conf/<iface> instead,
because the user might have set a different value specific for that device.
As NetworkManager changes that value on connection activation, we used
the value read at the time that NetworkManager was started.

Commit 6cb14ae6a6 ('device: introduce ipv6.temp-valid-lifetime and
ipv6.temp-preferred-lifetime properties') introduced 2 new IPv6 privacy
related properties relying on the same mechanism.

However, this new behaviour is problematic because it's not predictable
nor reliable:
- NetworkManager is normally started at boot time. That means that, if a
  user wants to set a new value to /proc/sys/net/ipv6/conf/<iface>,
  NetworkManager is likely alread running, so the change won't take
  effect.
- If NetworkManager is restarted it will read the value again, but this
  value can be the one set by NetworkManager itself in the last
  activation. This means that different values can be used as default in
  the same system boot depending on the restarts of NetworkManager.

Moreover, this weird situation might happen:
- Connection A with ip6-privacy=2 is activated
- NetworkManager is stopped. The value in
  /proc/sys/net/ipv6/conf/<iface>/use_tempaddr remains as 2.
- NetworkManager starts. It reads from /proc/sys/... and saves the value
  '2' as the default.
- Connection B with no ip6-privacy setting is activated. The '2' saved
  as default value is used. The connection didn't specify any value for
  it, and the value '2' was set by another connection for that specific
  connection only, not manually by a user that wanted '2' to be the
  default.

A user shouldn't have to think on when NetworkManager starts or restarts
to known in an easy and predictable way what the default value for
certain property is. It's totally counterintuitive.

Revert back to the old behaviour of reading from
/proc/sys/net/ipv6/conf/default. Although this value is used by the
kernel only for newly created interfaces, and not for already existing
ones, it is reasonable to think on these settings as "systemwide
defaults" that the user has chosen.

Note that setting a different default in NetworkManager.conf still takes
precedence.
2024-05-10 12:01:08 +00:00
Jan Vaclav edb6fa1dd7 merge: branch 'jv/break-autotools'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1931
2024-05-09 09:34:37 +00:00
Jan Vaclav 5f72b251b1 gitlab-ci: ignore autotools deprecation
We still need the tests to run on autotools builds too, so we must pass the argument.
2024-05-06 17:22:20 +02:00
Jan Vaclav 7b4acf938c contrib/fedora: update scripts to expect autotools deprecation 2024-05-06 16:39:08 +02:00
Jan Vaclav d115dcec50 build: break autotools configuration to warn about deprecation
We are planning on completely dropping Autotools in the future.
This breaks the build process with an argument to ignore the deprecation,
so that anyone building NM is warned of this change.
2024-05-06 15:25:50 +02:00
Íñigo Huguet 3eb24b43ad merge: branch 'ih/ci-clean-images'
CI: periodically clean image's registry

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1924
2024-05-06 09:03:27 +00:00
Íñigo Huguet 7a48290dca ci: disable the "triage issues" job
This job was supposed to run periodically. However, it stopped working
when a "workflow" section was added to .gitlab-ci.yml because it
prevented pipelines of the type "scheduled" to be created.
7fa72645e5 ('gitlab-ci: make detached MR pipeline for external contributor's pipelines to run')

Now, if it's run, it fails with error:
multi_xml requires Ruby version >= 3.1.4. The current ruby version is 2.7.8.225.

Let's disable the job until we fix it and we decide what triage we want
to do. When we do it, we will need to adapt the jobs to be run with the
right periodicity, maybe using custom pipeline variables.
2024-05-06 09:02:36 +00:00
Íñigo Huguet 69efb4660c CI: periodically clean image's registry
This will force to regenerate the various images of the distributions
that we want to test so we get an updated snapshot on them. Otherwise we
might be testing a months old version of them.

A bug in ci-fairy was making the deletion of the images to partially
fail. It is fixed in the latest version of ci-fairy, so we need to
update the value of templates_sha to pick it.

The task will run only on pipelines of type "scheduled". Then we can
create a weekly scheduled pipeline in Gitlab.
2024-05-06 09:02:36 +00:00
Jan Vaclav 5fae0403b8 contrib/rpm: use meson by default for builds on RHEL10
As part of our plan to deprecate autotools, we will now be using meson
by default to build NM releases on RHEL 10.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1929
2024-05-06 08:13:44 +00:00
Fernando Fernandez Mancera d8c4e70533 release: bump version to 1.49.0 (development) 2024-05-03 18:12:46 +02:00
Fernando Fernandez Mancera 8be0ba422d release: bump version to 1.47.90 (1.48-rc1) 2024-05-03 18:07:22 +02:00
Fernando Fernandez Mancera e1a0323fdd release.sh: adjust build path to meson-dist 2024-05-03 18:05:54 +02:00
Beniamino Galvani a0f798342a merge: branch 'bg/rollback-in-memory'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1920
2024-05-03 09:41:24 +02:00
Beniamino Galvani c979bfeb8b checkpoint: preserve in-memory state of connections
If a connection is in-memory (i.e. has flag "unsaved"), after a
checkpoint and rollback it can be wrongly persisted to disk:

 - if the connection was modified and written to disk after the
   rollback, during the rollback we update it again with persist mode
   "keep", which keeps it on disk;

 - if the connection was deleted after the rollback, during the
   rollback we add it again with persist mode "to-disk".

Instead, remember whether the connection had the "unsaved" flag set
and try to restore the previous state.

However, this is not straightforward as there are 4 different possible
states for the settings connection: persistent; in-memory only;
in-memory shadowing a persistent file; in-memory shadowing a detached
persistent file (i.e. the deletion of the connection doesn't delete
the persistent file). Handle all those cases.

Fixes: 3e09aed2a0 ('checkpoint: add create, rollback and destroy D-Bus API')
2024-05-02 16:49:23 +02:00
Beniamino Galvani a48b7fe7b9 settings: add nm_settings_connection_persist_mode_to_string() 2024-05-02 16:49:16 +02:00
Íñigo Huguet 064f20aa62 merge: branch 'ih/rt6_replace_resync'
platform: avoid routes resync for routes that we don't track

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1930
2024-05-02 10:50:07 +00:00
Íñigo Huguet 4d426f581d platform: avoid routes resync for routes that we don't track
When we recibe a Netlink message with a "route change" event, normally
we just ignore it if it's a route that we don't track (i.e. because of
the route protocol).

However, it's not that easy if it has the NLM_F_REPLACE flag because
that means that it might be replacing another route. If the kernel has
similar routes which are candidates for the replacement, it's hard for
NM to guess which one of those is being replaced (as the kernel doesn't
have a "route ID" or similar field to indicate it). Moreover, the kernel
might choose to replace a route that we don't have on cache, so we know
nothing about it.

It is important to note that we cannot just discard Netlink messages of
routes that we don't track if they has the NLM_F_REPLACE. For example,
if we are tracking a route with proto=static, we might receive a replace
message, changing that route to proto=other_proto_that_we_dont_track. We
need to process that message and remove the route from our cache.

As NM doesn't know what route is being replaced, trying to guess will
lead to errors that will leave the cache in an inconsistent state.
Because of that, it just do a cache resync for the routes.

For IPv4 there was an optimization to this: if we don't have in the
cache any route candidate for the replacement there are only 2 possible
options: either add the new route to the cache or discard it if we are
not interested on it. We don't need a resync for that.

This commit is extending that optimization to IPv6 routes. There is no
reason why it shouldn't work in the same way than with IPv4. This
optimization will only work well as long as we find potential candidate
routes in the same way than the kernel (comparing the same fields). NM
calls to this "comparing by WEAK_ID". But this can also happen with IPv4
routes.

It is worth it to enable this optimization because there are routing
daemons using custom routing protocols that makes tens or hundreds of
updates per second. If they use NLM_F_REPLACE, this caused NM to do a
resync hundreds of times per second leading to a 100% CPU usage:
https://issues.redhat.com/browse/RHEL-26195

An additional but smaller optimization is done in this commit: if we
receive a route message for routes that we don't track AND doesn't have
the NLM_F_REPLACE flag, we can ignore the entire message, thus avoiding
the memory allocation of the nmp_object. That nmp_object was going to be
ignored later, anyway, so better to avoid these allocations that, with
the routing daemon of the above's example, can happen hundreds of times
per second.

With this changes, the CPU usage doing `ip route replace` 300 times/s
drops from 100% to 1%. Doing `ip route replace` as fast as possible,
without any rate limitting, still keeps NM with a 3% CPU usage in the
system that I have used to test.
2024-04-30 13:13:46 +02:00