l3cfg: add the DNS routing rules explicitly

Add the DNS routing rules explicitly instead of tracking them via the
NMGlobalTracker mechanism. Since we do not plan to ever remove them,
there is no reason to track the rules. Also, the current
implementation is buggy because in some situations the rules are
wrongly removed when they should not.

Fixes: bf3ecd9031 ('l3cfg: fix DNS routes')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2125
This commit is contained in:
Beniamino Galvani
2025-01-29 21:25:48 +01:00
parent f70791fb1f
commit 05efd5ab62

View File

@@ -4079,10 +4079,7 @@ _l3cfg_routed_dns_apply(NML3Cfg *self, const NML3ConfigData *l3cd)
NMP_CACHE_ID_TYPE_OBJECT_TYPE,
&rule_obj)) {
_LOGT("adding rule to DNS routing table");
nmp_global_tracker_track_rule(self->priv.global_tracker, &rule, 10, self, NULL);
nmp_global_tracker_sync(self->priv.global_tracker,
NMP_OBJECT_TYPE_ROUTING_RULE,
TRUE);
nm_platform_routing_rule_add(self->priv.platform, NMP_NLM_FLAG_ADD, &rule);
}
}