ndisc: fix spurious DNS domains changed notification in clean_dns_domains()

clean_dns_domains() uses "i != 0" as the condition to set the changed
flag, but "i" is the total number of DNS domains (it equals
rdata->dns_domains->len after the loop). The correct condition is
"i != j", which is true only when some domains actually expired.
Without this fix, any cleanup cycle with at least one DNS domain
triggers a spurious NM_NDISC_CONFIG_DNS_DOMAINS change notification.

Fixes: 4c2035347e ('ndisc: track expiry of Router Advertisements in milliseconds')
This commit is contained in:
Beniamino Galvani 2026-05-22 14:36:10 +02:00
parent 60a1bd4e43
commit f5127d7b14

View file

@ -1695,7 +1695,7 @@ clean_dns_domains(NMNDisc *ndisc, gint64 now_msec, NMNDiscConfigMap *changed, gi
j++;
}
if (i != 0) {
if (i != j) {
*changed |= NM_NDISC_CONFIG_DNS_DOMAINS;
g_array_set_size(rdata->dns_domains, j);
}