Commit Graph

33714 Commits

Author SHA1 Message Date
Tomas Korbar
c08ecfd5fe dns: Add resolve-mode and certification-authority keys to global-dns
Resolve-mode allows user to specify way how the global-dns domains
and DNS connection information should be merged and used.

Certification-authority allows user to specify certification
authority that should be used to verify certificates of encrypted
DNS servers.
2025-01-29 14:41:47 +01:00
Beniamino Galvani
c9be26cf9a format: run nm-code-format
The new clang-format changed the formatting output, update the code.
2025-01-29 14:38:22 +01:00
Beniamino Galvani
17f274d5b4 libnm-glib-aux: fix build error with GCC 15
Fix the following error with GCC 15:

  ../src/libnm-glib-aux/nm-shared-utils.c:35:42: error: initializer-string for array of 'char' is too long [-Werror=unterminated-string-initialization]
     35 | const char _nm_hexchar_table_lower[16] = "0123456789abcdef";
        |                                          ^~~~~~~~~~~~~~~~~~
  ../src/libnm-glib-aux/nm-shared-utils.c:36:42: error: initializer-string for array of 'char' is too long [-Werror=unterminated-string-initialization]
     36 | const char _nm_hexchar_table_upper[16] = "0123456789ABCDEF";
        |                                          ^~~~~~~~~~~~~~~~~~

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2116
2025-01-28 17:07:26 +01:00
Lubomir Rintel
49e7db7047 cloud-setup: avoid accidental cast into a smaller type
This resulted in what looked like more significant bits of GType pointer
sometimes falling off the cliff, presumably because of a cast to
NMDeviceType enum (that probably ends up actually being a char).

This was silent enough to not emit compiler warnings and only occurring
with some very rare situations (needs GCC with LTO and some of the
optimization flags used by Fedora 41).

Fixes: cf6af54ffa ('cloud-setup: allow VETH along with ETHERNET too')
Fixes: 6ff4b9e57c ('cloud-setup: create VLANs for multiple VNICs on OCI')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2119
2025-01-28 14:05:55 +01:00
Lubomir Rintel
cc4a0a9f10 test-client: collect pexpect subprocess status
Always explicitly tear down pexpect instances and collect their
results. Assert on the results after orderly teardowns.

Track the current pexpect instance in test context so that it could be
still collected if the test blows up. That could provide more clue into
what went wrong in the test if it's due to a crash the testee.

Before:

  [1573928.02238] <debug> config device C0:00:00:00:00:10: creating vlan connection for VLAN 700 on C0:00:00:00:00:10...
  [1573928.02330] <debug> config device C0:00:00:00:00:10: connection "vlan2" (ac3c08f5-3e5c-38a3-a366-c16253de6db2) created
  ======================================================================
  ERROR: test_oci_vlans (__main__.TestNmCloudSetup.test_oci_vlans)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
  ...
      pexp.expect("some changes were applied for provider oci")
      ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ...
  pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.

After:

  [1573928.02238] <debug> config device C0:00:00:00:00:10: creating vlan connection for VLAN 700 on C0:00:00:00:00:10...
  [1573928.02330] <debug> config device C0:00:00:00:00:10: connection "vlan2" (ac3c08f5-3e5c-38a3-a366-c16253de6db2) created
  *** pexpect'd process killed by SIGABRT ***
  ======================================================================
  ERROR: test_oci_vlans (__main__.TestNmCloudSetup.test_oci_vlans)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
  ...
      pexp.expect("some changes were applied for provider oci")
      ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ...
  pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2119
