]>
Commit | Line | Data |
---|---|---|
db9ecf05 | 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
091214b6 PF |
2 | #pragma once |
3 | ||
4 | /*** | |
96b2fb93 | 5 | Copyright © 2017 Intel Corporation. All rights reserved. |
091214b6 PF |
6 | ***/ |
7 | ||
b5ce4047 YW |
8 | #include <inttypes.h> |
9 | #include <stdbool.h> | |
10 | ||
11 | #include "sd-radv.h" | |
12 | ||
13 | #include "in-addr-util.h" | |
a2106925 | 14 | #include "conf-parser.h" |
d11ba681 | 15 | #include "ndisc-option.h" |
fcbf4cb7 | 16 | #include "networkd-util.h" |
091214b6 | 17 | |
b5ce4047 | 18 | typedef struct Link Link; |
a254fab2 | 19 | typedef struct Network Network; |
6e849e95 | 20 | |
ca5ad760 | 21 | typedef enum RADVPrefixDelegation { |
61c0ef4f YW |
22 | RADV_PREFIX_DELEGATION_NONE = 0, |
23 | RADV_PREFIX_DELEGATION_STATIC = 1 << 0, | |
24 | RADV_PREFIX_DELEGATION_DHCP6 = 1 << 1, | |
25 | RADV_PREFIX_DELEGATION_BOTH = RADV_PREFIX_DELEGATION_STATIC | RADV_PREFIX_DELEGATION_DHCP6, | |
ca5ad760 | 26 | _RADV_PREFIX_DELEGATION_MAX, |
2d93c20e | 27 | _RADV_PREFIX_DELEGATION_INVALID = -EINVAL, |
ca5ad760 YW |
28 | } RADVPrefixDelegation; |
29 | ||
b5ce4047 | 30 | typedef struct Prefix { |
6e849e95 | 31 | Network *network; |
307fe3cd | 32 | ConfigSection *section; |
6e849e95 | 33 | |
d11ba681 | 34 | sd_ndisc_prefix prefix; |
2ac41679 | 35 | |
bd6379ec | 36 | bool assign; |
0e1fb1d0 | 37 | uint32_t route_metric; |
e609cd06 | 38 | Set *tokens; |
b5ce4047 | 39 | } Prefix; |
6e849e95 | 40 | |
b5ce4047 | 41 | typedef struct RoutePrefix { |
95081e08 | 42 | Network *network; |
307fe3cd | 43 | ConfigSection *section; |
95081e08 | 44 | |
d11ba681 | 45 | sd_ndisc_route route; |
b5ce4047 | 46 | } RoutePrefix; |
95081e08 | 47 | |
29d9672e | 48 | typedef struct Prefix64 { |
1925f829 SS |
49 | Network *network; |
50 | ConfigSection *section; | |
51 | ||
d11ba681 | 52 | sd_ndisc_prefix64 prefix64; |
29d9672e | 53 | } Prefix64; |
1925f829 | 54 | |
29d9672e YW |
55 | Prefix* prefix_free(Prefix *prefix); |
56 | RoutePrefix* route_prefix_free(RoutePrefix *prefix); | |
57 | Prefix64* prefix64_free(Prefix64 *prefix); | |
203d4df5 | 58 | |
69e0f833 | 59 | void network_adjust_radv(Network *network); |
1a7deb2f | 60 | |
3b6a3bde | 61 | int link_request_radv_addresses(Link *link); |
e14679ff | 62 | int link_reconfigure_radv_address(Address *address, Link *link); |
3b6a3bde | 63 | |
0f96a823 YW |
64 | bool link_radv_enabled(Link *link); |
65 | int radv_start(Link *link); | |
be9363cc | 66 | int radv_update_mac(Link *link); |
1633c457 | 67 | int radv_add_prefix(Link *link, const struct in6_addr *prefix, uint8_t prefix_len, |
16bc8635 | 68 | usec_t lifetime_preferred_usec, usec_t lifetime_valid_usec); |
ca5ad760 | 69 | |
a254fab2 YW |
70 | int link_request_radv(Link *link); |
71 | ||
ca5ad760 YW |
72 | const char* radv_prefix_delegation_to_string(RADVPrefixDelegation i) _const_; |
73 | RADVPrefixDelegation radv_prefix_delegation_from_string(const char *s) _pure_; | |
74 | ||
a2106925 | 75 | CONFIG_PARSER_PROTOTYPE(config_parse_router_prefix_delegation); |
4f1ac4a3 | 76 | CONFIG_PARSER_PROTOTYPE(config_parse_router_lifetime); |
59d475ba | 77 | CONFIG_PARSER_PROTOTYPE(config_parse_router_uint32_msec_usec); |
a2106925 LP |
78 | CONFIG_PARSER_PROTOTYPE(config_parse_router_preference); |
79 | CONFIG_PARSER_PROTOTYPE(config_parse_prefix); | |
2ac41679 | 80 | CONFIG_PARSER_PROTOTYPE(config_parse_prefix_boolean); |
a2106925 | 81 | CONFIG_PARSER_PROTOTYPE(config_parse_prefix_lifetime); |
0e1fb1d0 | 82 | CONFIG_PARSER_PROTOTYPE(config_parse_prefix_metric); |
e609cd06 | 83 | CONFIG_PARSER_PROTOTYPE(config_parse_prefix_token); |
ca5ad760 YW |
84 | CONFIG_PARSER_PROTOTYPE(config_parse_radv_dns); |
85 | CONFIG_PARSER_PROTOTYPE(config_parse_radv_search_domains); | |
203d4df5 SS |
86 | CONFIG_PARSER_PROTOTYPE(config_parse_route_prefix); |
87 | CONFIG_PARSER_PROTOTYPE(config_parse_route_prefix_lifetime); | |
1925f829 SS |
88 | CONFIG_PARSER_PROTOTYPE(config_parse_pref64_prefix); |
89 | CONFIG_PARSER_PROTOTYPE(config_parse_pref64_prefix_lifetime); | |
6a6d27bc | 90 | CONFIG_PARSER_PROTOTYPE(config_parse_router_home_agent_lifetime); |