For routes and routing rules, kernel uses a certain (not stictly defined) set of attributes to decide whether to routes/rules are identical.
That is a problem, as different kernel versions disagree on whether two routes/rules are the same (EEXIST) or not.
Note that when NetworkManager tries to add a rule with protocol set to anything but RTPROT_UNSPEC, then kernel will ignore the attribute if it doesn't have support for it. Meaning: the added rule will have a different protocol setting then intended.
Note that NMPRulesManager will add a rule if it doesn't find it in the platform cache so far. That means, when looking into the platform cache we must ignore or honor the protocol like kernel does.
This does not only affect FRA_PROTOCOL, but all attributes where kernel and NetworkManager disagrees. But the protocol is the most prominent one, because the rules tracked by nmp_rules_manager_track_default() specify the protocol.
ef4f8ccf6 platform: compare routing rules according to kernel support for FRA_PROTOCOL
src/platform/nm-platform.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)