Commit Graph

33565 Commits

Author SHA1 Message Date
Beniamino Galvani
c32c731272 libnm-core: add 1.50 macros 2024-07-10 14:53:32 +02:00
Lubomir Rintel
c8ff1b30fb nmcli/dev: use secret agent for nmcli d [wifi] connect
Instead of asking the Wi-Fi password in advance (or not at all, if we're
creating a new connection for "nmcli d conn"), use the secret agent.

This makes things consistent with other places where we handle the secrets
for an activating connection in nmcli ("nmcli c up", "nmcli d con" with
an existing connection).

This also fixes the situation where the secrets would stop being
required, such as on enrollment via WPS button press on a router.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1960
2024-07-10 14:40:12 +02:00
Lubomir Rintel
51a43fb301 contrib/rpm: pull in formatting fixes from Fedora 2024-07-10 14:21:19 +02:00
Lubomir Rintel
3d0ddfd6be contrib/rpm: turn %ifcfg_migrate into a bcond 2024-07-10 14:21:19 +02:00
Lubomir Rintel
151decd333 contrib/rpm: turn %ifcfg_warning into a bcond 2024-07-10 14:21:19 +02:00
Lubomir Rintel
cfc6cd7a74 contrib/rpm: turn %split_ifcfg_rh into a bcond 2024-07-10 14:21:19 +02:00
Lubomir Rintel
2066e1743e contrib/rpm: turn %with_ifcfg_rh into a bcond 2024-07-10 14:21:19 +02:00
Lubomir Rintel
e4660336e7 contrib/rpm: turn %config_plugins_default_ifcfg_rh into a bcond 2024-07-10 14:21:19 +02:00
Lubomir Rintel
b87845b584 libnmc/secret-agent-simple: advise if WPS PBC enrollment is active
Print a different message on "nmcli --ask d wifi connect" if WPS
enrollment is in progress.

This is the same as GNOME Shell's secret agent (and perhaps
others) do.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1961
2024-07-10 13:15:04 +02:00
Fernando Fernandez Mancera
4f7c04eaf9 tools: add nm-to-rhcos script to our toolset
Script to create a RHCOS custom image containing a NetworkManager rpm from
a copr repository.

In order to have a custom RHCOS image, we cannot modify the image itself but
we can add a custom layered image that includes all RHCOS functionality and
adds additional functionality to it.

Requirements:
- A quay.io registry where you have push access.
- You must have your pull-secret in the same directory where the script is
being run. You can download your pull-secret from:
https://console.redhat.com/openshift/install/pull-secret

In order to install this on nodes from a cluster that already exists it must
be done using MachineConfig operator. In essence the following YAML file
must be created.

```
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
  labels:
    machineconfiguration.openshift.io/role: <role>
  name: os-layer-custom-nm
spec:
  osImageURL: <registry>
```

Please, notice that the role and registry need to be set to your needs.

Then, it can be applied by:

$ oc create -f <yaml file>

Finally, the machines will be ready once the field UPDATED has the True value
in the output of this command.

$ oc get mcp
2024-07-08 13:50:52 +02:00
Stanislas FAYE
71383394d5 release: bump version to 1.49.2 (development) 2024-07-05 13:33:24 +02:00
Stanislas Faye
c05f8d4758 merge: branch 'sf/update-news-for-1.50'
NEWS: update changes in 1.50

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1982
2024-07-05 07:46:00 +00:00
Stanislas FAYE
8e8277bedc NEWS: update changes in 1.50 2024-07-05 09:07:37 +02:00
Beniamino Galvani
5aa5d87ed6 merge: branch 'bg/hostname-fallback-hosts'
Consider entries in /etc/hosts for hostname resolution

https://issues.redhat.com/browse/RHEL-33435
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1974
2024-07-04 13:41:13 +00:00
Beniamino Galvani
543ebef32b docs: document the hostname management workflow 2024-07-04 15:39:03 +02:00
Beniamino Galvani
410afccb32 core: also use /etc/hosts for hostname resolution
Before introducing the hostname lookup via nm-daemon-helper and
systemd-resolved, we used GLib's GResolver which internally relies on
the libc resolver and generally also returns results from /etc/hosts.

