]>
Commit | Line | Data |
---|---|---|
74b2466e LP |
1 | #pragma once |
2 | ||
3 | /*** | |
4 | This file is part of systemd. | |
5 | ||
6 | Copyright 2014 Lennart Poettering | |
7 | ||
8 | systemd is free software; you can redistribute it and/or modify it | |
9 | under the terms of the GNU Lesser General Public License as published by | |
10 | the Free Software Foundation; either version 2.1 of the License, or | |
11 | (at your option) any later version. | |
12 | ||
13 | systemd is distributed in the hope that it will be useful, but | |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 | Lesser General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU Lesser General Public License | |
19 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
20 | ***/ | |
21 | ||
1716f6dc LP |
22 | #include <net/if.h> |
23 | ||
74b2466e LP |
24 | #include "in-addr-util.h" |
25 | #include "ratelimit.h" | |
af49ca27 | 26 | #include "resolve-util.h" |
74b2466e LP |
27 | |
28 | typedef struct Link Link; | |
29 | typedef struct LinkAddress LinkAddress; | |
30 | ||
623a4c97 | 31 | #include "resolved-dns-rr.h" |
a51c1048 LP |
32 | #include "resolved-dns-search-domain.h" |
33 | #include "resolved-dns-server.h" | |
39d8db04 | 34 | #include "resolved-manager.h" |
74b2466e | 35 | |
eed857b7 LP |
36 | #define LINK_SEARCH_DOMAINS_MAX 32 |
37 | #define LINK_DNS_SERVERS_MAX 32 | |
38 | ||
74b2466e LP |
39 | struct LinkAddress { |
40 | Link *link; | |
41 | ||
0dd25fb9 | 42 | int family; |
74b2466e LP |
43 | union in_addr_union in_addr; |
44 | ||
45 | unsigned char flags, scope; | |
46 | ||
623a4c97 LP |
47 | DnsResourceRecord *llmnr_address_rr; |
48 | DnsResourceRecord *llmnr_ptr_rr; | |
49 | ||
74b2466e LP |
50 | LIST_FIELDS(LinkAddress, addresses); |
51 | }; | |
52 | ||
53 | struct Link { | |
54 | Manager *manager; | |
55 | ||
56 | int ifindex; | |
57 | unsigned flags; | |
58 | ||
59 | LIST_HEAD(LinkAddress, addresses); | |
60 | ||
6073b6f2 | 61 | LIST_HEAD(DnsServer, dns_servers); |
74b2466e | 62 | DnsServer *current_dns_server; |
eed857b7 | 63 | unsigned n_dns_servers; |
74b2466e | 64 | |
a51c1048 | 65 | LIST_HEAD(DnsSearchDomain, search_domains); |
eed857b7 | 66 | unsigned n_search_domains; |
a51c1048 | 67 | |
af49ca27 LP |
68 | ResolveSupport llmnr_support; |
69 | ResolveSupport mdns_support; | |
ad6c0475 | 70 | DnssecMode dnssec_mode; |
8a516214 | 71 | Set *dnssec_negative_trust_anchors; |
19b50b5b | 72 | |
74b2466e | 73 | DnsScope *unicast_scope; |
1716f6dc LP |
74 | DnsScope *llmnr_ipv4_scope; |
75 | DnsScope *llmnr_ipv6_scope; | |
b4f1862d DM |
76 | DnsScope *mdns_ipv4_scope; |
77 | DnsScope *mdns_ipv6_scope; | |
74b2466e | 78 | |
97e5d693 LP |
79 | bool is_managed; |
80 | ||
1716f6dc | 81 | char name[IF_NAMESIZE]; |
e1c95994 | 82 | uint32_t mtu; |
6955a3ba | 83 | uint8_t operstate; |
943ef07c LP |
84 | |
85 | bool loaded; | |
86 | char *state_file; | |
74b2466e LP |
87 | }; |
88 | ||
89 | int link_new(Manager *m, Link **ret, int ifindex); | |
90 | Link *link_free(Link *l); | |
943ef07c LP |
91 | int link_process_rtnl(Link *l, sd_netlink_message *m); |
92 | int link_update(Link *l); | |
011696f7 | 93 | bool link_relevant(Link *l, int family, bool local_multicast); |
623a4c97 | 94 | LinkAddress* link_find_address(Link *l, int family, const union in_addr_union *in_addr); |
ec2c5e43 | 95 | void link_add_rrs(Link *l, bool force_remove); |
2c27fbca | 96 | |
97e5d693 LP |
97 | void link_flush_settings(Link *l); |
98 | void link_set_dnssec_mode(Link *l, DnssecMode mode); | |
99 | void link_allocate_scopes(Link *l); | |
100 | ||
2c27fbca | 101 | DnsServer* link_set_dns_server(Link *l, DnsServer *s); |
74b2466e LP |
102 | DnsServer* link_get_dns_server(Link *l); |
103 | void link_next_dns_server(Link *l); | |
104 | ||
c69fa7e3 LP |
105 | DnssecMode link_get_dnssec_mode(Link *l); |
106 | bool link_dnssec_supported(Link *l); | |
107 | ||
943ef07c LP |
108 | int link_save_user(Link *l); |
109 | int link_load_user(Link *l); | |
110 | void link_remove_user(Link *l); | |
111 | ||
623a4c97 | 112 | int link_address_new(Link *l, LinkAddress **ret, int family, const union in_addr_union *in_addr); |
74b2466e | 113 | LinkAddress *link_address_free(LinkAddress *a); |
1c4baffc | 114 | int link_address_update_rtnl(LinkAddress *a, sd_netlink_message *m); |
011696f7 | 115 | bool link_address_relevant(LinkAddress *l, bool local_multicast); |
ec2c5e43 | 116 | void link_address_add_rrs(LinkAddress *a, bool force_remove); |
74b2466e LP |
117 | |
118 | DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_free); |