Compare commits
4 Commits
5f04f4e470
...
a0be538616
Author | SHA1 | Date |
---|---|---|
Yu Watanabe | a0be538616 | |
Yu Watanabe | f7ada4b8ec | |
Kevin P. Fleming | b241fa00e9 | |
Yu Watanabe | b751c3e747 |
|
@ -962,7 +962,6 @@ int config_parse_address_generation_type(
|
||||||
void *userdata) {
|
void *userdata) {
|
||||||
|
|
||||||
_cleanup_free_ IPv6Token *token = NULL;
|
_cleanup_free_ IPv6Token *token = NULL;
|
||||||
_cleanup_free_ char *word = NULL;
|
|
||||||
union in_addr_union buffer;
|
union in_addr_union buffer;
|
||||||
Network *network = data;
|
Network *network = data;
|
||||||
const char *p;
|
const char *p;
|
||||||
|
@ -978,35 +977,19 @@ int config_parse_address_generation_type(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = rvalue;
|
|
||||||
r = extract_first_word(&p, &word, ":", 0);
|
|
||||||
if (r == -ENOMEM)
|
|
||||||
return log_oom();
|
|
||||||
if (r <= 0) {
|
|
||||||
log_syntax(unit, LOG_ERR, filename, line, r,
|
|
||||||
"Invalid IPv6Token= , ignoring assignment: %s", rvalue);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = ipv6token_new(&token);
|
r = ipv6token_new(&token);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
|
|
||||||
if (streq(word, "static"))
|
if ((p = startswith(rvalue, "static:")))
|
||||||
token->address_generation_type = IPV6_TOKEN_ADDRESS_GENERATION_STATIC;
|
token->address_generation_type = IPV6_TOKEN_ADDRESS_GENERATION_STATIC;
|
||||||
else if (streq(word, "prefixstable"))
|
else if ((p = startswith(rvalue, "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_STATIC;
|
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) {
|
||||||
log_syntax(unit, LOG_ERR, filename, line, r,
|
log_syntax(unit, LOG_ERR, filename, line, r,
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
[Match]
|
||||||
|
Name=veth99
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
IPv6AcceptRA=true
|
||||||
|
IPv6Token=static:::1a:2b:3c:4d
|
|
@ -165,7 +165,9 @@ def setUpModule():
|
||||||
shutil.rmtree(networkd_ci_path)
|
shutil.rmtree(networkd_ci_path)
|
||||||
copytree(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'conf'), networkd_ci_path)
|
copytree(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'conf'), networkd_ci_path)
|
||||||
|
|
||||||
for u in ['systemd-networkd.socket', 'systemd-networkd.service', 'systemd-resolved.service', 'systemd-udevd.service', 'firewalld.service']:
|
for u in ['systemd-networkd.socket', 'systemd-networkd.service', 'systemd-resolved.service',
|
||||||
|
'systemd-udevd-kernel.socket', 'systemd-udevd-control.socket', 'systemd-udevd.service',
|
||||||
|
'firewalld.service']:
|
||||||
if call(f'systemctl is-active --quiet {u}') == 0:
|
if call(f'systemctl is-active --quiet {u}') == 0:
|
||||||
check_output(f'systemctl stop {u}')
|
check_output(f'systemctl stop {u}')
|
||||||
running_units.append(u)
|
running_units.append(u)
|
||||||
|
@ -249,13 +251,14 @@ def tearDownModule():
|
||||||
|
|
||||||
shutil.rmtree(networkd_ci_path)
|
shutil.rmtree(networkd_ci_path)
|
||||||
|
|
||||||
for u in ['systemd-networkd.service', 'systemd-resolved.service', 'systemd-udevd.service']:
|
for u in ['systemd-networkd.service', 'systemd-resolved.service']:
|
||||||
check_output(f'systemctl stop {u}')
|
check_output(f'systemctl stop {u}')
|
||||||
|
|
||||||
shutil.rmtree('/run/systemd/system/systemd-networkd.service.d')
|
shutil.rmtree('/run/systemd/system/systemd-networkd.service.d')
|
||||||
shutil.rmtree('/run/systemd/system/systemd-resolved.service.d')
|
shutil.rmtree('/run/systemd/system/systemd-resolved.service.d')
|
||||||
shutil.rmtree('/run/systemd/system/systemd-udevd.service.d')
|
shutil.rmtree('/run/systemd/system/systemd-udevd.service.d')
|
||||||
check_output('systemctl daemon-reload')
|
check_output('systemctl daemon-reload')
|
||||||
|
check_output('systemctl restart systemd-udevd.service')
|
||||||
|
|
||||||
for u in running_units:
|
for u in running_units:
|
||||||
check_output(f'systemctl start {u}')
|
check_output(f'systemctl start {u}')
|
||||||
|
@ -2681,6 +2684,7 @@ class NetworkdRATests(unittest.TestCase, Utilities):
|
||||||
'ipv6-prefix.network',
|
'ipv6-prefix.network',
|
||||||
'ipv6-prefix-veth.network',
|
'ipv6-prefix-veth.network',
|
||||||
'ipv6-prefix-veth-token-static.network',
|
'ipv6-prefix-veth-token-static.network',
|
||||||
|
'ipv6-prefix-veth-token-static-explicit.network',
|
||||||
'ipv6-prefix-veth-token-prefixstable.network']
|
'ipv6-prefix-veth-token-prefixstable.network']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -2715,6 +2719,15 @@ class NetworkdRATests(unittest.TestCase, Utilities):
|
||||||
print(output)
|
print(output)
|
||||||
self.assertRegex(output, '2002:da8:1:0:1a:2b:3c:4d')
|
self.assertRegex(output, '2002:da8:1:0:1a:2b:3c:4d')
|
||||||
|
|
||||||
|
def test_ipv6_token_static_explicit(self):
|
||||||
|
copy_unit_to_networkd_unit_path('25-veth.netdev', 'ipv6-prefix.network', 'ipv6-prefix-veth-token-static-explicit.network')
|
||||||
|
start_networkd()
|
||||||
|
self.wait_online(['veth99:routable', 'veth-peer:degraded'])
|
||||||
|
|
||||||
|
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'veth99', env=env)
|
||||||
|
print(output)
|
||||||
|
self.assertRegex(output, '2002:da8:1:0:1a:2b:3c:4d')
|
||||||
|
|
||||||
def test_ipv6_token_prefixstable(self):
|
def test_ipv6_token_prefixstable(self):
|
||||||
copy_unit_to_networkd_unit_path('25-veth.netdev', 'ipv6-prefix.network', 'ipv6-prefix-veth-token-prefixstable.network')
|
copy_unit_to_networkd_unit_path('25-veth.netdev', 'ipv6-prefix.network', 'ipv6-prefix-veth-token-prefixstable.network')
|
||||||
start_networkd()
|
start_networkd()
|
||||||
|
|
Loading…
Reference in New Issue