With the new mechanism we only ask to systemd-resolved (with
NO_SYNTHESIZE) or perform the lookup via the "dns" NSS module. In both
ways, /etc/hosts is not evaluated.

Since users relied on having the hostname resolved via /etc/hosts,
restore that behavior. Now, after trying the resolution via
systemd-resolved and the "dns" NSS module, we also try via the "files"
NSS module which reads /etc/hosts.

Fixes: 27eae4043b ('device: add a nm_device_resolve_address()')
2024-07-04 15:39:03 +02:00
Beniamino Galvani
229bebfae9 nm-daemon-helper: add "service" argument
Introduce a new argument to specify a comma-separated list of NSS
services to use for the "resolve-address" command. For now only accept
"dns" and "files"; the latter can be used to do a lookup into
/etc/hosts.

Note that previously the command failed in presence of extra
arguments. Therefore, when downgrading NetworkManager without
restarting the service, the previously-installed version of the daemon
(newer) would spawn the helper with the extra argument, and the
newly-installed version of the helper (older) would fail. This issue
only impacts hostname resolution and can be fixed by just restarting
the daemon.

In the upgrade path everything works as before, with the only
difference that the helper will use by default both "dns" and "files"
services.

Don't strictly check for the absence of extra arguments, so that in
the future we can introduce more arguments without necessarily break
the downgrade path.
2024-07-04 15:39:03 +02:00
Beniamino Galvani
8c80077805 wwan: fix code format
Fixes: c0ddcf2998 ('wwan: Ensure we get existing objects on reset')
2024-07-04 15:38:03 +02:00
Cédric Bellegarde
c0ddcf2998 wwan: Ensure we get existing objects on reset
When ModemManager become available, NetworkManager resets
GDBusObjectManagerClient object.

But there is a race condition if object-added is emitted before
modm_ensure_manager(), we need to check existing objects if we want to be
in sync with ModemManager.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1957
2024-07-03 15:07:51 +02:00
Íñigo Huguet
73602b9d98 merge: branch 'ndisc-allow-multiple-gateways'
ndisc: support multiple gateways for a single network

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1952
2024-06-28 11:17:51 +00:00
Stefan Agner
f766059ea8 ndisc: support multiple gateways for a single network
Also check for gateway equality when deduplicate routing entries. This
allows to support multiple routes to the same network using different
gateways. This is useful for Thread networks where multiple BRs route
to the same Thread network. If one of these BRs go offline, fallback to
a different router will be much quicker if multiple entries are present.

Note that quick fallback to a different router requires IPv6
reachability probe to be active. Typically Linux disables reachability
probes on Linux machines which act as IPv6 gateway (when forwarding is
enabled).
2024-06-28 11:17:37 +00:00
Íñigo Huguet
7be55d6eff merge: branch 'jv/nmtui-veth'
nmtui: add veth page

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1943
2024-06-28 11:02:11 +00:00
Jan Vaclav
e74f506b81 nmtui: include veth devices in activation dialog 2024-06-28 11:01:51 +00:00
Jan Vaclav
187ff4c73b nmtui: add veth page
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1943
2024-06-28 11:01:51 +00:00
Íñigo Huguet
c2e6959af2 merge: branch 'jv/fix-newt-error-handling'
nmtui: handle write() errors correctly in nmt_newt_edit_string

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1971
2024-06-28 10:58:20 +00:00
Jan Vaclav
13317bd536 nmtui: handle write() errors correctly in nmt_newt_edit_string
It might happen that write() returns -1, but the errno is not EINTR.
In that case, the length would be incremented by 1, and the data pointer
to the data being written would be moved back by 1 byte on every error.

Make it so that the function exits with an error if it indicates an error.

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

Fixes: 3bda3fb60c ('nmtui: initial import of nmtui')
2024-06-28 10:58:11 +00:00
Íñigo Huguet
4b66f9fe71 merge: branch 'ih/distros-info-yml'
ci: add file with info about distros that we test

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1977
2024-06-28 10:56:48 +00:00
Íñigo Huguet
e15a9aa1a5 ci: add file with info about distros that we test
Useful to have easily accessible the info of all the distros that we
test, including the version of NM that they ship and their EOL dates so
we can know when to stop testing them.

