1:255.16-alt1
[systemd_ALT.git] / src / resolve / resolved-link.h
blob0695a6ff838b9c0fcf5e0663efbc9398260baa31
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
4 #include <sys/stat.h>
6 #include "sd-netlink.h"
8 #include "in-addr-util.h"
9 #include "network-util.h"
10 #include "ratelimit.h"
11 #include "resolve-util.h"
13 typedef struct Link Link;
14 typedef struct LinkAddress LinkAddress;
16 #include "resolved-dns-rr.h"
17 #include "resolved-dns-scope.h"
18 #include "resolved-dns-search-domain.h"
19 #include "resolved-dns-server.h"
21 #define LINK_SEARCH_DOMAINS_MAX 256
22 #define LINK_DNS_SERVERS_MAX 256
24 struct LinkAddress {
25 Link *link;
27 int family;
28 union in_addr_union in_addr;
29 union in_addr_union in_addr_broadcast;
30 unsigned char prefixlen;
32 unsigned char flags, scope;
34 DnsResourceRecord *llmnr_address_rr;
35 DnsResourceRecord *llmnr_ptr_rr;
36 DnsResourceRecord *mdns_address_rr;
37 DnsResourceRecord *mdns_ptr_rr;
39 LIST_FIELDS(LinkAddress, addresses);
42 struct Link {
43 Manager *manager;
45 int ifindex;
46 unsigned flags;
48 LIST_HEAD(LinkAddress, addresses);
49 unsigned n_addresses;
51 LIST_HEAD(DnsServer, dns_servers);
52 DnsServer *current_dns_server;
53 unsigned n_dns_servers;
55 LIST_HEAD(DnsSearchDomain, search_domains);
56 unsigned n_search_domains;
58 int default_route;
60 ResolveSupport llmnr_support;
61 ResolveSupport mdns_support;
62 DnsOverTlsMode dns_over_tls_mode;
63 DnssecMode dnssec_mode;
64 Set *dnssec_negative_trust_anchors;
66 DnsScope *unicast_scope;
67 DnsScope *llmnr_ipv4_scope;
68 DnsScope *llmnr_ipv6_scope;
69 DnsScope *mdns_ipv4_scope;
70 DnsScope *mdns_ipv6_scope;
72 struct stat networkd_state_file_stat;
73 LinkOperationalState networkd_operstate;
74 bool is_managed;
76 char *ifname;
77 uint32_t mtu;
78 uint8_t operstate;
80 bool loaded;
81 char *state_file;
83 bool unicast_relevant;
86 int link_new(Manager *m, Link **ret, int ifindex);
87 Link *link_free(Link *l);
88 int link_process_rtnl(Link *l, sd_netlink_message *m);
89 int link_update(Link *l);
90 bool link_relevant(Link *l, int family, bool local_multicast);
91 LinkAddress* link_find_address(Link *l, int family, const union in_addr_union *in_addr);
92 void link_add_rrs(Link *l, bool force_remove);
94 void link_flush_settings(Link *l);
95 void link_set_dnssec_mode(Link *l, DnssecMode mode);
96 void link_set_dns_over_tls_mode(Link *l, DnsOverTlsMode mode);
97 void link_allocate_scopes(Link *l);
99 DnsServer* link_set_dns_server(Link *l, DnsServer *s);
100 DnsServer* link_get_dns_server(Link *l);
101 void link_next_dns_server(Link *l, DnsServer *if_current);
103 DnssecMode link_get_dnssec_mode(Link *l);
104 bool link_dnssec_supported(Link *l);
106 DnsOverTlsMode link_get_dns_over_tls_mode(Link *l);
108 ResolveSupport link_get_llmnr_support(Link *link);
109 ResolveSupport link_get_mdns_support(Link *link);
111 int link_save_user(Link *l);
112 int link_load_user(Link *l);
113 void link_remove_user(Link *l);
115 int link_address_new(Link *l,
116 LinkAddress **ret,
117 int family,
118 const union in_addr_union *in_addr,
119 const union in_addr_union *in_addr_broadcast);
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 bool link_negative_trust_anchor_lookup(Link *l, const char *name);
127 DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_free);