diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-02-13 20:41:09 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2017-02-13 20:41:09 +0100 |
commit | bceaa99d49538fc24151abed9f9d40c950f626a2 (patch) | |
tree | 06bf32e09fd666b42a2fc55aba174ea2d0f75625 /src/resolve | |
parent | 4a46ed1bc69487a0f78ee35e32185ba146279312 (diff) | |
download | systemd-bceaa99d49538fc24151abed9f9d40c950f626a2.tar.gz |
resolved: count the number of addresses per link
This becomes handy later on. Moreover, we keep track of similar counters
for other objects like this too, hence adding this here too is obvious.
Diffstat (limited to 'src/resolve')
-rw-r--r-- | src/resolve/resolved-link.c | 4 | ||||
-rw-r--r-- | src/resolve/resolved-link.h | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/resolve/resolved-link.c b/src/resolve/resolved-link.c index 7b6e4f8398..44c0cd654f 100644 --- a/src/resolve/resolved-link.c +++ b/src/resolve/resolved-link.c @@ -669,6 +669,7 @@ int link_address_new(Link *l, LinkAddress **ret, int family, const union in_addr a->link = l; LIST_PREPEND(addresses, l->addresses, a); + l->n_addresses++; if (ret) *ret = a; @@ -683,6 +684,9 @@ LinkAddress *link_address_free(LinkAddress *a) { if (a->link) { LIST_REMOVE(addresses, a->link->addresses, a); + assert(a->link->n_addresses > 0); + a->link->n_addresses--; + if (a->llmnr_address_rr) { if (a->family == AF_INET && a->link->llmnr_ipv4_scope) dns_zone_remove_rr(&a->link->llmnr_ipv4_scope->zone, a->llmnr_address_rr); diff --git a/src/resolve/resolved-link.h b/src/resolve/resolved-link.h index 1e9be8ae84..55a56b7906 100644 --- a/src/resolve/resolved-link.h +++ b/src/resolve/resolved-link.h @@ -60,6 +60,7 @@ struct Link { unsigned flags; LIST_HEAD(LinkAddress, addresses); + unsigned n_addresses; LIST_HEAD(DnsServer, dns_servers); DnsServer *current_dns_server; |