mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-23 17:34:00 +03:00
Merge pull request #14805 from yuwata/network-ipv6-token-follow-up
network: rename eui64 to static
This commit is contained in:
commit
c3b41d8811
@ -312,7 +312,7 @@
|
|||||||
the mechanism is present, the two parts must be separated with a colon
|
the mechanism is present, the two parts must be separated with a colon
|
||||||
<literal><replaceable>type</replaceable>:<replaceable>prefix</replaceable></literal>. The
|
<literal><replaceable>type</replaceable>:<replaceable>prefix</replaceable></literal>. The
|
||||||
address generation mechanism may be either <constant>prefixstable</constant> or
|
address generation mechanism may be either <constant>prefixstable</constant> or
|
||||||
<constant>eui64</constant>. If not specified, <constant>eui64</constant> is assumed. When
|
<constant>static</constant>. If not specified, <constant>static</constant> is assumed. When
|
||||||
set to <literal>prefixstable</literal> a method for generating IPv6 Interface Identifiers to
|
set to <literal>prefixstable</literal> a method for generating IPv6 Interface Identifiers to
|
||||||
be used with IPv6 Stateless Address Autocon figuration (SLAAC). See
|
be used with IPv6 Stateless Address Autocon figuration (SLAAC). See
|
||||||
<ulink url="https://tools.ietf.org/html/rfc7217">RFC 7217</ulink>. When IPv6 address is set,
|
<ulink url="https://tools.ietf.org/html/rfc7217">RFC 7217</ulink>. When IPv6 address is set,
|
||||||
|
@ -278,13 +278,13 @@ static int ndisc_router_generate_address(Link *link, unsigned prefixlen, uint32_
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (j->address_generation_type == IPV6_TOKEN_ADDRESS_GENERATION_EUI64) {
|
} else if (j->address_generation_type == IPV6_TOKEN_ADDRESS_GENERATION_STATIC) {
|
||||||
memcpy(((uint8_t *)&address->in_addr.in6) + 8, ((uint8_t *) &j->prefix) + 8, 8);
|
memcpy(((uint8_t *)&address->in_addr.in6) + 8, ((uint8_t *) &j->prefix) + 8, 8);
|
||||||
prefix = true;
|
prefix = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eui64 or fallback if prefixstable do not match */
|
/* fallback to eui64 if prefixstable or static do not match */
|
||||||
if (!prefix) {
|
if (!prefix) {
|
||||||
/* see RFC4291 section 2.5.1 */
|
/* see RFC4291 section 2.5.1 */
|
||||||
address->in_addr.in6.s6_addr[8] = link->mac.ether_addr_octet[0];
|
address->in_addr.in6.s6_addr[8] = link->mac.ether_addr_octet[0];
|
||||||
@ -992,14 +992,20 @@ int config_parse_address_generation_type(
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
|
|
||||||
if (streq(word, "eui64"))
|
if (streq(word, "static"))
|
||||||
token->address_generation_type = IPV6_TOKEN_ADDRESS_GENERATION_EUI64;
|
token->address_generation_type = IPV6_TOKEN_ADDRESS_GENERATION_STATIC;
|
||||||
else if (streq(word, "prefixstable"))
|
else if (streq(word, "prefixstable"))
|
||||||
token->address_generation_type = IPV6_TOKEN_ADDRESS_GENERATION_PREFIXSTABLE;
|
token->address_generation_type = IPV6_TOKEN_ADDRESS_GENERATION_PREFIXSTABLE;
|
||||||
else {
|
else {
|
||||||
token->address_generation_type = IPV6_TOKEN_ADDRESS_GENERATION_EUI64;
|
token->address_generation_type = IPV6_TOKEN_ADDRESS_GENERATION_STATIC;
|
||||||
p = rvalue;
|
p = rvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isempty(p)) {
|
||||||
|
log_syntax(unit, LOG_ERR, filename, line, 0,
|
||||||
|
"Invalid IPv6Token= , ignoring assignment: %s", rvalue);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
r = in_addr_from_string(AF_INET6, p, &buffer);
|
r = in_addr_from_string(AF_INET6, p, &buffer);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
|
@ -9,7 +9,7 @@ typedef struct IPv6Token IPv6Token;
|
|||||||
|
|
||||||
typedef enum IPv6TokenAddressGeneration {
|
typedef enum IPv6TokenAddressGeneration {
|
||||||
IPV6_TOKEN_ADDRESS_GENERATION_NONE,
|
IPV6_TOKEN_ADDRESS_GENERATION_NONE,
|
||||||
IPV6_TOKEN_ADDRESS_GENERATION_EUI64,
|
IPV6_TOKEN_ADDRESS_GENERATION_STATIC,
|
||||||
IPV6_TOKEN_ADDRESS_GENERATION_PREFIXSTABLE,
|
IPV6_TOKEN_ADDRESS_GENERATION_PREFIXSTABLE,
|
||||||
_IPV6_TOKEN_ADDRESS_GENERATION_MAX,
|
_IPV6_TOKEN_ADDRESS_GENERATION_MAX,
|
||||||
_IPV6_TOKEN_ADDRESS_GENERATION_INVALID = -1,
|
_IPV6_TOKEN_ADDRESS_GENERATION_INVALID = -1,
|
||||||
|
BIN
test/fuzz/fuzz-network-parser/oss-fuzz-20548
Normal file
BIN
test/fuzz/fuzz-network-parser/oss-fuzz-20548
Normal file
Binary file not shown.
@ -2680,7 +2680,7 @@ class NetworkdRATests(unittest.TestCase, Utilities):
|
|||||||
'25-veth.netdev',
|
'25-veth.netdev',
|
||||||
'ipv6-prefix.network',
|
'ipv6-prefix.network',
|
||||||
'ipv6-prefix-veth.network',
|
'ipv6-prefix-veth.network',
|
||||||
'ipv6-prefix-veth-token-eui64.network',
|
'ipv6-prefix-veth-token-static.network',
|
||||||
'ipv6-prefix-veth-token-prefixstable.network']
|
'ipv6-prefix-veth-token-prefixstable.network']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -2706,8 +2706,8 @@ class NetworkdRATests(unittest.TestCase, Utilities):
|
|||||||
print(output)
|
print(output)
|
||||||
self.assertRegex(output, '2002:da8:1:0')
|
self.assertRegex(output, '2002:da8:1:0')
|
||||||
|
|
||||||
def test_ipv6_token_eui64(self):
|
def test_ipv6_token_static(self):
|
||||||
copy_unit_to_networkd_unit_path('25-veth.netdev', 'ipv6-prefix.network', 'ipv6-prefix-veth-token-eui64.network')
|
copy_unit_to_networkd_unit_path('25-veth.netdev', 'ipv6-prefix.network', 'ipv6-prefix-veth-token-static.network')
|
||||||
start_networkd()
|
start_networkd()
|
||||||
self.wait_online(['veth99:routable', 'veth-peer:degraded'])
|
self.wait_online(['veth99:routable', 'veth-peer:degraded'])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user