networkd: Add hashmap to store prefixes and associated link
Add a hashmap to the Manager struct that stores the association between an IPv6 prefix and the network Link it is assigned to. This is added in order to keep assigning the same prefixes with the same links even though they are delegated at different times or by different DHCPv6 clients.
This commit is contained in:
@@ -58,6 +58,7 @@ struct Manager {
|
||||
Hashmap *links;
|
||||
Hashmap *netdevs;
|
||||
Hashmap *networks_by_name;
|
||||
Hashmap *dhcp6_prefixes;
|
||||
LIST_HEAD(Network, networks);
|
||||
LIST_HEAD(AddressPool, address_pools);
|
||||
|
||||
@@ -109,5 +110,10 @@ Link* manager_find_uplink(Manager *m, Link *exclude);
|
||||
int manager_set_hostname(Manager *m, const char *hostname);
|
||||
int manager_set_timezone(Manager *m, const char *timezone);
|
||||
|
||||
Link *manager_dhcp6_prefix_get(Manager *m, struct in6_addr *addr);
|
||||
int manager_dhcp6_prefix_add(Manager *m, struct in6_addr *addr, Link *link);
|
||||
int manager_dhcp6_prefix_remove(Manager *m, struct in6_addr *addr);
|
||||
int manager_dhcp6_prefix_remove_all(Manager *m, Link *link);
|
||||
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free);
|
||||
#define _cleanup_manager_free_ _cleanup_(manager_freep)
|
||||
|
||||
Reference in New Issue
Block a user