]>
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" |
07f264e4 | 32 | #include "resolved-dns-scope.h" |
a51c1048 LP |
33 | #include "resolved-dns-search-domain.h" |
34 | #include "resolved-dns-server.h" | |
39d8db04 | 35 | #include "resolved-manager.h" |
74b2466e | 36 | |
eed857b7 LP |
37 | #define LINK_SEARCH_DOMAINS_MAX 32 |
38 | #define LINK_DNS_SERVERS_MAX 32 | |
39 | ||
74b2466e LP |
40 | struct LinkAddress { |
41 | Link *link; | |
42 | ||
0dd25fb9 | 43 | int family; |
74b2466e LP |
44 | union in_addr_union in_addr; |
45 | ||
46 | unsigned char flags, scope; | |
47 | ||
623a4c97 LP |
48 | DnsResourceRecord *llmnr_address_rr; |
49 | DnsResourceRecord *llmnr_ptr_rr; | |
400cb36e DR |
50 | DnsResourceRecord *mdns_address_rr; |
51 | DnsResourceRecord *mdns_ptr_rr; | |
623a4c97 | 52 | |
74b2466e LP |
53 | LIST_FIELDS(LinkAddress, addresses); |
54 | }; | |
55 | ||
56 | struct Link { | |
57 | Manager *manager; | |
58 | ||
59 | int ifindex; | |
60 | unsigned flags; | |
61 | ||
62 | LIST_HEAD(LinkAddress, addresses); | |
bceaa99d | 63 | unsigned n_addresses; |
74b2466e | 64 | |
6073b6f2 | 65 | LIST_HEAD(DnsServer, dns_servers); |
74b2466e | 66 | DnsServer *current_dns_server; |
eed857b7 | 67 | unsigned n_dns_servers; |
74b2466e | 68 | |
a51c1048 | 69 | LIST_HEAD(DnsSearchDomain, search_domains); |
eed857b7 | 70 | unsigned n_search_domains; |
a51c1048 | 71 | |
af49ca27 LP |
72 | ResolveSupport llmnr_support; |
73 | ResolveSupport mdns_support; | |
ad6c0475 | 74 | DnssecMode dnssec_mode; |
8a516214 | 75 | Set *dnssec_negative_trust_anchors; |
19b50b5b | 76 | |
74b2466e | 77 | DnsScope *unicast_scope; |
1716f6dc LP |
78 | DnsScope *llmnr_ipv4_scope; |
79 | DnsScope *llmnr_ipv6_scope; | |
b4f1862d DM |
80 | DnsScope *mdns_ipv4_scope; |
81 | DnsScope *mdns_ipv6_scope; | |
74b2466e | 82 | |
97e5d693 LP |
83 | bool is_managed; |
84 | ||
1716f6dc | 85 | char name[IF_NAMESIZE]; |
e1c95994 | 86 | uint32_t mtu; |
6955a3ba | 87 | uint8_t operstate; |
943ef07c LP |
88 | |
89 | bool loaded; | |
90 | char *state_file; | |
59c0fd0e LP |
91 | |
92 | bool unicast_relevant; | |
74b2466e LP |
93 | }; |
94 | ||
95 | int link_new(Manager *m, Link **ret, int ifindex); | |
96 | Link *link_free(Link *l); | |
943ef07c LP |
97 | int link_process_rtnl(Link *l, sd_netlink_message *m); |
98 | int link_update(Link *l); | |
011696f7 | 99 | bool link_relevant(Link *l, int family, bool local_multicast); |
623a4c97 | 100 | LinkAddress* link_find_address(Link *l, int family, const union in_addr_union *in_addr); |
ec2c5e43 | 101 | void link_add_rrs(Link *l, bool force_remove); |
2c27fbca | 102 | |
97e5d693 LP |
103 | void link_flush_settings(Link *l); |
104 | void link_set_dnssec_mode(Link *l, DnssecMode mode); | |
105 | void link_allocate_scopes(Link *l); | |
106 | ||
2c27fbca | 107 | DnsServer* link_set_dns_server(Link *l, DnsServer *s); |
74b2466e LP |
108 | DnsServer* link_get_dns_server(Link *l); |
109 | void link_next_dns_server(Link *l); | |
110 | ||
c69fa7e3 LP |
111 | DnssecMode link_get_dnssec_mode(Link *l); |
112 | bool link_dnssec_supported(Link *l); | |
113 | ||
943ef07c LP |
114 | int link_save_user(Link *l); |
115 | int link_load_user(Link *l); | |
116 | void link_remove_user(Link *l); | |
117 | ||
623a4c97 | 118 | int link_address_new(Link *l, LinkAddress **ret, int family, const union in_addr_union *in_addr); |
74b2466e | 119 | LinkAddress *link_address_free(LinkAddress *a); |
1c4baffc | 120 | int link_address_update_rtnl(LinkAddress *a, sd_netlink_message *m); |
011696f7 | 121 | bool link_address_relevant(LinkAddress *l, bool local_multicast); |
ec2c5e43 | 122 | void link_address_add_rrs(LinkAddress *a, bool force_remove); |
74b2466e LP |
123 | |
124 | DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_free); |