mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-03 20:40:34 +01:00
libnm: allow OVS external-ids also for system interface
Note that reapply currently does not work for OVS system interface. That is, because the code does not make it easy to implement that.
This commit is contained in:
parent
a9bc3eecc6
commit
9cc242596d
2 changed files with 31 additions and 13 deletions
|
|
@ -345,7 +345,9 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||
}
|
||||
|
||||
if (connection) {
|
||||
const char *type;
|
||||
NMSettingConnection *s_con;
|
||||
const char * type;
|
||||
const char * slave_type;
|
||||
|
||||
type = nm_connection_get_connection_type(connection);
|
||||
if (!type) {
|
||||
|
|
@ -355,18 +357,31 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||
if (s_base)
|
||||
type = nm_setting_get_name(s_base);
|
||||
}
|
||||
if (!NM_IN_STRSET(type,
|
||||
NM_SETTING_OVS_BRIDGE_SETTING_NAME,
|
||||
NM_SETTING_OVS_PORT_SETTING_NAME,
|
||||
NM_SETTING_OVS_INTERFACE_SETTING_NAME)) {
|
||||
g_set_error_literal(error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("OVS external IDs can only be added to a profile of type OVS "
|
||||
"bridge/port/interface"));
|
||||
return FALSE;
|
||||
}
|
||||
if (NM_IN_STRSET(type,
|
||||
NM_SETTING_OVS_BRIDGE_SETTING_NAME,
|
||||
NM_SETTING_OVS_PORT_SETTING_NAME,
|
||||
NM_SETTING_OVS_INTERFACE_SETTING_NAME))
|
||||
goto connection_type_is_good;
|
||||
|
||||
if ((s_con = nm_connection_get_setting_connection(connection))
|
||||
&& _nm_connection_detect_slave_type_full(s_con,
|
||||
connection,
|
||||
&slave_type,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL)
|
||||
&& nm_streq0(slave_type, NM_SETTING_OVS_PORT_SETTING_NAME))
|
||||
goto connection_type_is_good;
|
||||
|
||||
g_set_error_literal(error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("OVS external IDs can only be added to a profile of type OVS "
|
||||
"bridge/port/interface or to OVS system interface"));
|
||||
return FALSE;
|
||||
}
|
||||
connection_type_is_good:
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12442,8 +12442,11 @@ can_reapply_change(NMDevice * self,
|
|||
}
|
||||
|
||||
if (nm_streq(setting_name, NM_SETTING_OVS_EXTERNAL_IDS_SETTING_NAME)
|
||||
&& NM_DEVICE_GET_CLASS(self)->can_reapply_change_ovs_external_ids)
|
||||
&& NM_DEVICE_GET_CLASS(self)->can_reapply_change_ovs_external_ids) {
|
||||
/* TODO: this means, you cannot reapply changes to the external-ids for
|
||||
* OVS system interfaces. */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
out_fail:
|
||||
g_set_error(error,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue