diff options
author | Thomas Haller <thaller@redhat.com> | 2020-11-19 16:35:36 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-11-20 16:59:56 +0100 |
commit | 05f8ccc8179c821a83f0244127514ee3f679212d (patch) | |
tree | a8877e18e34d5eb53438c67ce483738c3c9a414c | |
parent | 5902f1c91f7c2dbc22a2798d7ff33fd451480454 (diff) | |
download | NetworkManager-05f8ccc8179c821a83f0244127514ee3f679212d.tar.gz |
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.
-rw-r--r-- | src/dns/nm-dns-manager.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/dns/nm-dns-manager.c b/src/dns/nm-dns-manager.c index 8a12d77871..1a6eec250b 100644 --- a/src/dns/nm-dns-manager.c +++ b/src/dns/nm-dns-manager.c @@ -1348,6 +1348,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) { @@ -1397,7 +1398,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); |