2025-01-28 14:05:51 +01:00
Lubomir Rintel
7023d8b444 test-client: fix TestNmCloudSetup valgrind run
Allow running the following locally (for quick loval nm-c-s valgrind check),
without requiring $NM_TEST_CLIENT_NMCLI_PATH to be set.

  $ NM_TEST_CLIENT_CLOUD_SETUP_PATH=build/src/nm-cloud-setup/nm-cloud-setup \
      NMTST_USE_VALGRIND=1 python src/tests/client/test-client.py TestNmCloudSetup

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2119
2025-01-28 14:05:48 +01:00
Beniamino Galvani
610e0cb8cd merge: branch 'bg/dhcp-doc'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2111
2025-01-20 19:06:29 +01:00
Beniamino Galvani
95ac6b71cb man: fix typo 2025-01-20 19:03:51 +01:00
Beniamino Galvani
d0330fb909 man: remove sentence about order of DHCP clients
The list describing the order of DHCP clients is confusing because it
doesn't take into account what clients are disabled at build
time. Instead, just show the available clients in the preferred order.
2025-01-20 19:03:49 +01:00
Beniamino Galvani
774484eed6 man: document which DHCP clients are enabled in this build
Describe in the NetworkManager.conf man page what DHCP clients the
user can set in this build, instead of showing a generic list and
letting the user try each one.
2025-01-20 19:02:06 +01:00
Beniamino Galvani
98b124a661 dhcp: drop dhcpcanon support
Drop support for the "dhcpcanon" DHCP client. It's unmantained, as the
last code change was in 2018:

  https://github.com/juga0/dhcpcanon/commits

There is no need to first deprecate it because it was still marked as
"experimental" in NM. Also, it's not packaged by any recent distro, so
we can assume that nobody will miss it.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2112
2025-01-20 18:56:41 +01:00
Lubomir Rintel
79219553be cloud-setup: fix build
Fixes: 6ff4b9e57c ('cloud-setup: create VLANs for multiple VNICs on OCI')
2025-01-20 17:53:58 +01:00
Lubomir Rintel
cf6af54ffa cloud-setup: allow VETH along with ETHERNET too
Pairs of veth devides are used for CI testing in place of real
ethernets. Use GLib types instead of NM numbers, since it's possible to
match them in hierarchical manner, with NMDeviceVeth being a subclass of
NMDeviceEthernet.

