sd-ipv4ll/networkd: generate predictable addresses

System Internals / systemd - Umut Tezduyar Lindskog [axis.com] - 21 March 2014 14:24 UTC

Increase the chance of using the same link local address between reboots. The pseudo random sequence of addresses we attempt is now seeded with data that is
very likely to stay the same between reboots, but at the same time be unique to the specific machine/nic.

First we try to use the ID_NET_NAME_* data from the udev db combined with the machin-id, which is guaranteed to be unique and persistent, if available. If that is not possible (e.g., in containers where we don't have access to the udev db) we fallback to using the MAC address of the interface, which is guaranteed to be unique, and likely to be persistent.

[tomegun: three minor changes:

- don't expose HASH_KEY in the siphash24 header- get rid of some compile-warnings (and some casts at the same time), by using uint8_t[8] rather than uint64_t in the api- added commit message]

b5db00e sd-ipv4ll/networkd: generate predictable addresses
TODO | 1 -
src/libsystemd-network/sd-ipv4ll.c | 96 +++++++++++++++++++++++++++---------
src/network/networkd-link.c | 12 +++++
src/network/networkd.h | 1 +
src/shared/net-util.c | 39 +++++++++++++++
src/shared/net-util.h | 2 +
src/systemd/sd-ipv4ll.h | 1 +
src/udev/net/link-config.c | 29 +----------
8 files changed, 130 insertions(+), 51 deletions(-)

Upstream: github.com


  • Share