Lubomir Rintel 2022-10-05 11:42:34 +02:00
commit 7a54a3f36d
5 changed files with 34 additions and 26 deletions

View file

@ -228,9 +228,10 @@ controller_update_port_connection(NMDevice *self,
GError **error)
{
NMSettingBondPort *s_port;
int ifindex_port = nm_device_get_ifindex(port);
uint queue_id = NM_BOND_PORT_QUEUE_ID_DEF;
gs_free char *queue_id_str = NULL;
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;
gs_free char *queue_id_str = NULL;
g_return_val_if_fail(ifindex_port > 0, FALSE);
@ -247,7 +248,7 @@ controller_update_port_connection(NMDevice *self,
g_object_set(nm_connection_get_setting_connection(connection),
NM_SETTING_CONNECTION_MASTER,
nm_device_get_iface(self),
nm_connection_get_uuid(applied_connection),
NM_SETTING_CONNECTION_SLAVE_TYPE,
NM_SETTING_BOND_SETTING_NAME,
NULL);

View file

@ -679,9 +679,10 @@ master_update_slave_connection(NMDevice *device,
NMDeviceBridge *self = NM_DEVICE_BRIDGE(device);
NMSettingConnection *s_con;
NMSettingBridgePort *s_port;
int ifindex_slave = nm_device_get_ifindex(slave);
const char *iface = nm_device_get_iface(device);
const Option *option;
int ifindex_slave = nm_device_get_ifindex(slave);
NMConnection *applied_connection = nm_device_get_applied_connection(device);
const Option *option;
g_return_val_if_fail(ifindex_slave > 0, FALSE);
@ -717,7 +718,7 @@ master_update_slave_connection(NMDevice *device,
g_object_set(s_con,
NM_SETTING_CONNECTION_MASTER,
iface,
nm_connection_get_uuid(applied_connection),
NM_SETTING_CONNECTION_SLAVE_TYPE,
NM_SETTING_BRIDGE_SETTING_NAME,
NULL);

View file

@ -6573,27 +6573,30 @@ device_recheck_slave_status(NMDevice *self, const NMPlatformLink *plink)
NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED);
}
if (master && NM_DEVICE_GET_CLASS(master)->attach_port) {
nm_device_master_add_slave(master, self, FALSE);
if (master) {
if (NM_DEVICE_GET_CLASS(master)->attach_port) {
nm_device_master_add_slave(master, self, FALSE);
} else {
_LOGD(LOGD_DEVICE,
"enslaved to non-master-type device %s; ignoring",
nm_device_get_iface(master));
}
goto out;
}
if (master) {
_LOGD(LOGD_DEVICE,
"enslaved to non-master-type device %s; ignoring",
nm_device_get_iface(master));
} else {
if (plink->master) {
_LOGD(LOGD_DEVICE,
"enslaved to unknown device %d (%s%s%s)",
plink->master,
NM_PRINT_FMT_QUOTED(plink_master, "\"", plink_master->name, "\"", "??"));
if (!priv->ifindex_changed_id) {
priv->ifindex_changed_id = g_signal_connect(nm_device_get_manager(self),
NM_MANAGER_DEVICE_IFINDEX_CHANGED,
G_CALLBACK(device_ifindex_changed_cb),
self);
}
}
if (!priv->ifindex_changed_id) {
priv->ifindex_changed_id = g_signal_connect(nm_device_get_manager(self),
NM_MANAGER_DEVICE_IFINDEX_CHANGED,
G_CALLBACK(device_ifindex_changed_cb),
self);
}
return;
out:
@ -6605,6 +6608,8 @@ device_ifindex_changed_cb(NMManager *manager, NMDevice *device_changed, NMDevice
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
g_return_if_fail(priv->master_ifindex > 0);
if (priv->master_ifindex != nm_device_get_ifindex(device_changed))
return;

View file

@ -258,9 +258,10 @@ master_update_slave_connection(NMDevice *device,
gs_free_error GError *connect_error = NULL;
int err = 0;
struct teamdctl *tdc;
const char *team_port_config = NULL;
const char *iface = nm_device_get_iface(device);
const char *iface_slave = nm_device_get_iface(slave);
const char *team_port_config = NULL;
const char *iface = nm_device_get_iface(device);
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);
if (!tdc) {
@ -299,7 +300,7 @@ master_update_slave_connection(NMDevice *device,
g_object_set(nm_connection_get_setting_connection(connection),
NM_SETTING_CONNECTION_MASTER,
iface,
nm_connection_get_uuid(applied_connection),
NM_SETTING_CONNECTION_SLAVE_TYPE,
NM_SETTING_TEAM_SETTING_NAME,
NULL);

View file

@ -416,10 +416,10 @@ activate:
}
} else {
/* The device was initially disconnected, deactivate any existing connection */
_LOGD("rollback: disconnecting device");
if (nm_device_get_state(device) > NM_DEVICE_STATE_DISCONNECTED
&& nm_device_get_state(device) < NM_DEVICE_STATE_DEACTIVATING) {
_LOGD("rollback: disconnecting device");
nm_device_state_changed(device,
NM_DEVICE_STATE_DEACTIVATING,
NM_DEVICE_STATE_REASON_USER_REQUESTED);