]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/resolve/resolved-link.h
Merge pull request #8417 from brauner/2018-03-09/add_bind_mount_fallback_to_private_d...
[thirdparty/systemd.git] / src / resolve / resolved-link.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5 This file is part of systemd.
6
7 Copyright 2014 Lennart Poettering
8 ***/
9
10 #include <net/if.h>
11
12 #include "in-addr-util.h"
13 #include "ratelimit.h"
14 #include "resolve-util.h"
15
16 typedef struct Link Link;
17 typedef struct LinkAddress LinkAddress;
18
19 #include "resolved-dns-rr.h"
20 #include "resolved-dns-scope.h"
21 #include "resolved-dns-search-domain.h"
22 #include "resolved-dns-server.h"
23 #include "resolved-manager.h"
24
25 #define LINK_SEARCH_DOMAINS_MAX 32
26 #define LINK_DNS_SERVERS_MAX 32
27
28 struct LinkAddress {
29 Link *link;
30
31 int family;
32 union in_addr_union in_addr;
33
34 unsigned char flags, scope;
35
36 DnsResourceRecord *llmnr_address_rr;
37 DnsResourceRecord *llmnr_ptr_rr;
38 DnsResourceRecord *mdns_address_rr;
39 DnsResourceRecord *mdns_ptr_rr;
40
41 LIST_FIELDS(LinkAddress, addresses);
42 };
43
44 struct Link {
45 Manager *manager;
46
47 int ifindex;
48 unsigned flags;
49
50 LIST_HEAD(LinkAddress, addresses);
51 unsigned n_addresses;
52
53 LIST_HEAD(DnsServer, dns_servers);
54 DnsServer *current_dns_server;
55 unsigned n_dns_servers;
56
57 LIST_HEAD(DnsSearchDomain, search_domains);
58 unsigned n_search_domains;
59
60 ResolveSupport llmnr_support;
61 ResolveSupport mdns_support;
62 DnssecMode dnssec_mode;
63 Set *dnssec_negative_trust_anchors;
64
65 DnsScope *unicast_scope;
66 DnsScope *llmnr_ipv4_scope;
67 DnsScope *llmnr_ipv6_scope;
68 DnsScope *mdns_ipv4_scope;
69 DnsScope *mdns_ipv6_scope;
70
71 bool is_managed;
72
73 char name[IF_NAMESIZE];
74 uint32_t mtu;
75 uint8_t operstate;
76
77 bool loaded;
78 char *state_file;
79
80 bool unicast_relevant;
81 };
82
83 int link_new(Manager *m, Link **ret, int ifindex);
84 Link *link_free(Link *l);
85 int link_process_rtnl(Link *l, sd_netlink_message *m);
86 int link_update(Link *l);
87 bool link_relevant(Link *l, int family, bool local_multicast);
88 LinkAddress* link_find_address(Link *l, int family, const union in_addr_union *in_addr);
89 void link_add_rrs(Link *l, bool force_remove);
90
91 void link_flush_settings(Link *l);
92 void link_set_dnssec_mode(Link *l, DnssecMode mode);
93 void link_allocate_scopes(Link *l);
94
95 DnsServer* link_set_dns_server(Link *l, DnsServer *s);
96 DnsServer* link_get_dns_server(Link *l);
97 void link_next_dns_server(Link *l);
98
99 DnssecMode link_get_dnssec_mode(Link *l);
100 bool link_dnssec_supported(Link *l);
101
102 int link_save_user(Link *l);
103 int link_load_user(Link *l);
104 void link_remove_user(Link *l);
105
106 int link_address_new(Link *l, LinkAddress **ret, int family, const union in_addr_union *in_addr);
107 LinkAddress *link_address_free(LinkAddress *a);
108 int link_address_update_rtnl(LinkAddress *a, sd_netlink_message *m);
109 bool link_address_relevant(LinkAddress *l, bool local_multicast);
110 void link_address_add_rrs(LinkAddress *a, bool force_remove);
111
112 DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_free);