]> git.proxmox.com Git - systemd.git/blame - src/resolve/resolved-link.h
Merge tag 'upstream/229'
[systemd.git] / src / resolve / resolved-link.h
CommitLineData
5eef597e
MP
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
22#include <net/if.h>
23
24#include "in-addr-util.h"
25#include "ratelimit.h"
4c89c718 26#include "resolve-util.h"
5eef597e
MP
27
28typedef struct Link Link;
29typedef struct LinkAddress LinkAddress;
30
5eef597e 31#include "resolved-dns-rr.h"
4c89c718
MP
32#include "resolved-dns-search-domain.h"
33#include "resolved-dns-server.h"
5eef597e
MP
34#include "resolved-manager.h"
35
4c89c718
MP
36#define LINK_SEARCH_DOMAINS_MAX 32
37#define LINK_DNS_SERVERS_MAX 32
38
5eef597e
MP
39struct LinkAddress {
40 Link *link;
41
42 int family;
43 union in_addr_union in_addr;
44
45 unsigned char flags, scope;
46
47 DnsResourceRecord *llmnr_address_rr;
48 DnsResourceRecord *llmnr_ptr_rr;
49
50 LIST_FIELDS(LinkAddress, addresses);
51};
52
53struct Link {
54 Manager *manager;
55
56 int ifindex;
57 unsigned flags;
58
59 LIST_HEAD(LinkAddress, addresses);
60
61 LIST_HEAD(DnsServer, dns_servers);
62 DnsServer *current_dns_server;
4c89c718
MP
63 unsigned n_dns_servers;
64
65 LIST_HEAD(DnsSearchDomain, search_domains);
66 unsigned n_search_domains;
5eef597e 67
4c89c718
MP
68 ResolveSupport llmnr_support;
69 ResolveSupport mdns_support;
70 DnssecMode dnssec_mode;
71 Set *dnssec_negative_trust_anchors;
5eef597e
MP
72
73 DnsScope *unicast_scope;
74 DnsScope *llmnr_ipv4_scope;
75 DnsScope *llmnr_ipv6_scope;
4c89c718
MP
76 DnsScope *mdns_ipv4_scope;
77 DnsScope *mdns_ipv6_scope;
78
79 bool is_managed;
5eef597e
MP
80
81 char name[IF_NAMESIZE];
82 uint32_t mtu;
4c89c718 83 uint8_t operstate;
5eef597e
MP
84};
85
86int link_new(Manager *m, Link **ret, int ifindex);
87Link *link_free(Link *l);
86f210e9 88int link_update_rtnl(Link *l, sd_netlink_message *m);
5eef597e 89int link_update_monitor(Link *l);
4c89c718 90bool link_relevant(Link *l, int family, bool local_multicast);
5eef597e
MP
91LinkAddress* link_find_address(Link *l, int family, const union in_addr_union *in_addr);
92void link_add_rrs(Link *l, bool force_remove);
93
4c89c718
MP
94void link_flush_settings(Link *l);
95void link_set_dnssec_mode(Link *l, DnssecMode mode);
96void link_allocate_scopes(Link *l);
97
5eef597e 98DnsServer* link_set_dns_server(Link *l, DnsServer *s);
5eef597e
MP
99DnsServer* link_get_dns_server(Link *l);
100void link_next_dns_server(Link *l);
101
4c89c718
MP
102DnssecMode link_get_dnssec_mode(Link *l);
103bool link_dnssec_supported(Link *l);
104
5eef597e
MP
105int link_address_new(Link *l, LinkAddress **ret, int family, const union in_addr_union *in_addr);
106LinkAddress *link_address_free(LinkAddress *a);
86f210e9 107int link_address_update_rtnl(LinkAddress *a, sd_netlink_message *m);
4c89c718 108bool link_address_relevant(LinkAddress *l, bool local_multicast);
5eef597e
MP
109void link_address_add_rrs(LinkAddress *a, bool force_remove);
110
111DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_free);