platform: drop unnecessary NMPlatformMptcpAddr.in_kernel flag

Since we don't get netlink notifications when the MPTCP endpoints
change, we don't cache them. And since we don't cache them,
there is less need to mark whether they were received from kernel
or created internally.
This commit is contained in:
Thomas Haller
2022-08-02 19:17:28 +02:00
parent e1c18e9ed2
commit 370147cf9d
2 changed files with 1 additions and 20 deletions

View File

@@ -7761,14 +7761,12 @@ nm_platform_mptcp_addr_to_string(const NMPlatformMptcpAddr *mptcp_addr, char *bu
g_snprintf(buf, g_snprintf(buf,
len, len,
"%s" /* in_kernel */
"%s" /* address */ "%s" /* address */
"%s" /* port */ "%s" /* port */
"%s" /* id */ "%s" /* id */
"%s" /* flags */ "%s" /* flags */
"%s" /* ifindex */ "%s" /* ifindex */
"", "",
mptcp_addr->in_kernel ? "" : "[nm] ",
str_addr, str_addr,
mptcp_addr->port == 0 ? "" : nm_sprintf_buf(str_port, " port %u", mptcp_addr->port), mptcp_addr->port == 0 ? "" : nm_sprintf_buf(str_port, " port %u", mptcp_addr->port),
mptcp_addr->id == 0 ? "" : nm_sprintf_buf(str_id, " id %u", mptcp_addr->id), mptcp_addr->id == 0 ? "" : nm_sprintf_buf(str_id, " id %u", mptcp_addr->id),
@@ -7785,13 +7783,7 @@ nm_platform_mptcp_addr_hash_update(const NMPlatformMptcpAddr *obj, NMHashState *
nm_assert(obj); nm_assert(obj);
nm_assert_addr_family_or_unspec(obj->addr_family); nm_assert_addr_family_or_unspec(obj->addr_family);
nm_hash_update_vals(h, nm_hash_update_vals(h, obj->id, obj->flags, obj->port, obj->addr_family, obj->ifindex);
obj->id,
obj->flags,
obj->port,
obj->addr_family,
(bool) obj->in_kernel,
obj->ifindex);
if (NM_IN_SET(obj->addr_family, AF_INET, AF_INET6)) if (NM_IN_SET(obj->addr_family, AF_INET, AF_INET6))
nm_hash_update(h, &obj->addr, nm_utils_addr_family_to_size(obj->addr_family)); nm_hash_update(h, &obj->addr, nm_utils_addr_family_to_size(obj->addr_family));
} }
@@ -7806,7 +7798,6 @@ nm_platform_mptcp_addr_cmp(const NMPlatformMptcpAddr *a, const NMPlatformMptcpAd
NM_CMP_FIELD(a, b, ifindex); NM_CMP_FIELD(a, b, ifindex);
NM_CMP_FIELD(a, b, id); NM_CMP_FIELD(a, b, id);
NM_CMP_FIELD_UNSAFE(a, b, in_kernel);
NM_CMP_FIELD(a, b, addr_family); NM_CMP_FIELD(a, b, addr_family);
if (NM_IN_SET(a->addr_family, AF_INET, AF_INET6)) if (NM_IN_SET(a->addr_family, AF_INET, AF_INET6))
NM_CMP_FIELD_MEMCMP_LEN(a, b, addr, nm_utils_addr_family_to_size(a->addr_family)); NM_CMP_FIELD_MEMCMP_LEN(a, b, addr, nm_utils_addr_family_to_size(a->addr_family));

View File

@@ -1098,21 +1098,11 @@ typedef void (*NMPlatformAsyncCallback)(GError *error, gpointer user_data);
typedef struct { typedef struct {
__NMPlatformObjWithIfindex_COMMON; __NMPlatformObjWithIfindex_COMMON;
guint32 id; guint32 id;
guint32 flags; guint32 flags;
guint16 port; guint16 port;
NMIPAddr addr; NMIPAddr addr;
gint8 addr_family; gint8 addr_family;
/* If TRUE, then the instance was received by kernel and is inside NMPlatform
* cache. In that case, the "id" is set and acts as primary key for the instance.
*
* If FALSE, this instance is not yet configured in kernel. In this case,
* the tuple (id, addr_family, addr) is the primary key of the instance.
* This way, we can track mptcp addresses in NetworkManager internally,
* before configuring them in kernel. */
bool in_kernel : 1;
} NMPlatformMptcpAddr; } NMPlatformMptcpAddr;
#undef __NMPlatformObjWithIfindex_COMMON #undef __NMPlatformObjWithIfindex_COMMON