diff options
| author | Michael Biebl <biebl@debian.org> | 2025-11-17 17:43:34 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2025-11-17 17:43:34 +0100 |
| commit | 01609e485803fa250413385ae209660fb7b30a2e (patch) | |
| tree | 0992589c495fcaaea35f4a0452362326a4dbc3ba /src/libnm-core-impl | |
| parent | bc5f10851bffd6af1c2855635be7a28b6dba3195 (diff) | |
New upstream version 1.54.2 upstream/1.54.2
Diffstat (limited to 'src/libnm-core-impl')
| -rw-r--r-- | src/libnm-core-impl/gen-metadata-nm-settings-libnm-core.xml.in | 8 | ||||
| -rw-r--r-- | src/libnm-core-impl/nm-setting-hsr.c | 90 |
2 files changed, 97 insertions, 1 deletions
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 c764f535..ce4832dc 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 @@ -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" @@ -1528,6 +1532,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" diff --git a/src/libnm-core-impl/nm-setting-hsr.c b/src/libnm-core-impl/nm-setting-hsr.c index d9a662b1..1edf4a14 100644 --- a/src/libnm-core-impl/nm-setting-hsr.c +++ b/src/libnm-core-impl/nm-setting-hsr.c @@ -23,12 +23,20 @@ /*****************************************************************************/ -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, + PROP_INTERLINK, ); typedef struct { char *port1; char *port2; + char *interlink; guint32 multicast_spec; + int protocol_version; bool prp; } NMSettingHsrPrivate; @@ -117,6 +125,38 @@ 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; +} + +/** + * 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 @@ -160,6 +200,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 +312,42 @@ 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); + + /** + * 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); |