74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering#pragma once
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering/***
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering This file is part of systemd.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Copyright 2014 Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering systemd is free software; you can redistribute it and/or modify it
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering under the terms of the GNU Lesser General Public License as published by
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering (at your option) any later version.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering systemd is distributed in the hope that it will be useful, but
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Lesser General Public License for more details.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering You should have received a copy of the GNU Lesser General Public License
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering***/
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering#include <net/if.h>
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering#include "in-addr-util.h"
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering#include "ratelimit.h"
af49ca27ffd790d78dbbb465b978266dfd5c93daLennart Poettering#include "resolve-util.h"
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringtypedef struct Link Link;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringtypedef struct LinkAddress LinkAddress;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering#include "resolved-dns-rr.h"
a51c10485af349eb15faa4d1a63b9818bcf3e589Lennart Poettering#include "resolved-dns-search-domain.h"
a51c10485af349eb15faa4d1a63b9818bcf3e589Lennart Poettering#include "resolved-dns-server.h"
39d8db043b599a7382f94bfc904d5e108af438bdLennart Poettering#include "resolved-manager.h"
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering#define LINK_SEARCH_DOMAINS_MAX 32
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering#define LINK_DNS_SERVERS_MAX 32
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringstruct LinkAddress {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Link *link;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
0dd25fb9f005d8ab7ac4bc10a609d00569f8c56aLennart Poettering int family;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering union in_addr_union in_addr;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering unsigned char flags, scope;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering DnsResourceRecord *llmnr_address_rr;
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering DnsResourceRecord *llmnr_ptr_rr;
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering LIST_FIELDS(LinkAddress, addresses);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering};
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringstruct Link {
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Manager *manager;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering int ifindex;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering unsigned flags;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering LIST_HEAD(LinkAddress, addresses);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
6073b6f26ab9fc6bf335faa7073ec443eef093fdTom Gundersen LIST_HEAD(DnsServer, dns_servers);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering DnsServer *current_dns_server;
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering unsigned n_dns_servers;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
a51c10485af349eb15faa4d1a63b9818bcf3e589Lennart Poettering LIST_HEAD(DnsSearchDomain, search_domains);
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering unsigned n_search_domains;
a51c10485af349eb15faa4d1a63b9818bcf3e589Lennart Poettering
af49ca27ffd790d78dbbb465b978266dfd5c93daLennart Poettering ResolveSupport llmnr_support;
af49ca27ffd790d78dbbb465b978266dfd5c93daLennart Poettering ResolveSupport mdns_support;
ad6c04756115809d615dede330213d73edf732a8Lennart Poettering DnssecMode dnssec_mode;
8a516214c4412e8a40544bd725a6d499a30cbbbfLennart Poettering Set *dnssec_negative_trust_anchors;
19b50b5ba7ee8c1bfb330377309e4bab7a7531d8Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering DnsScope *unicast_scope;
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering DnsScope *llmnr_ipv4_scope;
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering DnsScope *llmnr_ipv6_scope;
b4f1862df2e45aba90386887d685b8bf3c840e10Daniel Mack DnsScope *mdns_ipv4_scope;
b4f1862df2e45aba90386887d685b8bf3c840e10Daniel Mack DnsScope *mdns_ipv6_scope;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
97e5d693c04e50605d438af1c8a965fd2963bbe9Lennart Poettering bool is_managed;
97e5d693c04e50605d438af1c8a965fd2963bbe9Lennart Poettering
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering char name[IF_NAMESIZE];
e1c959948c0e31d6997bcdfbabfbd077784b2baeLennart Poettering uint32_t mtu;
6955a3ba9dc5d36487724878333a5745987e6656Lennart Poettering uint8_t operstate;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering};
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint link_new(Manager *m, Link **ret, int ifindex);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart PoetteringLink *link_free(Link *l);
1c4baffc1895809bae9ac36b670af90a4cb9cd7dTom Gundersenint link_update_rtnl(Link *l, sd_netlink_message *m);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringint link_update_monitor(Link *l);
011696f76233486bc56c266b18a328924f70269cLennart Poetteringbool link_relevant(Link *l, int family, bool local_multicast);
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart PoetteringLinkAddress* link_find_address(Link *l, int family, const union in_addr_union *in_addr);
ec2c5e4398f9d65e5dfe61530f2556224733d1e6Lennart Poetteringvoid link_add_rrs(Link *l, bool force_remove);
2c27fbca2d88214bd305272308a370a962818f1eLennart Poettering
97e5d693c04e50605d438af1c8a965fd2963bbe9Lennart Poetteringvoid link_flush_settings(Link *l);
97e5d693c04e50605d438af1c8a965fd2963bbe9Lennart Poetteringvoid link_set_dnssec_mode(Link *l, DnssecMode mode);
97e5d693c04e50605d438af1c8a965fd2963bbe9Lennart Poetteringvoid link_allocate_scopes(Link *l);
97e5d693c04e50605d438af1c8a965fd2963bbe9Lennart Poettering
2c27fbca2d88214bd305272308a370a962818f1eLennart PoetteringDnsServer* link_set_dns_server(Link *l, DnsServer *s);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart PoetteringDnsServer* link_get_dns_server(Link *l);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringvoid link_next_dns_server(Link *l);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
c69fa7e3c44240bedc0ee1bd89fecf954783ac85Lennart PoetteringDnssecMode link_get_dnssec_mode(Link *l);
c69fa7e3c44240bedc0ee1bd89fecf954783ac85Lennart Poetteringbool link_dnssec_supported(Link *l);
c69fa7e3c44240bedc0ee1bd89fecf954783ac85Lennart Poettering
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poetteringint link_address_new(Link *l, LinkAddress **ret, int family, const union in_addr_union *in_addr);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart PoetteringLinkAddress *link_address_free(LinkAddress *a);
1c4baffc1895809bae9ac36b670af90a4cb9cd7dTom Gundersenint link_address_update_rtnl(LinkAddress *a, sd_netlink_message *m);
011696f76233486bc56c266b18a328924f70269cLennart Poetteringbool link_address_relevant(LinkAddress *l, bool local_multicast);
ec2c5e4398f9d65e5dfe61530f2556224733d1e6Lennart Poetteringvoid link_address_add_rrs(LinkAddress *a, bool force_remove);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart PoetteringDEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_free);