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