hsr: drop supervision-address from HSR setting

The supervision address is read-only. It is constructed by kernel and
only the last byte can be modified by setting the multicast-spec as
documented indeed.

As 1.46 was not released yet, we still can drop the whole API for this
setting property. We are keeping the NMDeviceHsr property as it is a
nice to have for reading it.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1823

Fixes: 5426bdf4a1 ('HSR: add support to HSR/PRP interface')
This commit is contained in:
Fernando Fernandez Mancera 2023-12-19 08:17:48 +01:00
parent 9613b99ea8
commit 0e893593a9
10 changed files with 5 additions and 86 deletions

View file

@ -126,9 +126,6 @@ create_and_realize(NMDevice *device,
lnk.port1 = nm_platform_link_get_ifindex(NM_PLATFORM_GET, nm_setting_hsr_get_port1(s_hsr));
if (nm_setting_hsr_get_port2(s_hsr) != NULL)
lnk.port2 = nm_platform_link_get_ifindex(NM_PLATFORM_GET, nm_setting_hsr_get_port2(s_hsr));
if (nm_setting_hsr_get_supervision_address(s_hsr) != NULL)
nm_ether_addr_from_string(&lnk.supervision_address,
nm_setting_hsr_get_supervision_address(s_hsr));
lnk.multicast_spec = nm_setting_hsr_get_multicast_spec(s_hsr);
lnk.prp = nm_setting_hsr_get_prp(s_hsr);
r = nm_platform_link_hsr_add(nm_device_get_platform(device), iface, &lnk, out_plink);

View file

@ -1960,7 +1960,6 @@ global:
nm_setting_hsr_get_port1;
nm_setting_hsr_get_port2;
nm_setting_hsr_get_prp;
nm_setting_hsr_get_supervision_address;
nm_setting_hsr_get_type;
nm_setting_hsr_new;
} libnm_1_44_0;

View file

@ -1437,10 +1437,6 @@
dbus-type="b"
gprop-type="gboolean"
/>
<property name="supervision-address"
dbus-type="s"
gprop-type="gchararray"
/>
</setting>
<setting name="infiniband"
gtype="NMSettingInfiniband"

View file

