mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-12 08:00:26 +01:00
libnm: introduce hsr.protocol-version property
This property allows the user to set the protocol
version when using HSR. Currently, the property
supports two values - `2010` (referred to as HSRv0
in the kernel), and `2012` (HSRv1).
(cherry picked from commit 9a2395c779)
This commit is contained in:
parent
afc1a88f64
commit
d3d545deca
7 changed files with 97 additions and 5 deletions
|
|
@ -2076,3 +2076,9 @@ global:
|
|||
nm_setting_sriov_get_preserve_on_down;
|
||||
nm_sriov_preserve_on_down_get_type;
|
||||
} libnm_1_52_0;
|
||||
|
||||
libnm_1_54_2 {
|
||||
global:
|
||||
nm_setting_hsr_get_protocol_version;
|
||||
nm_setting_hsr_protocol_version_get_type;
|
||||
} libnm_1_54_0;
|
||||
|
|
|
|||
|
|
@ -1528,6 +1528,10 @@
|
|||
dbus-type="s"
|
||||
gprop-type="gchararray"
|
||||
/>
|
||||
<property name="protocol-version"
|
||||
dbus-type="i"
|
||||
gprop-type="gint"
|
||||
/>
|
||||
<property name="prp"
|
||||
dbus-type="b"
|
||||
gprop-type="gboolean"
|
||||
|
|
|
|||
|
|
@ -23,12 +23,18 @@
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
NM_GOBJECT_PROPERTIES_DEFINE(NMSettingHsr, PROP_PORT1, PROP_PORT2, PROP_MULTICAST_SPEC, PROP_PRP, );
|
||||
NM_GOBJECT_PROPERTIES_DEFINE(NMSettingHsr,
|
||||
PROP_PORT1,
|
||||
PROP_PORT2,
|
||||
PROP_MULTICAST_SPEC,
|
||||
PROP_PRP,
|
||||
PROP_PROTOCOL_VERSION, );
|
||||
|
||||
typedef struct {
|
||||
char *port1;
|
||||
char *port2;
|
||||
guint32 multicast_spec;
|
||||
int protocol_version;
|
||||
bool prp;
|
||||
} NMSettingHsrPrivate;
|
||||
|
||||
|
|
@ -117,6 +123,22 @@ nm_setting_hsr_get_prp(NMSettingHsr *setting)
|
|||
return NM_SETTING_HSR_GET_PRIVATE(setting)->prp;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_hsr_get_protocol_version:
|
||||
* @setting: the #NMSettingHsr
|
||||
*
|
||||
* Returns: the #NMSettingHsr:protocol-version property of the setting
|
||||
*
|
||||
* Since: 1.56, 1.54.2
|
||||
**/
|
||||
NMSettingHsrProtocolVersion
|
||||
nm_setting_hsr_get_protocol_version(NMSettingHsr *setting)
|
||||
{
|
||||
g_return_val_if_fail(NM_IS_SETTING_HSR(setting), NM_SETTING_HSR_PROTOCOL_VERSION_DEFAULT);
|
||||
|
||||
return NM_SETTING_HSR_GET_PRIVATE(setting)->protocol_version;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static gboolean
|
||||
|
|
@ -160,6 +182,18 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (priv->prp && priv->protocol_version != NM_SETTING_HSR_PROTOCOL_VERSION_DEFAULT) {
|
||||
g_set_error(error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("HSR protocol cannot be configured for PRP interfaces"));
|
||||
g_prefix_error(error,
|
||||
"%s.%s: ",
|
||||
NM_SETTING_HSR_SETTING_NAME,
|
||||
NM_SETTING_HSR_PROTOCOL_VERSION);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -260,6 +294,27 @@ nm_setting_hsr_class_init(NMSettingHsrClass *klass)
|
|||
NMSettingHsr,
|
||||
_priv.prp);
|
||||
|
||||
/**
|
||||
* NMSettingHsr:protocol-version:
|
||||
*
|
||||
* Configures the protocol version to be used for the HSR/PRP interface.
|
||||
* %NM_SETTING_HSR_PROTOCOL_VERSION_DEFAULT sets the protocol version to the default version for the protocol.
|
||||
* %NM_SETTING_HSR_PROTOCOL_VERSION_HSR_2010 sets the protocol version to HSRv0 (IEC 62439-3:2010).
|
||||
* %NM_SETTING_HSR_PROTOCOL_VERSION_HSR_2012 sets the protocol version to HSRv1 (IEC 62439-3:2012).
|
||||
*
|
||||
* Since: 1.56, 1.54.2
|
||||
**/
|
||||
_nm_setting_property_define_direct_enum(properties_override,
|
||||
obj_properties,
|
||||
NM_SETTING_HSR_PROTOCOL_VERSION,
|
||||
PROP_PROTOCOL_VERSION,
|
||||
NM_TYPE_SETTING_HSR_PROTOCOL_VERSION,
|
||||
NM_SETTING_HSR_PROTOCOL_VERSION_DEFAULT,
|
||||
NM_SETTING_PARAM_NONE,
|
||||
NULL,
|
||||
NMSettingHsr,
|
||||
_priv.protocol_version);
|
||||
|
||||
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
|
||||
_nm_setting_class_commit(setting_class, NM_META_SETTING_TYPE_HSR, NULL, properties_override, 0);
|
||||
|
|
|
|||
|
|
@ -23,10 +23,27 @@ G_BEGIN_DECLS
|
|||
|
||||
#define NM_SETTING_HSR_SETTING_NAME "hsr"
|
||||
|
||||
#define NM_SETTING_HSR_PORT1 "port1"
|
||||
#define NM_SETTING_HSR_PORT2 "port2"
|
||||
#define NM_SETTING_HSR_MULTICAST_SPEC "multicast-spec"
|
||||
#define NM_SETTING_HSR_PRP "prp"
|
||||
#define NM_SETTING_HSR_PORT1 "port1"
|
||||
#define NM_SETTING_HSR_PORT2 "port2"
|
||||
#define NM_SETTING_HSR_MULTICAST_SPEC "multicast-spec"
|
||||
#define NM_SETTING_HSR_PRP "prp"
|
||||
#define NM_SETTING_HSR_PROTOCOL_VERSION "protocol-version"
|
||||
|
||||
/**
|
||||
* NMSettingHsrProtocolVersion:
|
||||
* @NM_SETTING_HSR_PROTOCOL_VERSION_DEFAULT: Default version for the protocol
|
||||
* @NM_SETTING_HSR_PROTOCOL_VERSION_HSR_2010: HSRv0, IEC 62439-3:2010
|
||||
* @NM_SETTING_HSR_PROTOCOL_VERSION_HSR_2012: HSRv1, IEC 62439-3:2012
|
||||
*
|
||||
* #NMSettingHsrProtocolVersion values indicate the HSR protocol version.
|
||||
*
|
||||
* Since: 1.56, 1.54.2
|
||||
*/
|
||||
typedef enum {
|
||||
NM_SETTING_HSR_PROTOCOL_VERSION_DEFAULT = -1,
|
||||
NM_SETTING_HSR_PROTOCOL_VERSION_HSR_2010 = 0,
|
||||
NM_SETTING_HSR_PROTOCOL_VERSION_HSR_2012 = 1,
|
||||
} NMSettingHsrProtocolVersion;
|
||||
|
||||
typedef struct _NMSettingHsrClass NMSettingHsrClass;
|
||||
|
||||
|
|
@ -43,6 +60,8 @@ NM_AVAILABLE_IN_1_46
|
|||
guint32 nm_setting_hsr_get_multicast_spec(NMSettingHsr *setting);
|
||||
NM_AVAILABLE_IN_1_46
|
||||
gboolean nm_setting_hsr_get_prp(NMSettingHsr *setting);
|
||||
NM_AVAILABLE_IN_1_54_2
|
||||
NMSettingHsrProtocolVersion nm_setting_hsr_get_protocol_version(NMSettingHsr *setting);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
|||
|
|
@ -6198,6 +6198,9 @@ static const NMMetaPropertyInfo *const property_infos_HSR[] = {
|
|||
PROPERTY_INFO_WITH_DESC (NM_SETTING_HSR_PRP,
|
||||
.property_type = &_pt_gobject_bool,
|
||||
),
|
||||
PROPERTY_INFO_WITH_DESC (NM_SETTING_HSR_PROTOCOL_VERSION,
|
||||
.property_type = &_pt_gobject_enum,
|
||||
),
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -174,6 +174,7 @@
|
|||
#define DESCRIBE_DOC_NM_SETTING_HSR_MULTICAST_SPEC N_("The last byte of supervision address.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_HSR_PORT1 N_("The port1 interface name of the HSR. This property is mandatory.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_HSR_PORT2 N_("The port2 interface name of the HSR. This property is mandatory.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_HSR_PROTOCOL_VERSION N_("Configures the protocol version to be used for the HSR/PRP interface. \"default\" (-1) sets the protocol version to the default version for the protocol. \"hsr-2010\" (0) sets the protocol version to HSRv0 (IEC 62439-3:2010). \"hsr-2012\" (1) sets the protocol version to HSRv1 (IEC 62439-3:2012).")
|
||||
#define DESCRIBE_DOC_NM_SETTING_HSR_PRP N_("The protocol used by the interface, whether it is PRP or HSR.")
|
||||
#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_MAC_ADDRESS N_("If specified, this connection will only apply to the IPoIB device whose permanent MAC address matches. This property does not change the MAC address of the device (i.e. MAC spoofing).")
|
||||
#define DESCRIBE_DOC_NM_SETTING_INFINIBAND_MTU N_("If non-zero, only transmit packets of the specified size or smaller, breaking larger packets up into multiple frames.")
|
||||
|
|
|
|||
|
|
@ -1235,6 +1235,10 @@
|
|||
nmcli-description="The protocol used by the interface, whether it is PRP or HSR."
|
||||
format="boolean"
|
||||
values="true/yes/on, false/no/off" />
|
||||
<property name="protocol-version"
|
||||
nmcli-description="Configures the protocol version to be used for the HSR/PRP interface. "default" (-1) sets the protocol version to the default version for the protocol. "hsr-2010" (0) sets the protocol version to HSRv0 (IEC 62439-3:2010). "hsr-2012" (1) sets the protocol version to HSRv1 (IEC 62439-3:2012)."
|
||||
format="choice (NMSettingHsrProtocolVersion)"
|
||||
values="default (-1), hsr-2010 (0), hsr-2012 (1)" />
|
||||
</setting>
|
||||
<setting name="infiniband" >
|
||||
<property name="mac-address"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue