diff --git a/man/systemd.network.xml b/man/systemd.network.xml
index 7860bd10e6..1d811a6867 100644
--- a/man/systemd.network.xml
+++ b/man/systemd.network.xml
@@ -2193,8 +2193,11 @@ Table=1234
Token=
Specifies an optional address generation mode for the Stateless Address
- Autoconfiguration (SLAAC). Supported modes are static and
- prefixstable.
+ Autoconfiguration (SLAAC). Supported modes are eui64,
+ static, and prefixstable.
+
+ When the mode is set to eui64, then the EUI-64 algorithm will be
+ used to generate an address for that prefix.
When the mode is set to static, an IPv6 address must be
specified after a colon (:), and the lower bits of the supplied
@@ -2229,7 +2232,8 @@ Table=1234
the all previous assignments are cleared.
Examples:
- Token=::1a:2b:3c:4d
+ Token=eui64
+Token=::1a:2b:3c:4d
Token=static:::1a:2b:3c:4d
Token=prefixstable
Token=prefixstable:2002:da8:1::
diff --git a/src/network/networkd-address-generation.c b/src/network/networkd-address-generation.c
index 008575f7f8..800a96d351 100644
--- a/src/network/networkd-address-generation.c
+++ b/src/network/networkd-address-generation.c
@@ -23,6 +23,7 @@
#define NDISC_APP_ID SD_ID128_MAKE(13,ac,81,a7,d5,3f,49,78,92,79,5d,0c,29,3a,bc,7e)
typedef enum AddressGenerationType {
+ ADDRESS_GENERATION_EUI64,
ADDRESS_GENERATION_STATIC,
ADDRESS_GENERATION_PREFIXSTABLE,
_ADDRESS_GENERATION_TYPE_MAX,
@@ -176,6 +177,10 @@ static int generate_addresses(
struct in6_addr addr, *copy;
switch (j->type) {
+ case ADDRESS_GENERATION_EUI64:
+ generate_eui64_address(link, &masked, &addr);
+ break;
+
case ADDRESS_GENERATION_STATIC:
memcpy(addr.s6_addr, masked.s6_addr, 8);
memcpy(addr.s6_addr + 8, j->address.s6_addr + 8, 8);
@@ -309,6 +314,9 @@ int config_parse_address_generation_type(
return 0;
}
+ } else if (streq(rvalue, "eui64")) {
+ type = ADDRESS_GENERATION_EUI64;
+ p = NULL;
} else {
type = ADDRESS_GENERATION_STATIC;
@@ -328,6 +336,10 @@ int config_parse_address_generation_type(
}
switch (type) {
+ case ADDRESS_GENERATION_EUI64:
+ assert(in6_addr_is_null(&buffer.in6));
+ break;
+
case ADDRESS_GENERATION_STATIC:
/* Only last 64 bits are used. */
memzero(buffer.in6.s6_addr, 8);