Beniamino Galvani 2021-05-19 10:31:39 +02:00
commit a7cf9046d3
2 changed files with 22 additions and 0 deletions

View file

@ -77,6 +77,15 @@ is_available(NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
return nm_ovsdb_is_ready(priv->ovsdb); return nm_ovsdb_is_ready(priv->ovsdb);
} }
static gboolean
can_auto_connect(NMDevice *device, NMSettingsConnection *sett_conn, char **specific_object)
{
NMDeviceOvsInterface * self = NM_DEVICE_OVS_INTERFACE(device);
NMDeviceOvsInterfacePrivate *priv = NM_DEVICE_OVS_INTERFACE_GET_PRIVATE(self);
return nm_ovsdb_is_ready(priv->ovsdb);
}
static gboolean static gboolean
check_connection_compatible(NMDevice *device, NMConnection *connection, GError **error) check_connection_compatible(NMDevice *device, NMConnection *connection, GError **error)
{ {
@ -424,6 +433,7 @@ nm_device_ovs_interface_class_init(NMDeviceOvsInterfaceClass *klass)
device_class->connection_type_check_compatible = NM_SETTING_OVS_INTERFACE_SETTING_NAME; device_class->connection_type_check_compatible = NM_SETTING_OVS_INTERFACE_SETTING_NAME;
device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES(NM_LINK_TYPE_OPENVSWITCH); device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES(NM_LINK_TYPE_OPENVSWITCH);
device_class->can_auto_connect = can_auto_connect;
device_class->can_update_from_platform_link = can_update_from_platform_link; device_class->can_update_from_platform_link = can_update_from_platform_link;
device_class->deactivate = deactivate; device_class->deactivate = deactivate;
device_class->deactivate_async = deactivate_async; device_class->deactivate_async = deactivate_async;

View file

@ -363,6 +363,7 @@ static NMActiveConnection *active_connection_find(NMManager * self,
NMSettingsConnection * sett_conn, NMSettingsConnection * sett_conn,
const char * uuid, const char * uuid,
NMActiveConnectionState max_state, NMActiveConnectionState max_state,
gboolean also_waiting_auth,
GPtrArray ** out_all_matching); GPtrArray ** out_all_matching);
static NMConnectivity *concheck_get_mgr(NMManager *self); static NMConnectivity *concheck_get_mgr(NMManager *self);
@ -833,6 +834,7 @@ _delete_volatile_connection_do(NMManager *self, NMSettingsConnection *connection
connection, connection,
NULL, NULL,
NM_ACTIVE_CONNECTION_STATE_DEACTIVATED, NM_ACTIVE_CONNECTION_STATE_DEACTIVATED,
TRUE,
NULL)) NULL))
return; return;
@ -978,6 +980,7 @@ active_connection_find(
NMSettingsConnection * sett_conn, NMSettingsConnection * sett_conn,
const char * uuid, const char * uuid,
NMActiveConnectionState max_state /* candidates in state @max_state will be found */, NMActiveConnectionState max_state /* candidates in state @max_state will be found */,
gboolean also_waiting_auth /* return also ACs waiting authorization */,
GPtrArray ** out_all_matching) GPtrArray ** out_all_matching)
{ {
NMManagerPrivate * priv = NM_MANAGER_GET_PRIVATE(self); NMManagerPrivate * priv = NM_MANAGER_GET_PRIVATE(self);
@ -1017,6 +1020,9 @@ active_connection_find(
if (!best_ac) { if (!best_ac) {
AsyncOpData *async_op_data; AsyncOpData *async_op_data;
if (!also_waiting_auth)
return NULL;
c_list_for_each_entry (async_op_data, &priv->async_op_lst_head, async_op_lst) { c_list_for_each_entry (async_op_data, &priv->async_op_lst_head, async_op_lst) {
NMSettingsConnection *ac_conn; NMSettingsConnection *ac_conn;
@ -1078,6 +1084,7 @@ active_connection_find_by_connection(NMManager * self,
sett_conn, sett_conn,
sett_conn ? NULL : nm_connection_get_uuid(connection), sett_conn ? NULL : nm_connection_get_uuid(connection),
max_state, max_state,
FALSE,
out_all_matching); out_all_matching);
} }
@ -1112,6 +1119,7 @@ _get_activatable_connections_filter(NMSettings * settings,
sett_conn, sett_conn,
NULL, NULL,
NM_ACTIVE_CONNECTION_STATE_ACTIVATED, NM_ACTIVE_CONNECTION_STATE_ACTIVATED,
FALSE,
NULL); NULL);
} }
@ -2245,6 +2253,7 @@ connection_flags_changed(NMSettings *settings, NMSettingsConnection *connection,
connection, connection,
NULL, NULL,
NM_ACTIVE_CONNECTION_STATE_DEACTIVATED, NM_ACTIVE_CONNECTION_STATE_DEACTIVATED,
FALSE,
NULL)) { NULL)) {
/* the connection still has an active-connection. It will be purged /* the connection still has an active-connection. It will be purged
* when the active connection(s) get(s) removed. */ * when the active connection(s) get(s) removed. */
@ -2564,6 +2573,7 @@ new_activation_allowed_for_connection(NMManager *self, NMSettingsConnection *con
connection, connection,
NULL, NULL,
NM_ACTIVE_CONNECTION_STATE_ACTIVATED, NM_ACTIVE_CONNECTION_STATE_ACTIVATED,
FALSE,
NULL); NULL);
} }
@ -4181,6 +4191,7 @@ find_master(NMManager * self,
master_connection, master_connection,
NULL, NULL,
NM_ACTIVE_CONNECTION_STATE_DEACTIVATING, NM_ACTIVE_CONNECTION_STATE_DEACTIVATING,
FALSE,
NULL); NULL);
} }
@ -5032,6 +5043,7 @@ _internal_activate_device(NMManager *self, NMActiveConnection *active, GError **
sett_conn, sett_conn,
NULL, NULL,
NM_ACTIVE_CONNECTION_STATE_ACTIVATED, NM_ACTIVE_CONNECTION_STATE_ACTIVATED,
FALSE,
&all_ac_arr); &all_ac_arr);
if (ac) { if (ac) {
n_all = all_ac_arr ? all_ac_arr->len : ((guint) 1); n_all = all_ac_arr ? all_ac_arr->len : ((guint) 1);