merge: branch 'ff/fix_ipvlan_setting'

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2039
This commit is contained in:
Fernando Fernandez Mancera
2024-09-24 08:52:59 +02:00
2 changed files with 34 additions and 8 deletions

View File

@@ -20,10 +20,15 @@ NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_PORT1,
PROP_MULTICAST_SPEC, PROP_MULTICAST_SPEC,
PROP_PRP, ); PROP_PRP, );
enum {
PROPERTY_O_IDX_PORT1,
PROPERTY_O_IDX_PORT2,
_PROPERTY_O_IDX_NUM,
};
typedef struct { typedef struct {
char *supervision_address; char *supervision_address;
NMLDBusPropertyO port1; NMLDBusPropertyO property_o[_PROPERTY_O_IDX_NUM];
NMLDBusPropertyO port2;
guint8 multicast_spec; guint8 multicast_spec;
bool prp; bool prp;
} NMDeviceHsrPrivate; } NMDeviceHsrPrivate;
@@ -57,7 +62,8 @@ nm_device_hsr_get_port1(NMDeviceHsr *device)
{ {
g_return_val_if_fail(NM_IS_DEVICE_HSR(device), NULL); g_return_val_if_fail(NM_IS_DEVICE_HSR(device), NULL);
return nml_dbus_property_o_get_obj(&NM_DEVICE_HSR_GET_PRIVATE(device)->port1); return nml_dbus_property_o_get_obj(
&NM_DEVICE_HSR_GET_PRIVATE(device)->property_o[PROPERTY_O_IDX_PORT1]);
} }
/** /**
@@ -73,7 +79,8 @@ nm_device_hsr_get_port2(NMDeviceHsr *device)
{ {
g_return_val_if_fail(NM_IS_DEVICE_HSR(device), NULL); g_return_val_if_fail(NM_IS_DEVICE_HSR(device), NULL);
return nml_dbus_property_o_get_obj(&NM_DEVICE_HSR_GET_PRIVATE(device)->port2); return nml_dbus_property_o_get_obj(
&NM_DEVICE_HSR_GET_PRIVATE(device)->property_o[PROPERTY_O_IDX_PORT2]);
} }
/** /**
@@ -179,12 +186,12 @@ const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_hsr = NML_DBUS_META_IFACE_
NML_DBUS_META_PROPERTY_INIT_O_PROP("Port1", NML_DBUS_META_PROPERTY_INIT_O_PROP("Port1",
PROP_PORT1, PROP_PORT1,
NMDeviceHsr, NMDeviceHsr,
_priv.port1, _priv.property_o[PROPERTY_O_IDX_PORT1],
nm_device_get_type), nm_device_get_type),
NML_DBUS_META_PROPERTY_INIT_O_PROP("Port2", NML_DBUS_META_PROPERTY_INIT_O_PROP("Port2",
PROP_PORT2, PROP_PORT2,
NMDeviceHsr, NMDeviceHsr,
_priv.port2, _priv.property_o[PROPERTY_O_IDX_PORT2],
nm_device_get_type), nm_device_get_type),
NML_DBUS_META_PROPERTY_INIT_B("Prp", PROP_PRP, NMDeviceHsr, _priv.prp), NML_DBUS_META_PROPERTY_INIT_B("Prp", PROP_PRP, NMDeviceHsr, _priv.prp),
NML_DBUS_META_PROPERTY_INIT_S("SupervisionAddress", NML_DBUS_META_PROPERTY_INIT_S("SupervisionAddress",
@@ -203,8 +210,7 @@ nm_device_hsr_class_init(NMDeviceHsrClass *klass)
_NM_OBJECT_CLASS_INIT_PRIV_PTR_DIRECT(nm_object_class, NMDeviceHsr); _NM_OBJECT_CLASS_INIT_PRIV_PTR_DIRECT(nm_object_class, NMDeviceHsr);
_NM_OBJECT_CLASS_INIT_PROPERTY_O_FIELDS_1(nm_object_class, NMDeviceHsrPrivate, port1); _NM_OBJECT_CLASS_INIT_PROPERTY_O_FIELDS_N(nm_object_class, NMDeviceHsrPrivate, property_o);
_NM_OBJECT_CLASS_INIT_PROPERTY_O_FIELDS_1(nm_object_class, NMDeviceHsrPrivate, port2);
/** /**
* NMDeviceHsr:port1: * NMDeviceHsr:port1:

View File

@@ -2690,8 +2690,10 @@ test_types(void)
G(nm_device_ethernet_get_type), G(nm_device_ethernet_get_type),
G(nm_device_generic_get_type), G(nm_device_generic_get_type),
G(nm_device_get_type), G(nm_device_get_type),
G(nm_device_hsr_get_type),
G(nm_device_infiniband_get_type), G(nm_device_infiniband_get_type),
G(nm_device_ip_tunnel_get_type), G(nm_device_ip_tunnel_get_type),
G(nm_device_ipvlan_get_type),
G(nm_device_macsec_get_type), G(nm_device_macsec_get_type),
G(nm_device_macvlan_get_type), G(nm_device_macvlan_get_type),
G(nm_device_modem_capabilities_get_type), G(nm_device_modem_capabilities_get_type),
@@ -2762,6 +2764,7 @@ test_types(void)
G(nm_setting_generic_get_type), G(nm_setting_generic_get_type),
G(nm_setting_get_type), G(nm_setting_get_type),
G(nm_setting_gsm_get_type), G(nm_setting_gsm_get_type),
G(nm_setting_hsr_get_type),
G(nm_setting_infiniband_get_type), G(nm_setting_infiniband_get_type),
G(nm_setting_ip4_config_get_type), G(nm_setting_ip4_config_get_type),
G(nm_setting_ip6_config_addr_gen_mode_get_type), G(nm_setting_ip6_config_addr_gen_mode_get_type),
@@ -2769,6 +2772,8 @@ test_types(void)
G(nm_setting_ip6_config_privacy_get_type), G(nm_setting_ip6_config_privacy_get_type),
G(nm_setting_ip_config_get_type), G(nm_setting_ip_config_get_type),
G(nm_setting_ip_tunnel_get_type), G(nm_setting_ip_tunnel_get_type),
G(nm_setting_ipvlan_get_type),
G(nm_setting_ipvlan_mode_get_type),
G(nm_setting_mac_randomization_get_type), G(nm_setting_mac_randomization_get_type),
G(nm_setting_macsec_get_type), G(nm_setting_macsec_get_type),
G(nm_setting_macsec_mode_get_type), G(nm_setting_macsec_mode_get_type),
@@ -2999,8 +3004,13 @@ test_nml_dbus_meta(void)
g_assert(NM_IS_OBJECT_CLASS(p->klass)); g_assert(NM_IS_OBJECT_CLASS(p->klass));
g_assert(g_type_is_a(gtype, G_TYPE_FROM_CLASS(p->klass))); g_assert(g_type_is_a(gtype, G_TYPE_FROM_CLASS(p->klass)));
if (ii == 0) if (ii == 0)
/* If there is more than one NMLDBusPropertyO needed in the struct
* associated to the DBus object, they must be all in the same struct field
* as an array. This is later used on nm-object.c to perform operations on
* all the object properties at once. */
g_assert(p->klass->property_o_info == p); g_assert(p->klass->property_o_info == p);
else else
/* Same check than above if branch but for NMLDBusPropertyAO. */
g_assert(p->klass->property_ao_info == p); g_assert(p->klass->property_ao_info == p);
g_assert_cmpint(p->klass->priv_ptr_offset, >, 0); g_assert_cmpint(p->klass->priv_ptr_offset, >, 0);
if (p_prev) { if (p_prev) {
@@ -3383,6 +3393,11 @@ test_dbus_meta_types(void)
NM_TYPE_DEVICE_GENERIC, NM_TYPE_DEVICE_GENERIC,
NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_30, NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_30,
}, },
{
NM_DBUS_INTERFACE_DEVICE_HSR,
NM_TYPE_DEVICE_HSR,
NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_30,
},
{ {
NM_DBUS_INTERFACE_DEVICE_INFINIBAND, NM_DBUS_INTERFACE_DEVICE_INFINIBAND,
NM_TYPE_DEVICE_INFINIBAND, NM_TYPE_DEVICE_INFINIBAND,
@@ -3393,6 +3408,11 @@ test_dbus_meta_types(void)
NM_TYPE_DEVICE_IP_TUNNEL, NM_TYPE_DEVICE_IP_TUNNEL,
NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_30, NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_30,
}, },
{
NM_DBUS_INTERFACE_DEVICE_IPVLAN,
NM_TYPE_DEVICE_IPVLAN,
NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_30,
},
{ {
NM_DBUS_INTERFACE_DEVICE_MACSEC, NM_DBUS_INTERFACE_DEVICE_MACSEC,
NM_TYPE_DEVICE_MACSEC, NM_TYPE_DEVICE_MACSEC,