Skip to content

[th/mptcp-reapply-fix] platform: fix tracking similar objects in NMPGlobalTracker

Thomas Haller requested to merge th/mptcp-reapply-fix into main

NMPGlobalTracker allows to track objects for independent users/callers. That is, callers that are not aware whether another caller tracks the same/similar object. It thus groups all objects by their nmp_object_id_equal() (as TrackData struct), while keeping a list of each individually tracked object (as TrackObjData struct which honors the object and the user-tag parameter).

When the same caller (by user-tag) tracks the same object again, then NMPGlobalTracker will only track it once and combine the objects. That is done by also having a dictionary for the TrackObjData entries, and it's generally more useful.

This latter dictionary lookup wrongly considered nmp_object_id_equal(). Instead, it needs to consider all minor differences of the objects, and use nmp_object_equal().

For example, for NMPlatformMptcpAddress, only the "address" is part of the ID. Other fields like the MPTCP flags are not. Imainge a profile is active with MPTCP endpoints configured with flags "subflow". During reapply, the user can only update the MPTCP flags (e.g. to "signal"). When that happens, the caller would track a new NMPlatformMptcpAddress instance, that only differs by MPTCP flags. In this case, we need to track the new address for the differences that it has according to nmp_object_equal(), and not nmp_object_id_equal().

For other supported types (routing rules and routes) this bug may have been harder to encounter, because most attributes of rules/routes are also part of the ID and because it's uncommon to reapply a minor change to a rule/route.

https://bugzilla.redhat.com/show_bug.cgi?id=2120471

Fixes: b8398b9e ('platform: add NMPRulesManager for syncing routing rules')

Merge request reports