]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/network/networkd-radv.h
login: respect install_sysconfdir_samples in meson file
[thirdparty/systemd.git] / src / network / networkd-radv.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 /***
5 Copyright © 2017 Intel Corporation. All rights reserved.
6 ***/
7
8 #include <inttypes.h>
9 #include <stdbool.h>
10
11 #include "sd-radv.h"
12
13 #include "in-addr-util.h"
14 #include "conf-parser.h"
15 #include "networkd-util.h"
16
17 typedef struct Network Network;
18 typedef struct Link Link;
19
20 typedef enum RADVPrefixDelegation {
21 RADV_PREFIX_DELEGATION_NONE = 0,
22 RADV_PREFIX_DELEGATION_STATIC = 1 << 0,
23 RADV_PREFIX_DELEGATION_DHCP6 = 1 << 1,
24 RADV_PREFIX_DELEGATION_BOTH = RADV_PREFIX_DELEGATION_STATIC | RADV_PREFIX_DELEGATION_DHCP6,
25 _RADV_PREFIX_DELEGATION_MAX,
26 _RADV_PREFIX_DELEGATION_INVALID = -EINVAL,
27 } RADVPrefixDelegation;
28
29 typedef struct Prefix {
30 Network *network;
31 NetworkConfigSection *section;
32
33 sd_radv_prefix *radv_prefix;
34
35 bool assign;
36 uint32_t route_metric;
37 } Prefix;
38
39 typedef struct RoutePrefix {
40 Network *network;
41 NetworkConfigSection *section;
42
43 sd_radv_route_prefix *radv_route_prefix;
44 } RoutePrefix;
45
46 Prefix *prefix_free(Prefix *prefix);
47 RoutePrefix *route_prefix_free(RoutePrefix *prefix);
48
49 void network_drop_invalid_prefixes(Network *network);
50 void network_drop_invalid_route_prefixes(Network *network);
51 void network_adjust_radv(Network *network);
52
53 int radv_emit_dns(Link *link);
54 int radv_configure(Link *link);
55 int radv_update_mac(Link *link);
56 int radv_add_prefix(Link *link, const struct in6_addr *prefix, uint8_t prefix_len,
57 uint32_t lifetime_preferred, uint32_t lifetime_valid);
58
59 const char* radv_prefix_delegation_to_string(RADVPrefixDelegation i) _const_;
60 RADVPrefixDelegation radv_prefix_delegation_from_string(const char *s) _pure_;
61
62 CONFIG_PARSER_PROTOTYPE(config_parse_router_prefix_delegation);
63 CONFIG_PARSER_PROTOTYPE(config_parse_router_preference);
64 CONFIG_PARSER_PROTOTYPE(config_parse_prefix);
65 CONFIG_PARSER_PROTOTYPE(config_parse_prefix_flags);
66 CONFIG_PARSER_PROTOTYPE(config_parse_prefix_lifetime);
67 CONFIG_PARSER_PROTOTYPE(config_parse_prefix_assign);
68 CONFIG_PARSER_PROTOTYPE(config_parse_prefix_metric);
69 CONFIG_PARSER_PROTOTYPE(config_parse_radv_dns);
70 CONFIG_PARSER_PROTOTYPE(config_parse_radv_search_domains);
71 CONFIG_PARSER_PROTOTYPE(config_parse_route_prefix);
72 CONFIG_PARSER_PROTOTYPE(config_parse_route_prefix_lifetime);