summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-06-24 18:41:46 +0200
committerSven Eden <yamakuzure@gmx.net>2017-03-14 10:05:35 +0100
commit4201e24c816faa2ad7aad6ae06e9b8b69a84fdec (patch)
tree96101b266473d31be62113eeb954db543067217e /src
parent77d0a7c24d6024eb4db2e8a5808b66a0b6dbf7bb (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/shared/verbs.h49
1 files changed, 34 insertions, 15 deletions
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 <http://www.gnu.org/licenses/>.
***/
-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;