2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-05-17 11:54:16 +00:00

fix: use connection UUID in bridge slave setup to handle spaces in NM profile names

NetworkManager can auto-generate connection names with spaces (e.g.
"Wired connection 2"). The bridge slave setup in create_bridge_interface_nmcli
stored this name in a variable that was later expanded unquoted in nmcli
commands, breaking both the initial con mod and all downstream operations
(con up, con delete on rollback). Resolve the connection to its UUID
before use, which is space-safe and valid for all nmcli operations.

Closes: #7483
This commit is contained in:
Vinícius Ferrão
2026-05-07 03:06:41 -03:00
parent 238b357428
commit a6c2bc3790
+4 -2
View File
@@ -2035,8 +2035,10 @@ function create_bridge_interface_nmcli {
fi
con_use_same_dev=$(wait_nic_connect_intime $_port)
if [ "$con_use_same_dev" != "--" -a -n "$con_use_same_dev" ]; then
cmd="$nmcli con mod "$con_use_same_dev" master $ifname $_mtu connection.autoconnect-priority 9 autoconnect yes connection.autoconnect-slaves 1 connection.autoconnect-retries 0"
xcat_slave_con=$con_use_same_dev
# Resolve to UUID since connection names can contain spaces (e.g. "Wired connection 2")
con_uuid=$($nmcli --get-values connection.uuid c show "$con_use_same_dev")
cmd="$nmcli con mod $con_uuid master $ifname $_mtu connection.autoconnect-priority 9 autoconnect yes connection.autoconnect-slaves 1 connection.autoconnect-retries 0"
xcat_slave_con=$con_uuid
else
cmd="$nmcli con add type $_pretype con-name $xcat_slave_con ifname $_port master $ifname $_mtu connection.autoconnect-priority 9 autoconnect yes connection.autoconnect-slaves 1 connection.autoconnect-retries 0"
fi