From: Tom Gundersen Date: Wed, 24 Jun 2015 16:41:46 +0000 (+0200) Subject: resolved: reference count the dns servers X-Git-Tag: v226.4~1^2~246 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=4201e24c816faa2ad7aad6ae06e9b8b69a84fdec resolved: reference count the dns servers We want to reference the servers from their active transactions, so make sure they stay around as long as the transaction does. --- diff --git a/src/shared/verbs.h b/src/shared/verbs.h index 068196622..03013beb8 100644 --- a/src/shared/verbs.h +++ b/src/shared/verbs.h @@ -6,7 +6,6 @@ This file is part of systemd. Copyright 2014 Lennart Poettering - Copyright 2014 Tom Gundersen systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -22,25 +21,45 @@ along with systemd; If not, see . ***/ -typedef struct Link Link; +#include "in-addr-util.h" -#include "networkd-wait-online.h" +typedef struct DnsServer DnsServer; +typedef enum DnsServerSource DnsServerSource; -struct Link { +typedef enum DnsServerType { + DNS_SERVER_SYSTEM, + DNS_SERVER_FALLBACK, + DNS_SERVER_LINK, +} DnsServerType; + +#include "resolved-link.h" + +struct DnsServer { Manager *manager; - int ifindex; - char *ifname; - unsigned flags; + unsigned n_ref; + + DnsServerType type; + + Link *link; - char *operational_state; - char *state; + int family; + union in_addr_union address; + + bool marked:1; + + LIST_FIELDS(DnsServer, servers); }; -int link_new(Manager *m, Link **ret, int ifindex, const char *ifname); -Link *link_free(Link *l); -int link_update_rtnl(Link *l, sd_netlink_message *m); -int link_update_monitor(Link *l); -bool link_relevant(Link *l); +int dns_server_new( + Manager *m, + DnsServer **s, + DnsServerType type, + Link *l, + int family, + const union in_addr_union *address); + +DnsServer* dns_server_ref(DnsServer *s); +DnsServer* dns_server_unref(DnsServer *s); -DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_free); +extern const struct hash_ops dns_server_hash_ops;