Fixes: 6ff4b9e57c ('cloud-setup: create VLANs for multiple VNICs on OCI')
2025-01-20 14:24:11 +01:00
Lubomir Rintel
91878d3653 merge: branch 'lr/oci-vlans'
Resolves: https://issues.redhat.com/browse/RHEL-61770

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2083
2025-01-20 14:11:07 +01:00
Lubomir Rintel
9b258faab4 client/test: add test for VLANs on OCI 2025-01-20 14:08:12 +01:00
Lubomir Rintel
6ff4b9e57c cloud-setup: create VLANs for multiple VNICs on OCI
The idea is to create a pair of VLAN and MACVLAN with AddAndActivate if
they are not present, and otherwise follow the ordinary (GetApplied &
Reapply) procedure if the devices are already present.
2025-01-20 14:08:12 +01:00
Lubomir Rintel
55ed4f7f6d cloud-setup: skip connections unless given type mismatches
Wired and Ipv4 always there, rest varies by connection type (Wired,
Vlan, MacVlan).
2025-01-20 14:08:12 +01:00
Lubomir Rintel
daef3b7b3f cloud-setup: lookup device by MAC + type instead of just MAC
This will be useful for updating configuration of Vlans and MacVlans,
some of having same MAC addresses as devices of other type.
2025-01-20 14:08:12 +01:00
Lubomir Rintel
04f0491a58 cloud-setup: make _device_get_hwaddr() work with all kinds of devices
We'll have Vlans and MacVlans soon, and those don't have permanent
addresses.
2025-01-20 14:08:12 +01:00
Lubomir Rintel
04e426a7bf cloud-setup: s/_nmc_get_hwaddrs()/_nmc_get_ethernet_hwaddrs()/
Make it clear that this only works for Ethernet devices.
2025-01-20 14:08:12 +01:00
Lubomir Rintel
c3861bc50a cloud-setup: add a sync wrapper around AddAndActivate
These will be used to create the software devices.
2025-01-20 14:08:12 +01:00
Lubomir Rintel
87b23669fa client/test: add nm-c-s OCI test
Very basic.
2025-01-20 14:08:12 +01:00
Lubomir Rintel
ecafa051df client/test: add ability to log pexpect traffic 2025-01-20 14:08:12 +01:00
Lubomir Rintel
a0c14665a3 client/test: move run_post() into TestNmcli
It attempts to modify attributes clearly belong to TestNmcli such as
_skip_test_for_l10n_diff or call methods that are in unittest.TestCase:

  ======================================================================
  ERROR: test_002 (__main__.TestNmcli.test_002)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File ".../src/tests/client/test-client.py", line 1508, in f
      self.ctx.run_post()
      ~~~~~~~~~~~~~~~~~^^
    File ".../src/tests/client/test-client.py", line 1185, in run_post
      self.fail(
      ^^^^^^^^^
  AttributeError: 'NMTestContext' object has no attribute 'fail'

It has presumably been moved out of TestNmcli at some point, but that
seems to have been in error, as it's also pretty specific to the nmcli
test cases. Not useful for cloud-init tests that also utilize
NMTestContext. Move it back.
2025-01-20 14:08:12 +01:00
Lubomir Rintel
fadfb7bba1 test/nm-service: add support for creating a MACVLAN
...via AddAndActivate. nm-cloud-setup will do that.
2025-01-20 14:08:12 +01:00
Lubomir Rintel
91524b8419 test/nm-service: create Vlan devices matching the parent by hwaddr
This is how OCI VLANS will be looking up their parents. Make sure the
mock is able to deal with this.
2025-01-20 14:08:12 +01:00
Lubomir Rintel
158adac3a6 test/nm-service: create software devices on AddAndActivate()
This will be useful for testing VLAN bringup.
2025-01-20 14:08:12 +01:00
Lubomir Rintel
93983155bf test/nm-service: add MacvlanDevice class
We'll need to test the nm-cloud-setup OCI multiple VNIC support.
2025-01-20 14:08:12 +01:00
Lubomir Rintel
392f76a23b test/nm-service: add Device.HwAddress property
nm-cloud-setup finds devices by hwaddr. Let's expose it for all device
types, so that we're be able to test once we add VLANs and MACVLANs.
2025-01-20 14:08:12 +01:00
Lubomir Rintel
f7c8597835 test/cloud-meta-mock: do not print what we listen on if we got a FD
This message is useless for non-interactive use and clobbers over
otherwise very appealing test output.

The callers knows what we're going to listen on, it passed us the file
descriptor.
2025-01-20 14:08:12 +01:00
Íñigo Huguet
98f8224376 cloud-setup: oci: remove the max 2 phys NICs limit
Right now, on any baremetal only max. 2 physical NICs are available.
This might change in the future, so better to directly accept larger
nicIndex if we receive it. No behaviour change with this, just remove
an artificial limit.
2025-01-20 14:08:12 +01:00
Íñigo Huguet
cfd7dd86c9 cloud-setup: parse OCI metadata related to VLAN config
Baremetal instances in Oracle Cloud require special VLAN config. Parse
the metadata related to it.
2025-01-20 14:08:12 +01:00
Beniamino Galvani
755cc74175 release: bump version to 1.51.6 (development) 2025-01-20 14:02:23 +01:00
Íñigo Huguet
dd5b4fcf24 nmcs: remove nmcs_provider_*_get_type forward declaration
There is no need to avoid including the full header, they are small
headers with some GLib type system stuff and no more. Just include them
where they are needed.
2025-01-20 06:18:45 +01:00
Íñigo Huguet
7fc22ef5de nmcs: oci: use macro to log warnings 2025-01-20 06:18:45 +01:00
Lubomir Rintel
eb635c23a7 manager: create virtual devices on AddAndActivate()
If the connection didn't exist in advance, there's no unrealized device,
and find_device_by_iface() is not going to get us one.

Call system_create_virtual_device() afrer nm_utils_complete_generic()
completes the connection for virtual devices. Make sure we do proper
cleanup if we happen to fail the activation later, so that de device
doesn't end up hanging there.
2025-01-20 06:18:45 +01:00
Lubomir Rintel
57e140d961 manager: split device creation off from validate_activation_request()
Make validate_activation_request() only do the validation -- split the
determination of the device into find_device_for_activation().

The point of this is to be able complete the connection and actually
create a virtual device after the validation.

I believe this is also somewhat easier to follow now that the procedure
does what its name says.
2025-01-20 06:15:54 +01:00
Lubomir Rintel
25871f1971 manager: reword some error messages
They've been a little too cryptic and unnecessarily long before.
2025-01-20 06:13:59 +01:00
Lubomir Rintel
cfe6e730b3 device: don't log connection UUIDs on device creation
It's irrelevant, doesn't look good, and might possibly be not there
because the connection has not been normalized yet.
2025-01-20 06:13:59 +01:00
Lubomir Rintel
be034a1f3f device: simplify the nm_utils_complete_generic() machinery
The point is to get rid of device/connection type specific arguments, to
eventually be able to complete the connection on AddAndActivate before knowing
which factory is going to take care of creating the device.

Aside from that, the whole thing is pretty awful -- with complicated
macros and variadic argument (ugh). Let's get rid of that.
2025-01-20 06:13:59 +01:00
Lubomir Rintel
6635aeed99 device: get_connection_parent() accept incomplete connections
All of these are wrong asserting that a connection has a particular
setting. On AddAndActivate, the connection can be pretty much empty:

  impl_manager_add_and_activate_connection ()
    validate_activation_request ()
      nm_manager_get_best_device_for_connection ()
      iface = nm_manager_get_connection_iface ()
        find_parent_device_for_connection ()
          nm_device_factory_get_connection_parent () <====== *shriek*
        nm_device_factory_get_connection_iface ()
      find_device_by_iface (iface)
    nm_device_complete_connection ()

Remove those assertions.
2025-01-20 06:13:58 +01:00
Lubomir Rintel
b7a8486c53 device: cleanup get_connection_iface() callbacks
Some of them are wrong: they assert a connection has a particular
setting even though this can be called on AddAndActivate against a
connection that is not complete or normalized:

  impl_manager_add_and_activate_connection ()
    validate_activation_request ()
      nm_manager_get_best_device_for_connection ()
      iface = nm_manager_get_connection_iface ()
        find_parent_device_for_connection ()
          nm_device_factory_get_connection_parent ()
        nm_device_factory_get_connection_iface () <====== here
      find_device_by_iface (iface)
    nm_device_complete_connection ()

Fix those by removing the assertions.

Some of them are also fall back to just calling
nm_connection_get_interface_name() which is a pretty useless thing to do
because nm_device_factory_get_connection_iface() only calls the
device-specific routine if nm_device_factory_get_connection_iface()
doesn't return anything, to give the factory a chance to make up a name
(like <parent>.<vlan-id> for Vlan) on its own. Drop those.
2025-01-20 06:13:58 +01:00
Lubomir Rintel
e3d3f1315a device/factory: document that some callbacks get an incomplete connection
It's get_connection_parent() and get_connection_iface().
2025-01-20 06:13:58 +01:00
Íñigo Huguet
f7a30b3241 merge: branch 'ih/ci-check-tree-optional'
ci: make check-tree optional for branches other than main

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2095
2025-01-17 11:21:25 +00:00
Íñigo Huguet
9e47c9bc6a ci: make check-tree optional for branches other than main
Old branches tend to be formatted with a different versions of
clang-format, so when patches are backported, they introduce some
differences in formatting, making the check-tree job to fail.

These changes in formatting are normally small, and we don't pay much
attention to them, causing that the pipelines are always red, increasing
the work required to check if there are important failures or not.

Make check-tree optional for branches other than main. This way,
failures will be shown as a "warning", and if a pipeline only shows a
warning we don't need to inspect it.
2025-01-17 12:16:43 +01:00
Beniamino Galvani
16b932c200 merge: branch 'pr/precedence'
man/NetworkManager-dispatcher: document /{etc,usr} precedence

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2081
2025-01-16 16:12:12 +00:00
Jonathan Lebon
99bb6b7593 man/NetworkManager-dispatcher: document /{etc,usr} precedence
This seems to be left implied but let's document it explicitly.
2025-01-16 16:11:09 +00:00
Jan Vaclav
191aaf0fb2 merge: branch 'jv/fix-qos-mapping'
platform/vlan: fix incorrect type for ingress/egress qos mappings

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2109
2025-01-16 11:09:13 +00:00
Jan Vaclav
4107a6883f platform/test: reenable xgress qos tests
Fixes: 6e30e37ebe ('test: disable vlan_xgress unit test')
2025-01-16 11:08:44 +00:00
Jan Vaclav
84bcc0eab9 platform/vlan: fix incorrect type for ingress/egress qos mappings
The kernel was updated to add stricter validation to netlink messages,
which revealed this bug:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6c21660fe221a15c789dee2bc2fd95516bc5aeaf

Fixes: a5ea141956 ('platform/vlan: add support for ingress/egress-qos-mappings and changing flags')
2025-01-16 11:08:44 +00:00