Commit graph

33836 commits

Author SHA1 Message Date
Beniamino Galvani
db2f88bc73 ovs: only keep bridges and ports with NM interfaces attached
If a OVS bridge created via NM has a port created externally, when the
bridge connections goes down then NM detaches the NM-created
port. However, it finds that the bridge still has a port (the external
one) and so it doesn't remove the bridge from ovsdb.

This is a problem, because it means that an explicity deactivation of
the bridge leaves the bridge up. To fix this, only track the number of
port in the bridge actually created by NM. Also, leave alone bridges
not created by NM.

(cherry picked from commit 476c89b6f2)
2025-10-15 09:27:54 +02:00
Beniamino Galvani
1877c8b464 ovs: slightly improve _delete_interface()
Add comments, and move variables inside the block where they are used.

(cherry picked from commit 78a4e5cf3b)
2025-10-15 09:27:54 +02:00
Íñigo Huguet
2f6597a673 merge: branch 'ih/update-distros-1.52'
[nm-1-52] ci: update distros

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2273
2025-09-08 13:50:59 +00:00
Íñigo Huguet
bd9886963e [nm-1-52] ci: update distros 2025-09-08 13:06:31 +02:00
Jan Tojnar
507c0d625c meson: Fix docs generation with PyGObject 3.52
PyGObject 3.52 switched from gobject-introspection’s libgirepository 1.0
to glib’s libgirepository 2.0. As a result, the Python script would
no longer be able to find the `GIRepository` 2.0 typelib:

    (process:1944): GLib-GIRepository-DEBUG: 15:25:14.521: Ignoring GIRepository-2.0.typelib because this libgirepository corresponds to GIRepository-3.0.typelib

We could update the script to support both versions of the typelib
but it is not really necessary. It was only used to add extra directories
from `$LD_LIBRARY_PATH` and the CLI argument to repository’s library path
but libgirepository already supports using `LD_LIBRARY_PATH` directly:
https://docs.gtk.org/girepository/method.Repository.prepend_library_path.html

(cherry picked from commit 12eff9a7fd)
2025-09-08 13:06:13 +02:00
Beniamino Galvani
95d2da5da9 device: ensure that sw devices are unrealized after connection deletion
When a software device becomes deactivated, we check whether it can
be unrealized (= deleted in kernel), by calling function
delete_on_deactivate_check_and_schedule().

The function returns without doing anything if there is a new
activation enqueued on the device (priv->queued_act_request), because
in that case the device will be reused for the next activation.

This commit fixes a problem seen in NMCI test
@ovs_delete_connecting_interface: sometimes the device is not
unrealized after deleting the connection. That happens because if the
queued activation fails, we never try again to unrealize the device.

Fix that by calling delete_on_deactivate_check_and_schedule() when
there is a failure starting the queued activation.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2258
(cherry picked from commit 0b03614b68)
(cherry picked from commit 1f23bb18ad)
2025-08-27 13:13:47 +02:00
Beniamino Galvani
0135379ac4 device: accept changes to the bond-port.vlans during reapply
Commit c5d1e35f99 ('device: support reapplying bridge-port VLANs')
didn't update can_reapply_change() to accept the "bridge-port.vlans"
property during a reapply. So, it was only possible to change the
bridge port VLANs by updating the "bridge.vlan-default-pvid" property
and doing a reapply. Fix that.

Fixes: c5d1e35f99 ('device: support reapplying bridge-port VLANs')
(cherry picked from commit 261fa8db33)
(cherry picked from commit c647c060d6)
2025-08-12 14:14:13 +02:00
Beniamino Galvani
1489f9d0e3 bridge: fix reapplying port VLANs
If the bridge default-pvid is zero, it means that the default PVID is
disabled. That is, the bridge PVID is not propagated to ports.

Currently NM tries to merge the existing bridge VLANs on the port with
the default PVID from the bridge, even when the PVID is zero. This
causes an error when setting the new VLAN list in the kernel, because
it rejects VLAN zero.

Skip the merge of the default PVID when zero.

