mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 14:10:08 +01:00
platform: drop NMPlatformLnkMacvtap typedef
In several cases, the layer 2 and layer 3 type are very similar, also from
kernel's point of view. For example, "gre"/"gretap" and "ip6tnl"/"ip6gre"/"ip6gretap"
and "macvlan"/"macvtap".
While it makes sense that these have different NMLinkType types
(NM_LINK_TYPE_MACV{LAN,TAP}) and different NMPObject types
(NMPObjectLnkMacv{lan,tap}), it makes less sense that they have
different NMPlatformLnk* structs.
Remove the NMPlatformLnkMacvtap typedef. A typedef does not make things simpler,
but is rather confusing. Because several API that we would usually have, does
not exist for the typedef (e.g. there is no nm_platform_lnk_macvtap_to_string()).
Note that we also don't have such a typedef for NMPlatformLnkIp6Tnl
and NMPlatformLnkGre, which has the same ambiguity between the link type
and the struct with the data.
This commit is contained in:
parent
f30ae56608
commit
cb4093fc8f
4 changed files with 5 additions and 7 deletions
|
|
@ -2228,7 +2228,7 @@ nm_platform_link_get_lnk_macvlan (NMPlatform *self, int ifindex, const NMPlatfor
|
|||
return _link_get_lnk (self, ifindex, NM_LINK_TYPE_MACVLAN, out_link);
|
||||
}
|
||||
|
||||
const NMPlatformLnkMacvtap *
|
||||
const NMPlatformLnkMacvlan *
|
||||
nm_platform_link_get_lnk_macvtap (NMPlatform *self, int ifindex, const NMPlatformLink **out_link)
|
||||
{
|
||||
return _link_get_lnk (self, ifindex, NM_LINK_TYPE_MACVTAP, out_link);
|
||||
|
|
|
|||
|
|
@ -795,8 +795,6 @@ typedef struct {
|
|||
bool tap:1;
|
||||
} NMPlatformLnkMacvlan;
|
||||
|
||||
typedef NMPlatformLnkMacvlan NMPlatformLnkMacvtap;
|
||||
|
||||
typedef struct {
|
||||
in_addr_t local;
|
||||
in_addr_t remote;
|
||||
|
|
@ -1617,7 +1615,7 @@ const NMPlatformLnkInfiniband *nm_platform_link_get_lnk_infiniband (NMPlatform *
|
|||
const NMPlatformLnkIpIp *nm_platform_link_get_lnk_ipip (NMPlatform *self, int ifindex, const NMPlatformLink **out_link);
|
||||
const NMPlatformLnkMacsec *nm_platform_link_get_lnk_macsec (NMPlatform *self, int ifindex, const NMPlatformLink **out_link);
|
||||
const NMPlatformLnkMacvlan *nm_platform_link_get_lnk_macvlan (NMPlatform *self, int ifindex, const NMPlatformLink **out_link);
|
||||
const NMPlatformLnkMacvtap *nm_platform_link_get_lnk_macvtap (NMPlatform *self, int ifindex, const NMPlatformLink **out_link);
|
||||
const NMPlatformLnkMacvlan *nm_platform_link_get_lnk_macvtap (NMPlatform *self, int ifindex, const NMPlatformLink **out_link);
|
||||
const NMPlatformLnkSit *nm_platform_link_get_lnk_sit (NMPlatform *self, int ifindex, const NMPlatformLink **out_link);
|
||||
const NMPlatformLnkTun *nm_platform_link_get_lnk_tun (NMPlatform *self, int ifindex, const NMPlatformLink **out_link);
|
||||
const NMPlatformLnkVlan *nm_platform_link_get_lnk_vlan (NMPlatform *self, int ifindex, const NMPlatformLink **out_link);
|
||||
|
|
|
|||
|
|
@ -3291,7 +3291,7 @@ const NMPClass _nmp_classes[NMP_OBJECT_TYPE_MAX] = {
|
|||
.parent = DEDUP_MULTI_OBJ_CLASS_INIT(),
|
||||
.obj_type = NMP_OBJECT_TYPE_LNK_MACVTAP,
|
||||
.sizeof_data = sizeof (NMPObjectLnkMacvtap),
|
||||
.sizeof_public = sizeof (NMPlatformLnkMacvtap),
|
||||
.sizeof_public = sizeof (NMPlatformLnkMacvlan),
|
||||
.obj_type_name = "macvtap",
|
||||
.lnk_link_type = NM_LINK_TYPE_MACVTAP,
|
||||
.cmd_plobj_to_string = (const char *(*) (const NMPlatformObject *obj, char *buf, gsize len)) nm_platform_lnk_macvlan_to_string,
|
||||
|
|
|
|||
|
|
@ -1144,7 +1144,7 @@ test_software_detect (gconstpointer user_data)
|
|||
break;
|
||||
}
|
||||
case NM_LINK_TYPE_MACVTAP: {
|
||||
NMPlatformLnkMacvtap lnk_macvtap = { };
|
||||
NMPlatformLnkMacvlan lnk_macvtap = { };
|
||||
|
||||
lnk_macvtap.mode = MACVLAN_MODE_PRIVATE;
|
||||
lnk_macvtap.no_promisc = FALSE;
|
||||
|
|
@ -1389,7 +1389,7 @@ test_software_detect (gconstpointer user_data)
|
|||
break;
|
||||
}
|
||||
case NM_LINK_TYPE_MACVTAP: {
|
||||
const NMPlatformLnkMacvtap *plnk = &lnk->lnk_macvlan;
|
||||
const NMPlatformLnkMacvlan *plnk = &lnk->lnk_macvlan;
|
||||
|
||||
g_assert (plnk == nm_platform_link_get_lnk_macvtap (NM_PLATFORM_GET, ifindex, NULL));
|
||||
g_assert_cmpint (plnk->no_promisc, ==, FALSE);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue