1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3 
4 #include "conf-parser.h"
5 #include "time-util.h"
6 
7 typedef struct Link Link;
8 typedef struct Network Network;
9 
10 typedef enum IPv6AcceptRAStartDHCP6Client {
11         IPV6_ACCEPT_RA_START_DHCP6_CLIENT_NO,
12         IPV6_ACCEPT_RA_START_DHCP6_CLIENT_ALWAYS,
13         IPV6_ACCEPT_RA_START_DHCP6_CLIENT_YES,
14         _IPV6_ACCEPT_RA_START_DHCP6_CLIENT_MAX,
15         _IPV6_ACCEPT_RA_START_DHCP6_CLIENT_INVALID = -EINVAL,
16 } IPv6AcceptRAStartDHCP6Client;
17 
18 typedef struct NDiscRDNSS {
19         /* Used when GC'ing old DNS servers when configuration changes. */
20         bool marked;
21         struct in6_addr router;
22         /* This is an absolute point in time, and NOT a timespan/duration.
23          * Must be specified with clock_boottime_or_monotonic(). */
24         usec_t lifetime_usec;
25         struct in6_addr address;
26 } NDiscRDNSS;
27 
28 typedef struct NDiscDNSSL {
29         /* Used when GC'ing old domains when configuration changes. */
30         bool marked;
31         struct in6_addr router;
32         /* This is an absolute point in time, and NOT a timespan/duration.
33          * Must be specified with clock_boottime_or_monotonic(). */
34         usec_t lifetime_usec;
35         /* The domain name follows immediately. */
36 } NDiscDNSSL;
37 
NDISC_DNSSL_DOMAIN(const NDiscDNSSL * n)38 static inline char* NDISC_DNSSL_DOMAIN(const NDiscDNSSL *n) {
39         return ((char*) n) + ALIGN(sizeof(NDiscDNSSL));
40 }
41 
42 bool link_ipv6_accept_ra_enabled(Link *link);
43 
44 void network_adjust_ipv6_accept_ra(Network *network);
45 
46 int ndisc_start(Link *link);
47 void ndisc_vacuum(Link *link);
48 void ndisc_flush(Link *link);
49 
50 int link_request_ndisc(Link *link);
51 
52 CONFIG_PARSER_PROTOTYPE(config_parse_ipv6_accept_ra_start_dhcp6_client);
53 CONFIG_PARSER_PROTOTYPE(config_parse_ipv6_accept_ra_use_domains);
54