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