Commit Graph
28 Commits
Author SHA1 Message Date
Yu Watanabe e14679ff76 network/address-generation: regenerate IPv6 prefix stable address on conflict
If a generated address with IPv6Token=prefixstable conflicts with the
one on another node or interface, let's generate another address and try
to assign it.

This improves support of RFC 7217.

Fixes #31605.
2024-04-10 04:36:03 +09:00
Yu Watanabe 0ac03e004c network/address-generation: make generate_stable_private_address() optionally take the previously generated address
Currently, the argument is not used yet. The new argument will be used later
for regenerating prefix stable address on conflict.
2024-04-09 12:06:32 +09:00
Yu Watanabe e700e48257 network/address-generation: also provide used tokens when generating address
Then, assign the token to the corresponding Address object.
2024-04-09 12:06:32 +09:00
Yu Watanabe ffafb56125 network/address-generation: expose IPv6Token and introduce new/ref/unref functions for the type
No functional change. Preparation for later commits.
2024-04-09 12:06:32 +09:00
Yu Watanabe c01a5c0527 siphash24: introduce siphash24_compress_typesafe() macro
To prevent copy-and-paste mistake.

This also introduce in_addr_hash_func().

No functional change, just refactoring.
2023-12-25 15:38:59 +09:00
Ronan Pigott 06960d1719 network: include SSID in ipv6 stable prefix address generation
The SSID fills the role of the optional Network_ID input parameter
suggested by RFC7217. Including the SSID allows networkd to generate a
different pseudorandom address for different wireless networks, which
should help to obscure the host's identity when roaming between multiple
networks.
2023-10-18 09:48:09 +09:00
Zbigniew Jędrzejewski-Szmek aea3f594db various: use id128_from_string_not_null()
No functional change. In config_parse_address_generation_type() we would set
the output parameter and then say it's ignored, so it _looked_ like an error in
the code, but the variable was always initialized to SD_ID128_NULL anyway, so
the code was actually fine.
2023-09-02 14:16:25 +03:00
David Tardon 995340074e tree-wide: use ASSERT_PTR more 2022-09-13 08:13:27 +02:00
Yu Watanabe 38488babe7 network: dhcp-pd: fix prefix length of address assigned to upstream interface
This effectively revert ab0c82d9f7.

I have no idea why I did that...

Fixes #22559.
2022-02-22 20:39:28 +09:00
Frantisek Sumsal c0a2e0cc24 network: a couple of tweaks suggested by Coccinelle 2021-12-18 08:36:07 +09:00
Yu Watanabe a27588d4e7 network: dhcp-pd: rename [DHCPv6PrefixDelegation] -> [DHCPPrefixDelegation]
This just changes the names of settings, variables, functions, files, and so on.
No functionality is changed.

Preparation for supporting 6rd.
2021-12-07 20:30:30 +09:00
Yu Watanabe ab0c82d9f7 network: dhcp6pd: assign addresses in the delegated prefix instead of a subnet prefix /64 on upstream interface 2021-12-07 19:46:37 +09:00
Yu Watanabe 57c107544d network: fix memleak
Follow-up for ab106a609b.

Fixes CID#1467055.
2021-12-07 19:43:31 +09:00
Yu Watanabe ab106a609b network: eui64 address is supported only ethernet or infiniband
So, this makes prefixstable mode will be used for other interface types.
2021-12-06 21:07:12 +09:00
Yu Watanabe f2a3a133ec network: make Token=prefixstable optionally take secret key
Closes #21345.
2021-11-14 13:29:40 +09:00
Yu Watanabe 34a3a0c480 network: make generate_eui64_address() static 2021-10-07 01:24:50 +09:00
Yu Watanabe e609cd0694 network: introduce Token= setting in [IPv6Prefix]
Closes #20149.
2021-10-07 01:24:50 +09:00
Yu Watanabe f5960e0ab5 network: extend Token= setting in [DHCPv6PrefixDelegation]
Now the setting supports the same syntax as the one in the [IPv6AcceptRA]
section.
2021-10-07 01:24:12 +09:00
Yu Watanabe 140bf8dacc network: introduce Token=eui64
So, now user can explicitly request EUI-64 algorithm to generate addresses.
2021-10-07 01:16:36 +09:00
Yu Watanabe 868bd1aa1c network: address-genereation: introduce generate_addresses()
Preparation for later commits. This does not change functionality.
2021-10-07 01:16:29 +09:00
Yu Watanabe d207581fc5 network: address-generation: use in6_addr_hash_ops_free
Also, downgrade error level, and caller logs the error.
2021-10-07 01:14:51 +09:00
Yu Watanabe 3bac5fe6c9 network: address-generation: modernize config_parse_address_generation_type()
- drop unused _NONE type,
- rename IPv6Token::prefix -> IPv6Token::address,
- clear unused part of IPv6Token::address,
- use Set, instead of OrderedSet.
2021-10-07 01:14:51 +09:00
Yu Watanabe ffb834cb87 network: address-generation: mask prefix with prefixlen for safety 2021-10-07 01:14:51 +09:00
Yu Watanabe 98692ff3b8 network: address-generation: always start DAD counter from zero
The token is stored in Network, and the .network file may be applied to
multiple links.
2021-10-07 01:14:51 +09:00
Yu Watanabe ac77e0b315 network: address-generation: always use the first 64 bits of the prefix
Hopefully, the prefix length is usually 64.

Previously, if the prefix length is smaller than 64, the result address
was undefined.
2021-10-07 01:14:51 +09:00
Yu Watanabe 00f1261d39 network: make generate_ipv6_eui_64_address() take prefix
Also, rename the function.
2021-10-07 01:03:06 +09:00
Yu Watanabe 397c5418f0 network: fix prefixlen for reserved subnet anycast address
Then, the prefixlen is not a multiplier of 8, we need to use
in6_addr_prefix_covers().

This also constify the reserved addresses, and rename macros.
2021-10-07 01:03:06 +09:00
Yu Watanabe f09a474760 network: move address generation methods to network-address-generation.[ch] 2021-10-07 01:03:06 +09:00