From 50e04c6bc34bd899f10c430c522d19efee6cc36f Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 19 Nov 2020 16:35:36 +0100 Subject: [PATCH] dns: assert that priorities in rebuild_domain_lists() are increasing This is nm_assert(). The compiler should be able to completely eliminate this code in production. (cherry picked from commit 05f8ccc8179c821a83f0244127514ee3f679212d) (cherry picked from commit 0bfc2b6db9e59e1951072b753ee1e7182388dace) --- src/dns/nm-dns-manager.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dns/nm-dns-manager.c b/src/dns/nm-dns-manager.c index 4315cdc301..80ce750da8 100644 --- a/src/dns/nm-dns-manager.c +++ b/src/dns/nm-dns-manager.c @@ -1320,6 +1320,7 @@ rebuild_domain_lists (NMDnsManager *self) gs_unref_hashtable GHashTable *ht = NULL; gs_unref_hashtable GHashTable *wildcard_entries = NULL; CList *head; + int prev_priority = G_MININT; head = _ip_config_lst_head (self); c_list_for_each_entry (ip_data, head, ip_config_lst) { @@ -1369,7 +1370,10 @@ rebuild_domain_lists (NMDnsManager *self) n_domains = nm_ip_config_get_num_domains (ip_config); priority = nm_ip_config_get_dns_priority (ip_config); + nm_assert (priority != 0); + nm_assert (prev_priority <= priority); + prev_priority = priority; cap_dom = 2u + NM_MAX (n_domains, n_searches);