Fixes: c5d1e35f99 ('device: support reapplying bridge-port VLANs')
(cherry picked from commit bf79fbd678)
(cherry picked from commit 956f9ba365)
2025-08-12 14:10:32 +02:00
Jan Vaclav
826e37b175 release: bump version to 1.52.1 2025-07-08 12:21:52 +02:00
Jan Vaclav
2ee4ba9034 NEWS: update for 1.52.1 release 2025-07-08 11:19:58 +02:00
Beniamino Galvani
7106daf1a3 ovs: set the tun interface up before stage3
When using the netdev datapath, we wait that the tun link appears, we
call nm_device_set_ip_ifindex() (which also brings the link up) and
then we check that the link is ready, i.e. that udev has announced the
link and the MAC address is correct. After that, we schedule stage3
(ip-config).

In this, there is a race condition that occurs sometimes in NMCI test
ovs_datapath_type_netdev_with_cloned_mac. In rare conditions,
nm_device_set_ip_ifindex() bring the interface up but then ovs-vswitch
changes again the flags of the interface without IFF_UP. The result is
that the interface stays down, breaking communications.

To fix this, we need to always call nm_device_bring_up() after the tun
device is ready. The problem is that we can't do it in
_netdev_tun_link_cb() because that function is already invoked
synchronously from platform code.

Instead, simplify the handling of the netdev datapath. Every
"link-changed" event from platform is handled by
_netdev_tun_link_cb(), which always schedule a delayed function
_netdev_tun_link_cb_in_idle(). This function just assigns the
ip-ifindex to the device if missing, and starts stage3 if the link is
ready. While doing so, it also bring the interface up.

Fixes: 99a6c6eda6 ('ovs, dpdk: fix creating ovs-interface when the ovs-bridge is netdev')

https://issues.redhat.com/browse/RHEL-17358

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2218
(cherry picked from commit 46e0d2b4e4)
(cherry picked from commit dd0ca122e3)
2025-06-27 10:33:57 +02:00
Beniamino Galvani
3dfd364502 connectivity: fix compiler warning when building without concheck
Fix the following:

../src/core/nm-connectivity.c:958:1: warning: ‘check_platform_config’ defined but not used [-Wunused-function]
  958 | check_platform_config(NMConnectivity *self,
      | ^~~~~~~~~~~~~~~~~~~~~

Fixes: 91d447df19 ('device: don't start connectivity check on unconfigured devices')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2224
(cherry picked from commit 1253cbad5a)
(cherry picked from commit c1d94d7081)
2025-06-27 10:33:52 +02:00
Beniamino Galvani
35f11cd6e1 ip-config: fix crash in DNS options evaluation
Fixes: 58287cbcc0 ('core: rework IP configuration in NetworkManager using layer 3 configuration')
(cherry picked from commit c1350f40bd)
2025-06-27 10:33:45 +02:00
Beniamino Galvani
ff9032ff9d device: update the external-down unmanaged flag on port attach/release
A device has the "external-down" unmanaged flag when:

  !is-created-by-nm AND (!is-up OR (!has-address AND !is-controller))

When the "is-up" or the "has-address" conditions change, we properly update
the unmanaged flag by calling _dev_unmanaged_check_external_down() in
_dev_l3_cfg_notify_cb(PLATFORM_CHANGE_ON_IDLE).

The "is-controller" condition changes when another link indicates the
current device as controller. We currently don't update the unmanaged flag
when that happens and so it's possible that the device stays unmanaged even
if it has a port. This can be easily reproduced by running this commands:

    ip link add veth0 type veth peer name veth1
    ip link add vrf0 type vrf table 10
    ip link set vrf0 up
    ip link set veth0 master vrf0

Sometimes, the device shows as "unmanaged" instead of "connected
(externally)".

Fix this by re-evaluating the "external-down" unmanaged flags on the
controller when a port is attached or detached.

Fixes: c3586ce01a ('device: consider a device with slaves configured')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2209
(cherry picked from commit fd3eccfb16)
2025-06-27 10:33:41 +02:00
Íñigo Huguet
37e72927d7 core: virtual devices can be available without a parent set
When calling to nm_device_is_available, the device types that requires a
parent like VLAN or MACVLAN checks that their parent exists.

nm_device_is_available is a function to check if the device is available
to activate a connection, so it makes sense that if the parent is not
present it can't be activated.

However, this is wrong for 2 reasons:
1. Most of they are virtual devices that might be unrealized when
   checking its availability. If they're unrealized, their parent hasn't
   been set yet.
2. Even if they're realized, their current parent might not be the one
   that is defined in the connection that is being activated.

This is causing that unrealized devices are not being activated as ports
because nm_manager_get_best_device_for_connection thinks that they are
not available.

Get rid of these checks for the parent in the is_available callbacks.

Fixes: ba86c208e0 ('Revert "core: prevent the activation of unavailable OVS interfaces only"')
Fixes: 774badb151 ('core: prevent the activation of unavailable devices')
(cherry picked from commit 94595332c4)
2025-06-27 10:33:23 +02:00
Íñigo Huguet
e059388f05 merge: branch 'ih/initrd-fix-bond-ip6'
nm-initrd-generator: fix IPv6 with square brackets in bond options

Closes #1755 and #1731

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

(cherry picked from commit 34255b2692)
2025-06-27 10:29:41 +02:00
Íñigo Huguet
399b08aab6 nm-initrd-generator: fix ignored prefix for IPv6 address with brackets
When defining an IPv6 address with square brackets and prefix, like
[dead::beef]/64, the prefix was silently ignored. The address was
accepted only accidentally, because get_word replaced ']' with '\0' so
it resulted in a valid IPv6 address string, but without the prefix.

The previous commit has fixed get_word with better logic to handle the
square brackets, uncovering this issue.

Fix it by explicitly splitting IP addresses and prefixes in
reader_parse_ip so we get a valid address and prefix.

Also, use a prefix different to 64 in the test test_if_ip6_manual. 64 is
the default one, making that the test passed despite the defined prefix
was actually ignored.

Fixes: ecc074b2f8 ('initrd: add command line parser')
(cherry picked from commit 6f6bb17a28)
2025-06-27 10:29:39 +02:00
Íñigo Huguet
693e1e9742 nm-initrd-generator: fix IPv6 with square brackets in bond options
If any bond option contains an IPv6 address it needs to be enclosed with
[]. Otherwise the ':' separators from the IP address can be confused
with the ':' separators from the 'bond=' cmdline arguments.

However, the square brackets were ignored:
    $ nm-initrd-generator -s "bond=bond0:eth0,eth1:ns_ip6_target=[FC08::789:1:0:0:3]"
    NetworkManager-Message: 08:46:55.114: <warn>  [1745498815.1146] cmdline-reader: Ignoring invalid bond option: "ns_ip6_target" = "[FC08": '[FC08' is not a valid IPv6 address for 'ns_ip6_target' option
    NetworkManager-Message: 08:46:55.114: <warn>  [1745498815.1148] cmdline-reader: Ignoring extra: '789:1:0:0:3]'.

The opening '[' was only being considered if it was the first character
in `get_word`. Fix it and consider it if it's in the middle too.

If the brackets are used first and last, directly remove them as it is what
most callers expect. However, if it's in the middle there is no reasonable
way to remove them, so don't do it. Instead, the caller will have to consider
this possibility when processing the content.

Fixes: ecc074b2f8 ('initrd: add command line parser')
Fixes https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1755

(cherry picked from commit aeaf8ca23c)
2025-06-27 10:29:39 +02:00
Beniamino Galvani
6d3ff1c30b man: fix syntax to match on connection-id
Fixes: 604c611cd0 ('core: add nm_utils_connection_match_spec_list()')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1746
(cherry picked from commit b571e2be5a)
2025-06-27 10:29:16 +02:00
Beniamino Galvani
b83f847b4d libnm-core: set ovs-dpdk and ovs-patch as non-base settings
Settings "ovs-dpdk" and "ovs-patch" are currently marked with priority
NM_SETTING_PRIORITY_HW_BASE, which makes them "base" settings. This
means that they can be used as connection type, for example via "nmcli
connection add type ovs-dpdk ...".

This is wrong, as both settings can only belong to a connection of
type "ovs-interface". Decrease their priority and make them non-base
settings.

The problem was spotted when trying to add a ovs-patch connection via
nmcli:

  # nmcli connection add type ovs-patch ifname p con-name q ovs-patch.peer r controller s port-type ovs-port
  Warning: controller='s' doesn't refer to any existing profile.

  (process:4580): nm-CRITICAL **: 10:15:42.807: file ../src/libnm-core-impl/nm-connection.c: line 1682 (_normalize_ovs_interface_type): should not be reached

  (process:4580): nm-WARNING **: 10:15:42.807: connection did not verify after normalization: ??

  (process:4580): nm-CRITICAL **: 10:15:42.807: file ../src/libnm-core-impl/nm-connection.c: line 2170 (_connection_normalize): should not be reached
  Error: Failed to add 'q' connection: ovs-interface.type: A connection with 'ovs-patch' setting must be of connection.type "ovs-interface" but is "ovs-patch"

Fixes: d0ec501163 ('cli: assert that valid_parts are set for base types')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2178
(cherry picked from commit 14106431fb)
2025-06-27 10:29:01 +02:00
Beniamino Galvani
2172c5ff5a libnm: fix memory leak when parsing IP configuration
When the dictionary contains keys "address" and "uri", the first value
is leaked.

  ==4730== 14 bytes in 1 blocks are definitely lost in loss record 51 of 1,755
  ==4730==    at 0x4841866: malloc (vg_replace_malloc.c:446)
  ==4730==    by 0x4CC5CB9: g_malloc (gmem.c:100)
  ==4730==    by 0x4CDF518: g_strdup (gstrfuncs.c:323)
  ==4730==    by 0x496A6B8: g_strdup_inline (gstrfuncs.h:321)
  ==4730==    by 0x496A6B8: nm_inet_ntop_dup (nm-inet-utils.h:355)
  ==4730==    by 0x496A95B: nm_inet_parse_str (nm-inet-utils.c:539)
  ==4730==    by 0x48AF3A3: _notify_update_prop_nameservers (nm-ip-config.c:179)

Fixes: 4422b14704 ('core, libnm: support per-connection DNS URIs')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2184
(cherry picked from commit 37d8945b13)
2025-06-27 10:28:43 +02:00
Friedrich Altheide
59be16b91a device: renew dhcp lease only if carrier was down
Make sure nm_device_update_dynamic_ip_setup is called every time a carrier was down before and the link is now up again.
Previously the dhcp lease was not renewed if the carrier went down and then up again quickly enough.
This led to cases where an old IP was retained even though the device was connected to a different network with a different DHCP server.

This commit introduces device_link_carrier_changed_down

Fixes: d6429d3ddb ('device: ensure DHCP is restarted every time the link goes up')
(cherry picked from commit 163c2574d8)
2025-06-27 10:26:51 +02:00
Íñigo Huguet
051a4a27a2 merge: branch 'ih/coverity'
Fix some defects detected by Coverity

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

(cherry picked from commit 95b9b4b678)
2025-06-27 10:25:52 +02:00
Íñigo Huguet
a1e1dd2978 n-dhcp4: fix resource leaks
The function n_dhcp4_c_connection_send_request does not release or take
ownership of its request argument. Because of that, setting it to NULL
in the caller prevents the auto-cleanup of the variable to be executed,
causing a resource leak. Fix it.

Fixes: e23b3c9c3a ('Squashed 'shared/n-dhcp4/' content from commit fb1d43449')
Fixes: 243cc433fb ('n-dhcp4: add new client probe function to send RELEASE message')
(cherry picked from commit 9edfc0438c)
2025-06-27 10:25:51 +02:00
Íñigo Huguet
d19068c9e3 core: fix use after free in ping operations
Detected by coverity, the ping_op pointers are used after being freed in
cleanup_ping_operations. Although calling to g_list_remove is probably
safe because it only needs the value of the pointer, not to dereference
it, better to follow best practices. One of the use after free was
actually an error because we dereference ping_op->log_domain.

Fixes: 658aef0fa1 ('connection: Support connection.ip-ping-addresses')
(cherry picked from commit ae7de5b353)
2025-06-27 10:25:51 +02:00
Íñigo Huguet
ca39902cee bond-slb: initialize dest hw address in GARP packets
Detected by Coverity:
    1. NetworkManager-1.53.1/src/core/nm-bond-manager.c:885:5: var_decl: Declaring variable "data" without initializer.
    7. NetworkManager-1.53.1/src/core/nm-bond-manager.c:948:13: uninit_use_in_call: Using uninitialized value "data". Field "data.d_hw_addr" is uninitialized when calling "sendto".
       946|               unaligned_write_ne32(data.s_ip_addr, tmp_addr);
       947|               unaligned_write_ne32(data.d_ip_addr, tmp_addr);
       948|->             if (sendto(sockfd, &data, sizeof(data), 0, (struct sockaddr *) &addr, sizeof(addr)) < 0)
       949|                   return FALSE;
       950|           }

Fixes: 3f2f922dd9 ('bonding: send ARP announcement on bonding-slb link/carrier down')
(cherry picked from commit 42edb37499)
2025-06-27 10:25:51 +02:00
Beniamino Galvani
e766920e0b vpn: fix logging message
Fixes: c4a7d6a06f ('vpn: honor the ipvX.method connection property')
(cherry picked from commit ecce8fa461)
2025-06-27 10:25:21 +02:00
Beniamino Galvani
9e640cb751 release: fix validation of gitlab token
If the token is wrong or expired, the command still returns
success. Check the content of the reply instead.

Fixes: f05192ada8 ('release.sh: release to freedesktop.org, not to GNOME')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2148
(cherry picked from commit 481afec6ea)
2025-06-27 10:24:25 +02:00
Beniamino Galvani
75bb71fddf libnm: fix GObject introspection annotations for NMSecretAgentOld
Add some missing "(nullable)" annotations to parameters of the
callback functions in NMSecretAgentOld. Otherwise, PyGObject complains
that those parameters cannot be NULL when implementing a secret agent.

Fixes: d595f7843e ('libnm: add libnm/libnm-core (part 1)')
(cherry picked from commit c01168f4f9)
2025-06-27 10:24:13 +02:00
Íñigo Huguet
c3ed106d63 libnm: macvlan: specify that promiscuous affects to the parent
Fixes: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1732
Fixes: 4d0192e661 ('libnm-core: add NMSettingMacvlan')
(cherry picked from commit 1fdcfb7abe)
2025-06-27 10:23:59 +02:00
Beniamino Galvani
9c74fa8e36 device: remove the prefix-delegation IP configuration on cleanup
When a device in IPv6 shared mode obtains a prefix, it adds a new l3cd
of type L3_CONFIG_DATA_TYPE_PD_6 for that prefix. However, that l3cd
is never removed later and so the address lingers on the interface
even after the connection goes down. Remove the l3cd on cleanup.

(cherry picked from commit 4a8bedcd89)
2025-06-27 10:04:39 +02:00
Wen Liang
2fe69da6fd merge: branch 'wl/nm-1-52'
core: ovs: fix NULL pointer dereference in ovsdb read timeout callback

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2204
2025-05-14 17:18:35 +00:00
Íñigo Huguet
9ec498f321 core: ovs: fix NULL pointer dereference in ovsdb read timeout callback
Fixes: f7d321c6d6 ('ovsdb: add watchdog for unparsable JSON data in socket')
(cherry picked from commit dc9bf255ee)
2025-05-14 07:59:44 -04:00
Jan Vaclav
15a68c6a9b merge: branch 'jv/wg-nftables'
wireguard: add connmark and filtering firewall rules

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

(cherry picked from commit 5e17b52810)
2025-05-12 13:38:38 +02:00
Jan Vaclav
ae420a8dd6 firewall/utils: replace ipv4 iptables macro with ipxtables macro
(cherry picked from commit 2106251e46)
2025-05-12 13:38:38 +02:00
Jan Vaclav
3f2c0869dc firewall/utils: remove _share prefix from iptables_get_name
It's no longer used just for shared mode.

(cherry picked from commit 18d5b7d641)
2025-05-12 13:38:38 +02:00
Jan Vaclav
4d0223f8a4 firewall/wireguard: drop packets received to wrong interface
If we receive a packet sent to the WG interface's address,
but it does not come from the WG tunnel, let's assume something
is broken and drop the packet.

This is also inspired by wg-quick firewall rules:
https://git.zx2c4.com/wireguard-tools/tree/src/wg-quick/linux.bash?id=17c78d31c27a3c311a2ff42a881057753c6ef2a4#n221

(cherry picked from commit a769c17af7)
2025-05-12 13:38:38 +02:00
Jan Vaclav
2afcebe0c7 wireguard: add firewall rules to copy mark
When a WG connection is connecting to an IPv6 endpoint, configures a
default route, and firewalld is active with IPv6_rpfilter=yes, it never
handshakes and doesn't pass traffic. This is because firewalld has a
IPv6 reverse path filter which is discarding these packets.

Thus, we add some firewall rules whenever a WG connection is brought up
that ensure the conntrack mark and packet mark are copied over.
These rules are largely inspired by wg-quick:

https://git.zx2c4.com/wireguard-tools/tree/src/wg-quick/linux.bash?id=17c78d31c27a3c311a2ff42a881057753c6ef2a4#n221
(cherry picked from commit db557908a2)
2025-05-12 13:38:38 +02:00
Jan Vaclav
57321f78c9 build: add path definition for ip6tables
(cherry picked from commit 0f469b30ad)
2025-05-12 13:38:38 +02:00
Jan Vaclav
ff853203d9 firewall/utils: move logs from sharing to firewall domain
(cherry picked from commit 10c2892d57)
2025-05-12 13:38:38 +02:00
Jan Vaclav
e77a1df6e7 firewall/utils: fix ntf -> nft typo
Fixes: 4badc1f33a ('firewall: fix signalling timeout error reason from _fw_nft_call()')
(cherry picked from commit e39e119636)
2025-05-12 13:38:38 +02:00
Beniamino Galvani
6f480d9494 ovs: allow reapplying ovs-bridge and ovs-port properties
Allow reapplying the following properties:

 - ovs-bridge.fail-mode
 - ovs-bridge.mcast-snooping-enable
 - ovs-bridge.rstp-enable
 - ovs-bridge.stp-enable
 - ovs-port.bond-downdelay
 - ovs-port.bond-mode
 - ovs-port.bond-updelay
 - ovs-port.lacp
 - ovs-port.tag
 - ovs-port.trunks
 - ovs-port.vlan-mode

(cherry picked from commit 4f577d677f)
2025-05-09 16:45:50 +02:00
Vladimír Beneš
e568648717 merge: branch 'vb/dnsconfd_oci_backports'
backport oci chnages to nm-1-52

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2188
2025-04-11 13:16:40 +00:00
Lubomir Rintel
0c5e37f34d test-client: add test for OCI VNIC on VM
Tests that we create a connection for disconnected device.

(cherry picked from commit cb7157f552)
2025-04-11 14:45:08 +02:00
Lubomir Rintel
4321cca3e8 test-client: split up _mock_devices()
The new VM OCI VNIC tests will need to create the devices, but leave one
disconnected.

(cherry picked from commit c42322bd0d)
2025-04-11 14:45:03 +02:00
Lubomir Rintel
629d85e4da test-client: expand MAC addresses from variable
Less literals, more expanded variables. Makes it a little easier to read
for me.

(cherry picked from commit 39db524d94)
2025-04-11 14:44:58 +02:00
Lubomir Rintel
a212c9452e test/nm-service: default the devices to DISCONNETED not UNAVAILABLE
It is a little odd that client tests connect "UNAVAILABLE" devices, and
the devices return to "DISCONNECTED" after deactivation.

It differs from what happens in reality, and some client tools
(hey nm-cloud-setup) can break when they rightly assume that the
device is not ready for activation when it's "UNAVAILABLE" not
"DISCONNECTED".

(cherry picked from commit 79b1877c02)
2025-04-11 14:44:53 +02:00
Lubomir Rintel
8371b4733e cloud-setup: configure disconnected wired devices on OCI
On OCI VMs (virtual machines, as opposed to BM -- bare metal), the VNICs
don't get their addresses via DHCP and need us to get the address from
the metadata and apply it.

https://issues.redhat.com/browse/NMT-1432
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2180
(cherry picked from commit 548e27ef5f)
2025-04-11 14:44:48 +02:00
Lubomir Rintel
06e35f165f cloud-setup: add a chicken bit variable for creation of new connections
Make it possible to opt in or out of the behavior of creating
connections for disconnected devices. It's not clear why such policy was
in place, and the feature might come useful outside OCI.

Let's add an (undocumented) knob to configure the behavior. We might
remove it (and perhaps make the behaviour default everywhere), or
document and keep it if it turns out we need to use it.

(cherry picked from commit 0540b3c9bc)
2025-04-11 14:44:43 +02:00
Lubomir Rintel
e933dfaf72 cloud-setup: factor out creation of new connection
We're going to create connections on wired devices for OCI VM VNICs, and
they're going to also need the same user setting. Factor it out.

(cherry picked from commit 93960639e8)
2025-04-11 14:44:37 +02:00