diff --git a/src/libnm-client-impl/libnm.ver b/src/libnm-client-impl/libnm.ver
index ad05a4e29c..e49116f552 100644
--- a/src/libnm-client-impl/libnm.ver
+++ b/src/libnm-client-impl/libnm.ver
@@ -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;
diff --git a/src/libnm-core-impl/gen-metadata-nm-settings-libnm-core.xml.in b/src/libnm-core-impl/gen-metadata-nm-settings-libnm-core.xml.in
index c764f53568..058a7759c5 100644
--- a/src/libnm-core-impl/gen-metadata-nm-settings-libnm-core.xml.in
+++ b/src/libnm-core-impl/gen-metadata-nm-settings-libnm-core.xml.in
@@ -1528,6 +1528,10 @@
dbus-type="s"
gprop-type="gchararray"
/>
+
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);
diff --git a/src/libnm-core-public/nm-setting-hsr.h b/src/libnm-core-public/nm-setting-hsr.h
index f7b0136fd1..495d91af3d 100644
--- a/src/libnm-core-public/nm-setting-hsr.h
+++ b/src/libnm-core-public/nm-setting-hsr.h
@@ -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
diff --git a/src/libnmc-setting/nm-meta-setting-desc.c b/src/libnmc-setting/nm-meta-setting-desc.c
index aa290b9f10..34d16f5845 100644
--- a/src/libnmc-setting/nm-meta-setting-desc.c
+++ b/src/libnmc-setting/nm-meta-setting-desc.c
@@ -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
};
diff --git a/src/libnmc-setting/settings-docs.h.in b/src/libnmc-setting/settings-docs.h.in
index 56c7c29cd5..3490d5b0a7 100644
--- a/src/libnmc-setting/settings-docs.h.in
+++ b/src/libnmc-setting/settings-docs.h.in
@@ -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.")
diff --git a/src/nmcli/gen-metadata-nm-settings-nmcli.xml.in b/src/nmcli/gen-metadata-nm-settings-nmcli.xml.in
index 67b14d4c6e..545d9ba0fb 100644
--- a/src/nmcli/gen-metadata-nm-settings-nmcli.xml.in
+++ b/src/nmcli/gen-metadata-nm-settings-nmcli.xml.in
@@ -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" />
+