For now this is only informative, but we can use this info, for example,
to generate the `.gitlab-ci/config.yml` file automatically for each
stable branch.
2024-06-28 10:56:28 +00:00
Beniamino Galvani
c759525e99 merge: branch 'bg/dhcp-remove-addr-on-expiry'
dhcp: remove the address synchronously on lease expiry

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1532
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1939
2024-06-28 07:44:23 +00:00
Beniamino Galvani
514a3cb610 dhcp: remove the address synchronously on lease expiry
When the lease expires, the DHCP client emits a LEASE_UPDATE event
with a NULL l3cd. After returning from the handler, it sends
immediately a DHCP DISCOVER message to try to get a new lease.

It is important that when the DISCOVER gets sent the address is no
longer configured on the interface. Otherwise, the server could see
that it is already in use and assign a different one. Therefore,
remove the address synchronously when handling the event.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1532
2024-06-28 09:42:11 +02:00
Jan Vaclav
593b4e01a4 gitlab-ci: ensure coverity job runs weekly
Currently, the condition is not strict enough, and so the job runs every time a scheduled task is triggered - which is currently daily.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1979
2024-06-28 07:35:32 +00:00
Jan Vaclav
c9327b2e8b agent: print error message character in hex form if it's unprintable
Currently, when the agent manager is sent a registration request
containing UTF-8 characters, it will form an invalid error message
using only one of the bytes from the UTF-8 sequence, which causes
an assertion in glib to fail, which replaces the returned error message
with "[Invalid UTF-8]". It will also print an assertion failure to the
console, or crash NetworkManager on non-release builds.

This commit makes it so that it instead prints out the character in
hexadecimal form if it isn't normally printable, so that it is once
again a valid UTF-8 string.

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

Fixes: a30cf19858 ('agent: add agent manager and minimal agent class')
2024-06-27 11:24:57 +00:00
Lubomir Rintel
6de187cb37 nmcli: always clean up readline on exit
A signal handler is not the only place where we need to clean up after
an in-progress readline() on exit; we may do so when erroring out as
well:

Before (not also the missing line break, which is part of the cleanup):

  $ (sleep 10; nmcli c del 'Red Hat Wi-Fi')
  $ nmcli --ask d wifi connect 'Red Hat Wi-Fi'
  Passwords or encryption keys are required to access the wireless network 'Red Hat Wi-Fi'.
  Password (802-11-wireless-security.psk): Error: Connection activation failed: The device's active connection disappeared.
  $ [terminal messed up, no echo]

After:

  $ (sleep 10; nmcli c del 'Red Hat Wi-Fi')
  $ nmcli --ask d wifi connect 'Red Hat Wi-Fi'
  Passwords or encryption keys are required to access the wireless network 'Red Hat Wi-Fi'.
  Password (802-11-wireless-security.psk):
  Error: Connection activation failed: The device's active connection disappeared.
  $ hello [terminal echo fine, wheee]

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1959
2024-06-26 14:15:16 +02:00
Jan Vaclav
508d43efc9 gitlab-ci: add coverity submissions to weekly scheduled CI
We currently submit builds to Coverity manually every now and then,
but it would make sense to submit them more frequently and periodically,
so that it can detect defects sooner.

Add a "coverity" stage to the pipeline, which submits a build to Coverit
(the scheduls currently set to run every week).

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1973
2024-06-26 12:58:03 +02:00
Beniamino Galvani
14eaf4e419 merge: branch 'bg/netlink-strict-check'
Enable strict check on the netlink socket

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1962
2024-06-26 07:54:02 +00:00
Beniamino Galvani
185932a1a2 platform: enable strict check on netlink socket dumps
In the future we might want to specify filters when requesting netlink
dumps; this requires that strict check is enabled on the socket.

When enabling strict check, we need to pass a full struct in the
netlink message, otherwise kernel ignores it.

This commit doesn't change behavior.
2024-06-26 09:52:50 +02:00
Beniamino Galvani
2b8d8fe92a platform: don't set RTM_F_LOOKUP_TABLE for IPv6
RTM_F_LOOKUP_TABLE is only needed for IPv4. IPv6 dumps with the flag
are rejected in strict mode.
2024-06-26 09:52:50 +02:00
Beniamino Galvani
cac8c445e0 merge: branch 'feature/mstrodl/connectivity-timeout'
Add a timeout option to connectivity checks

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1968
2024-06-25 08:12:44 +00:00
Mary Strodl
ed318e8774 connectivity: Add a timeout option to connectivity checks
Adds an option in the connectivity section to change the timeout before
the interface is deemed "limited". Previously, it was hardcoded to
20 seconds, but for our usecase (failing over to cell modem if
hardwired ethernet drops), it's nice to be able to failover to another
interface more quickly.
2024-06-24 09:21:34 +00:00
Beniamino Galvani
0d657af256 crypto: regenerate PKCS#12 certificates
The PKCS#12 certificates are using SHA1 and RC2-40, which are deprecated;
regenerate them with:

 $ openssl pkcs12 -export -in test_key_and_cert.pem -inkey test_key_and_cert.pem -certfile test_ca_cert.pem -name "test-pkcs12" -out test-cert.p12
 (key: test)

 $ openssl pkcs12 -export -in test2_key_and_cert.pem -inkey test2_key_and_cert.pem -certfile test2_ca_cert.pem -name "test2-pkcs12" -out test2-cert.p12
 (key: 12345testing)

Before:
 $ openssl pkcs12 -info -in test-cert.p12
 MAC: sha1, Iteration 2048
 MAC length: 20, salt length: 8
 PKCS7 Encrypted data: pbeWithSHA1And40BitRC2-CBC, Iteration 2048

After:
 $ openssl pkcs12 -info -in test-cert.p12
 MAC: sha256, Iteration 2048
 MAC length: 32, salt length: 8
 PKCS7 Encrypted data: PBES2, PBKDF2, AES-256-CBC, Iteration 2048, PRF hmacWithSHA256
2024-06-24 09:48:42 +02:00
Beniamino Galvani
d2536a7d7f valgrind: update suppression for memmove and inet_pton6
inet_pton6() can be called from different functions, make the
suppression more generic.
2024-06-21 23:03:11 +02:00
Beniamino Galvani
97324356cd release: bump version to 1.49.1 (development) 2024-06-21 15:24:07 +02:00
Gris Ge
606283afdc merge: branch 'bg/ovs-interface-by-mac'
ovs: allow specifying a system OVS interface by MAC address

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1975
2024-06-21 07:50:15 +00:00
Beniamino Galvani
be28a11735 ovs: allow specifying a system OVS interface by MAC address
The OVS interface can be matched via MAC address; in that case, the
"connection.interface-name" property of the connection is empty.

When populating the ovsdb, we need to pass the actual interface name
from the device, not the one from the connection.

Fixes: 830a5a14cb ('device: add support for OpenVSwitch devices')

https://issues.redhat.com/browse/RHEL-34617
2024-06-20 17:02:01 +02:00
Jan Vaclav
a5333f14b5 nm-in-container: create conf.d file instead of modifying journald.conf
Currently, the Dockerfile expects /etc/systemd/journald.conf to exist on the base container,
but sometimes this may not be the case, for example on Fedora 40, which causes
the build process to fail if the host machine is also running Fedora 40.

Update the dockerfile to create a conf.d file instead, which has higher precedence.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1972
2024-06-19 11:47:51 +00:00
Íñigo Huguet
8924bfe18c merge: branch 'jv/add-missing-vaargs'
gen-metadata-nm-settings-nmcli: add missing va_end in _prop_log() after using vaargs

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1970
2024-06-19 11:10:58 +00:00
Jan Vaclav
7d0115ea98 gen-metadata-nm-settings-nmcli: add missing va_end in _prop_log() after using vaargs
It was missing before.

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

Fixes: af5c1c8019 ('man nm-settings-nmcli: autogenerate the "Format" field')
2024-06-19 11:10:46 +00:00
Íñigo Huguet
51531a055f merge: branch 'out-or-range-typo'
libnm: fix typo

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1969
2024-06-19 11:07:25 +00:00
Anders Jonsson
bdb2a488c3 libnm: fix typo 2024-06-19 11:06:59 +00:00
Íñigo Huguet
270285e82a merge: branch 'lr/dac-override-comment'
service: remove a misleading comment

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1963
2024-06-19 11:06:21 +00:00