1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 This file is part of systemd.
7 Copyright 2014 Lennart Poettering
9 systemd is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation; either version 2.1 of the License, or
12 (at your option) any later version.
14 systemd is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public License
20 along with systemd; If not, see <http://www.gnu.org/licenses/>.
25 #include "in-addr-util.h"
26 #include "ratelimit.h"
27 #include "resolve-util.h"
29 typedef struct Link Link
;
30 typedef struct LinkAddress LinkAddress
;
32 #include "resolved-dns-rr.h"
33 #include "resolved-dns-scope.h"
34 #include "resolved-dns-search-domain.h"
35 #include "resolved-dns-server.h"
36 #include "resolved-manager.h"
38 #define LINK_SEARCH_DOMAINS_MAX 32
39 #define LINK_DNS_SERVERS_MAX 32
45 union in_addr_union in_addr
;
47 unsigned char flags
, scope
;
49 DnsResourceRecord
*llmnr_address_rr
;
50 DnsResourceRecord
*llmnr_ptr_rr
;
51 DnsResourceRecord
*mdns_address_rr
;
52 DnsResourceRecord
*mdns_ptr_rr
;
54 LIST_FIELDS(LinkAddress
, addresses
);
63 LIST_HEAD(LinkAddress
, addresses
);
66 LIST_HEAD(DnsServer
, dns_servers
);
67 DnsServer
*current_dns_server
;
68 unsigned n_dns_servers
;
70 LIST_HEAD(DnsSearchDomain
, search_domains
);
71 unsigned n_search_domains
;
73 ResolveSupport llmnr_support
;
74 ResolveSupport mdns_support
;
75 DnssecMode dnssec_mode
;
76 Set
*dnssec_negative_trust_anchors
;
78 DnsScope
*unicast_scope
;
79 DnsScope
*llmnr_ipv4_scope
;
80 DnsScope
*llmnr_ipv6_scope
;
81 DnsScope
*mdns_ipv4_scope
;
82 DnsScope
*mdns_ipv6_scope
;
86 char name
[IF_NAMESIZE
];
93 bool unicast_relevant
;
96 int link_new(Manager
*m
, Link
**ret
, int ifindex
);
97 Link
*link_free(Link
*l
);
98 int link_process_rtnl(Link
*l
, sd_netlink_message
*m
);
99 int link_update(Link
*l
);
100 bool link_relevant(Link
*l
, int family
, bool local_multicast
);
101 LinkAddress
* link_find_address(Link
*l
, int family
, const union in_addr_union
*in_addr
);
102 void link_add_rrs(Link
*l
, bool force_remove
);
104 void link_flush_settings(Link
*l
);
105 void link_set_dnssec_mode(Link
*l
, DnssecMode mode
);
106 void link_allocate_scopes(Link
*l
);
108 DnsServer
* link_set_dns_server(Link
*l
, DnsServer
*s
);
109 DnsServer
* link_get_dns_server(Link
*l
);
110 void link_next_dns_server(Link
*l
);
112 DnssecMode
link_get_dnssec_mode(Link
*l
);
113 bool link_dnssec_supported(Link
*l
);
115 int link_save_user(Link
*l
);
116 int link_load_user(Link
*l
);
117 void link_remove_user(Link
*l
);
119 int link_address_new(Link
*l
, LinkAddress
**ret
, int family
, const union in_addr_union
*in_addr
);
120 LinkAddress
*link_address_free(LinkAddress
*a
);
121 int link_address_update_rtnl(LinkAddress
*a
, sd_netlink_message
*m
);
122 bool link_address_relevant(LinkAddress
*l
, bool local_multicast
);
123 void link_address_add_rrs(LinkAddress
*a
, bool force_remove
);
125 DEFINE_TRIVIAL_CLEANUP_FUNC(Link
*, link_free
);