1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3 
4 #include <errno.h>
5 #include <linux/if_link.h>
6 #include <stdbool.h>
7 
8 #include "sd-netlink.h"
9 
10 #include "conf-parser.h"
11 #include "macro.h"
12 
13 typedef struct Link Link;
14 
15 typedef enum IPv6LinkLocalAddressGenMode {
16        IPV6_LINK_LOCAL_ADDRESSS_GEN_MODE_EUI64          = IN6_ADDR_GEN_MODE_EUI64,
17        IPV6_LINK_LOCAL_ADDRESSS_GEN_MODE_NONE           = IN6_ADDR_GEN_MODE_NONE,
18        IPV6_LINK_LOCAL_ADDRESSS_GEN_MODE_STABLE_PRIVACY = IN6_ADDR_GEN_MODE_STABLE_PRIVACY,
19        IPV6_LINK_LOCAL_ADDRESSS_GEN_MODE_RANDOM         = IN6_ADDR_GEN_MODE_RANDOM,
20        _IPV6_LINK_LOCAL_ADDRESS_GEN_MODE_MAX,
21        _IPV6_LINK_LOCAL_ADDRESS_GEN_MODE_INVALID        = -EINVAL,
22 } IPv6LinkLocalAddressGenMode;
23 
24 bool link_ipv6ll_enabled(Link *link);
25 bool link_may_have_ipv6ll(Link *link);
26 
27 IPv6LinkLocalAddressGenMode link_get_ipv6ll_addrgen_mode(Link *link);
28 int ipv6ll_addrgen_mode_fill_message(sd_netlink_message *message, IPv6LinkLocalAddressGenMode mode);
29 int link_update_ipv6ll_addrgen_mode(Link *link, sd_netlink_message *message);
30 
31 int link_set_ipv6ll_stable_secret(Link *link);
32 int link_set_ipv6ll_addrgen_mode(Link *link, IPv6LinkLocalAddressGenMode mode);
33 
34 const char* ipv6_link_local_address_gen_mode_to_string(IPv6LinkLocalAddressGenMode s) _const_;
35 IPv6LinkLocalAddressGenMode ipv6_link_local_address_gen_mode_from_string(const char *s) _pure_;
36 
37 CONFIG_PARSER_PROTOTYPE(config_parse_ipv6_link_local_address_gen_mode);
38