libnm: introduce hsr.interlink property

This property allows the user to optionally configure
an interlink name on a HSR interface, so that it could
serve as RedBox (Redundant Box) by connecting DAN (dual
attachment node) to SAN (single attachment node).

(cherry picked from commit 69d0fb161e)
This commit is contained in:
Jan Vaclav 2025-09-16 17:40:16 +02:00 committed by Íñigo Huguet
parent cd3d492618
commit dba8ba8e6f
7 changed files with 49 additions and 1 deletions

View file

@ -2079,6 +2079,7 @@ global:
libnm_1_54_2 {
global:
nm_setting_hsr_get_interlink;
nm_setting_hsr_get_protocol_version;
nm_setting_hsr_protocol_version_get_type;
} libnm_1_54_0;

View file

@ -1516,6 +1516,10 @@
<setting name="hsr"
gtype="NMSettingHsr"
>
<property name="interlink"
dbus-type="s"
gprop-type="gchararray"
/>
<property name="multicast-spec"
dbus-type="u"
gprop-type="guint"

View file

@ -28,11 +28,13 @@ NM_GOBJECT_PROPERTIES_DEFINE(NMSettingHsr,
PROP_PORT2,
PROP_MULTICAST_SPEC,
PROP_PRP,
PROP_PROTOCOL_VERSION, );
PROP_PROTOCOL_VERSION,
PROP_INTERLINK, );
typedef struct {
char *port1;
char *port2;
char *interlink;
guint32 multicast_spec;
int protocol_version;
bool prp;
@ -139,6 +141,22 @@ nm_setting_hsr_get_protocol_version(NMSettingHsr *setting)
return NM_SETTING_HSR_GET_PRIVATE(setting)->protocol_version;
}
/**
* nm_setting_hsr_get_interlink:
* @setting: the #NMSettingHsr
*
* Returns: the #NMSettingHsr:interlink property of the setting
*
* Since: 1.56, 1.54.2
**/
const char *
nm_setting_hsr_get_interlink(NMSettingHsr *setting)
{
g_return_val_if_fail(NM_IS_SETTING_HSR(setting), NULL);
return NM_SETTING_HSR_GET_PRIVATE(setting)->interlink;
}
/*****************************************************************************/
static gboolean
@ -315,6 +333,21 @@ nm_setting_hsr_class_init(NMSettingHsrClass *klass)
NMSettingHsr,
_priv.protocol_version);
/**
* NMSettingHsr:interlink:
*
* The optional interlink port name of the HSR interface.
*
* Since: 1.56, 1.54.2
**/
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_HSR_INTERLINK,
PROP_INTERLINK,
NM_SETTING_PARAM_INFERRABLE,
NMSettingHsr,
_priv.interlink);
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);

View file

@ -28,6 +28,7 @@ G_BEGIN_DECLS
#define NM_SETTING_HSR_MULTICAST_SPEC "multicast-spec"
#define NM_SETTING_HSR_PRP "prp"
#define NM_SETTING_HSR_PROTOCOL_VERSION "protocol-version"
#define NM_SETTING_HSR_INTERLINK "interlink"
/**
* NMSettingHsrProtocolVersion:
@ -62,6 +63,8 @@ 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);
NM_AVAILABLE_IN_1_54_2
const char *nm_setting_hsr_get_interlink(NMSettingHsr *setting);
G_END_DECLS

View file

@ -6201,6 +6201,9 @@ static const NMMetaPropertyInfo *const property_infos_HSR[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_HSR_PROTOCOL_VERSION,
.property_type = &_pt_gobject_enum,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_HSR_INTERLINK,
.property_type = &_pt_gobject_string,
),
NULL
};

View file

@ -171,6 +171,7 @@
#define DESCRIBE_DOC_NM_SETTING_GSM_SIM_ID N_("The SIM card unique identifier (as given by the WWAN management service) which this connection applies to. If given, the connection will apply to any device also allowed by \"device-id\" which contains a SIM card matching the given identifier.")
#define DESCRIBE_DOC_NM_SETTING_GSM_SIM_OPERATOR_ID N_("A MCC/MNC string like \"310260\" or \"21601\" identifying the specific mobile network operator which this connection applies to. If given, the connection will apply to any device also allowed by \"device-id\" and \"sim-id\" which contains a SIM card provisioned by the given operator.")
#define DESCRIBE_DOC_NM_SETTING_GSM_USERNAME N_("The username used to authenticate with the network, if required. Many providers do not require a username, or accept any username. But if a username is required, it is specified here.")
#define DESCRIBE_DOC_NM_SETTING_HSR_INTERLINK N_("The optional interlink port name of the HSR interface.")
#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.")

View file

@ -1239,6 +1239,9 @@
nmcli-description="Configures the protocol version to be used for the HSR/PRP interface. &quot;default&quot; (-1) sets the protocol version to the default version for the protocol. &quot;hsr-2010&quot; (0) sets the protocol version to HSRv0 (IEC 62439-3:2010). &quot;hsr-2012&quot; (1) sets the protocol version to HSRv1 (IEC 62439-3:2012)."
format="choice (NMSettingHsrProtocolVersion)"
values="default (-1), hsr-2010 (0), hsr-2012 (1)" />
<property name="interlink"
nmcli-description="The optional interlink port name of the HSR interface."
format="string" />
</setting>
<setting name="infiniband" >
<property name="mac-address"