bond,bridge,team: use uuid for con.master when generating connection
If we're generating a connection for an externally configured slave, refer the master by the UUID instead of the device name. This doesn't matter most of the time. However, on a checkpoint restore we need to make sure that a connection that is unambiguously the original master is up. Otherwise it could happen that a different connection was activated on the same master device and the slaves being restored don't agree on which master connection to bring up. I can't think of any thing that would rely on this but I've been wrong about more serious things before. Fixes-test: @libnm_snapshot_reattach_unmanaged_ports_to_bridge https://bugzilla.redhat.com/show_bug.cgi?id=2125615
This commit is contained in:
@@ -225,6 +225,7 @@ controller_update_port_connection(NMDevice *self,
|
|||||||
{
|
{
|
||||||
NMSettingBondPort *s_port;
|
NMSettingBondPort *s_port;
|
||||||
int ifindex_port = nm_device_get_ifindex(port);
|
int ifindex_port = nm_device_get_ifindex(port);
|
||||||
|
NMConnection *applied_connection = nm_device_get_applied_connection(self);
|
||||||
uint queue_id = NM_BOND_PORT_QUEUE_ID_DEF;
|
uint queue_id = NM_BOND_PORT_QUEUE_ID_DEF;
|
||||||
gs_free char *queue_id_str = NULL;
|
gs_free char *queue_id_str = NULL;
|
||||||
|
|
||||||
@@ -243,7 +244,7 @@ controller_update_port_connection(NMDevice *self,
|
|||||||
|
|
||||||
g_object_set(nm_connection_get_setting_connection(connection),
|
g_object_set(nm_connection_get_setting_connection(connection),
|
||||||
NM_SETTING_CONNECTION_MASTER,
|
NM_SETTING_CONNECTION_MASTER,
|
||||||
nm_device_get_iface(self),
|
nm_connection_get_uuid(applied_connection),
|
||||||
NM_SETTING_CONNECTION_SLAVE_TYPE,
|
NM_SETTING_CONNECTION_SLAVE_TYPE,
|
||||||
NM_SETTING_BOND_SETTING_NAME,
|
NM_SETTING_BOND_SETTING_NAME,
|
||||||
NULL);
|
NULL);
|
||||||
|
@@ -680,7 +680,8 @@ master_update_slave_connection(NMDevice *device,
|
|||||||
NMSettingConnection *s_con;
|
NMSettingConnection *s_con;
|
||||||
NMSettingBridgePort *s_port;
|
NMSettingBridgePort *s_port;
|
||||||
int ifindex_slave = nm_device_get_ifindex(slave);
|
int ifindex_slave = nm_device_get_ifindex(slave);
|
||||||
const char *iface = nm_device_get_iface(device);
|
NMConnection *applied_connection = nm_device_get_applied_connection(device);
|
||||||
|
|
||||||
const Option *option;
|
const Option *option;
|
||||||
|
|
||||||
g_return_val_if_fail(ifindex_slave > 0, FALSE);
|
g_return_val_if_fail(ifindex_slave > 0, FALSE);
|
||||||
@@ -717,7 +718,7 @@ master_update_slave_connection(NMDevice *device,
|
|||||||
|
|
||||||
g_object_set(s_con,
|
g_object_set(s_con,
|
||||||
NM_SETTING_CONNECTION_MASTER,
|
NM_SETTING_CONNECTION_MASTER,
|
||||||
iface,
|
nm_connection_get_uuid(applied_connection),
|
||||||
NM_SETTING_CONNECTION_SLAVE_TYPE,
|
NM_SETTING_CONNECTION_SLAVE_TYPE,
|
||||||
NM_SETTING_BRIDGE_SETTING_NAME,
|
NM_SETTING_BRIDGE_SETTING_NAME,
|
||||||
NULL);
|
NULL);
|
||||||
|
@@ -261,6 +261,7 @@ master_update_slave_connection(NMDevice *device,
|
|||||||
const char *team_port_config = NULL;
|
const char *team_port_config = NULL;
|
||||||
const char *iface = nm_device_get_iface(device);
|
const char *iface = nm_device_get_iface(device);
|
||||||
const char *iface_slave = nm_device_get_iface(slave);
|
const char *iface_slave = nm_device_get_iface(slave);
|
||||||
|
NMConnection *applied_connection = nm_device_get_applied_connection(device);
|
||||||
|
|
||||||
tdc = _tdc_connect_new(self, iface, &connect_error);
|
tdc = _tdc_connect_new(self, iface, &connect_error);
|
||||||
if (!tdc) {
|
if (!tdc) {
|
||||||
@@ -299,7 +300,7 @@ master_update_slave_connection(NMDevice *device,
|
|||||||
|
|
||||||
g_object_set(nm_connection_get_setting_connection(connection),
|
g_object_set(nm_connection_get_setting_connection(connection),
|
||||||
NM_SETTING_CONNECTION_MASTER,
|
NM_SETTING_CONNECTION_MASTER,
|
||||||
iface,
|
nm_connection_get_uuid(applied_connection),
|
||||||
NM_SETTING_CONNECTION_SLAVE_TYPE,
|
NM_SETTING_CONNECTION_SLAVE_TYPE,
|
||||||
NM_SETTING_TEAM_SETTING_NAME,
|
NM_SETTING_TEAM_SETTING_NAME,
|
||||||
NULL);
|
NULL);
|
||||||
|
Reference in New Issue
Block a user