@ -3044,10 +3044,6 @@ static const ParseInfoSetting *const parse_infos[_NM_META_SETTING_TYPE_NUM] = {
PARSE_INFO_PROPERTY(NM_SETTING_CONNECTION_TYPE,
.parser = setting_alias_parser,
.writer = setting_alias_writer, ), ), ),
PARSE_INFO_SETTING(
NM_META_SETTING_TYPE_HSR,
PARSE_INFO_PROPERTIES(PARSE_INFO_PROPERTY(NM_SETTING_HSR_SUPERVISION_ADDRESS,
.parser = mac_address_parser_ETHER, ), ), ),
PARSE_INFO_SETTING(
NM_META_SETTING_TYPE_INFINIBAND,
PARSE_INFO_PROPERTIES(PARSE_INFO_PROPERTY(NM_SETTING_INFINIBAND_MAC_ADDRESS,

View file

@ -23,17 +23,11 @@
/*****************************************************************************/
NM_GOBJECT_PROPERTIES_DEFINE(NMSettingHsr,
PROP_PORT1,
PROP_PORT2,
PROP_SUPERVISION_ADDRESS,
PROP_MULTICAST_SPEC,
PROP_PRP, );
NM_GOBJECT_PROPERTIES_DEFINE(NMSettingHsr, PROP_PORT1, PROP_PORT2, PROP_MULTICAST_SPEC, PROP_PRP, );
typedef struct {
char *port1;
char *port2;
char *supervision_address;
guint32 multicast_spec;
bool prp;
} NMSettingHsrPrivate;
@ -91,22 +85,6 @@ nm_setting_hsr_get_port2(NMSettingHsr *setting)
return NM_SETTING_HSR_GET_PRIVATE(setting)->port2;
}
/**
* nm_setting_hsr_get_supervision_address:
* @setting: the #NMSettingHsr
*
* Returns: the #NMSettingHsr:supervision_address property of the setting
*
* Since: 1.46
**/
const char *
nm_setting_hsr_get_supervision_address(NMSettingHsr *setting)
{
g_return_val_if_fail(NM_IS_SETTING_HSR(setting), NULL);
return NM_SETTING_HSR_GET_PRIVATE(setting)->supervision_address;
}
/**
* nm_setting_hsr_get_multicast_spec:
* @setting: the #NMSettingHsr
@ -182,19 +160,6 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
return FALSE;
}
if (priv->supervision_address && !nm_utils_hwaddr_valid(priv->supervision_address, ETH_ALEN)) {
g_set_error(error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
_("'%s' is not a valid MAC address"),
priv->supervision_address);
g_prefix_error(error,
"%s.%s: ",
NM_SETTING_HSR_SETTING_NAME,
NM_SETTING_HSR_SUPERVISION_ADDRESS);
return FALSE;
}
return TRUE;
}
@ -261,21 +226,6 @@ nm_setting_hsr_class_init(NMSettingHsrClass *klass)
NMSettingHsr,
_priv.port2);
/**
* NMSettingHsr:supervision-address:
*
* The supervision MAC address.
*
* Since: 1.46
**/
_nm_setting_property_define_direct_string(properties_override,
obj_properties,
NM_SETTING_HSR_SUPERVISION_ADDRESS,
PROP_SUPERVISION_ADDRESS,
NM_SETTING_PARAM_INFERRABLE,
NMSettingHsr,
_priv.supervision_address);
/**
* NMSettingHsr:multicast-spec:
*

View file

@ -23,11 +23,10 @@ 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_SUPERVISION_ADDRESS "supervision-address"
#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"
typedef struct _NMSettingHsrClass NMSettingHsrClass;
@ -41,8 +40,6 @@ const char *nm_setting_hsr_get_port1(NMSettingHsr *setting);
NM_AVAILABLE_IN_1_46
const char *nm_setting_hsr_get_port2(NMSettingHsr *setting);
NM_AVAILABLE_IN_1_46
const char *nm_setting_hsr_get_supervision_address(NMSettingHsr *setting);
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);

View file

@ -5075,11 +5075,6 @@ _nl_msg_new_link_set_linkinfo(struct nl_msg *msg, NMLinkType link_type, gconstpo
if (props->multicast_spec)
NLA_PUT_U8(msg, IFLA_HSR_MULTICAST_SPEC, props->multicast_spec);
if (!nm_ether_addr_is_zero(&props->supervision_address))
NLA_PUT(msg,
IFLA_HSR_SUPERVISION_ADDR,
sizeof(props->supervision_address),
&props->supervision_address);
NLA_PUT_U8(msg, IFLA_HSR_PROTOCOL, props->prp);
break;

View file

@ -6078,12 +6078,6 @@ static const NMMetaPropertyInfo *const property_infos_HSR[] = {
.prompt = N_("hsr port2"),
.property_type = &_pt_gobject_string,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_HSR_SUPERVISION_ADDRESS,
.is_cli_option = TRUE,
.property_alias = "supervision-address",
.prompt = N_("hsr supervision address"),
.property_type = &_pt_gobject_mac,
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_HSR_MULTICAST_SPEC,
.is_cli_option = TRUE,
.property_alias = "multicast-spec",

View file

@ -449,7 +449,6 @@
#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_PRP N_("The protocol used by the interface, whether it is PRP or HSR.")
#define DESCRIBE_DOC_NM_SETTING_HSR_SUPERVISION_ADDRESS N_("The supervision MAC address.")
#define DESCRIBE_DOC_NM_SETTING_LINK_GRO_MAX_SIZE N_("The maximum size of a packet built by the Generic Receive Offload stack for this device. The value must be between 0 and 4294967295. When set to -1, the existing value is preserved.")
#define DESCRIBE_DOC_NM_SETTING_LINK_GSO_MAX_SEGMENTS N_("The maximum segments of a Generic Segment Offload packet the device should accept. The value must be between 0 and 4294967295. When set to -1, the existing value is preserved.")
#define DESCRIBE_DOC_NM_SETTING_LINK_GSO_MAX_SIZE N_("The maximum size of a Generic Segment Offload packet the device should accept. The value must be between 0 and 4294967295. When set to -1, the existing value is preserved.")

View file

@ -1144,10 +1144,6 @@
alias="port2"
nmcli-description="The port2 interface name of the HSR. This property is mandatory."
format="string" />
<property name="supervision-address"
alias="supervision-address"
nmcli-description="The supervision MAC address."
format="MAC address" />
<property name="multicast-spec"
alias="multicast-spec"
nmcli-description="The last byte of supervision address."