Compare commits
No commits in common. "a0be5386168a39337d879a9f7d4bd224a42250f2" and "5f04f4e470379f461b9f0f3e4f75e55cfc055536" have entirely different histories.
a0be538616
...
5f04f4e470
|
@ -962,6 +962,7 @@ int config_parse_address_generation_type(
|
|||
void *userdata) {
|
||||
|
||||
_cleanup_free_ IPv6Token *token = NULL;
|
||||
_cleanup_free_ char *word = NULL;
|
||||
union in_addr_union buffer;
|
||||
Network *network = data;
|
||||
const char *p;
|
||||
|
@ -977,19 +978,35 @@ int config_parse_address_generation_type(
|
|||
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);
|
||||
if (r < 0)
|
||||
return log_oom();
|
||||
|
||||
if ((p = startswith(rvalue, "static:")))
|
||||
if (streq(word, "static"))
|
||||
token->address_generation_type = IPV6_TOKEN_ADDRESS_GENERATION_STATIC;
|
||||
else if ((p = startswith(rvalue, "prefixstable:")))
|
||||
else if (streq(word, "prefixstable"))
|
||||
token->address_generation_type = IPV6_TOKEN_ADDRESS_GENERATION_PREFIXSTABLE;
|
||||
else {
|
||||
token->address_generation_type = IPV6_TOKEN_ADDRESS_GENERATION_STATIC;
|
||||
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);
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_ERR, filename, line, r,
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
[Match]
|
||||
Name=veth99
|
||||
|
||||
[Network]
|
||||
IPv6AcceptRA=true
|
||||
IPv6Token=static:::1a:2b:3c:4d
|
|
@ -165,9 +165,7 @@ def setUpModule():
|
|||
shutil.rmtree(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-kernel.socket', 'systemd-udevd-control.socket', 'systemd-udevd.service',
|
||||
'firewalld.service']:
|
||||
for u in ['systemd-networkd.socket', 'systemd-networkd.service', 'systemd-resolved.service', 'systemd-udevd.service', 'firewalld.service']:
|
||||
if call(f'systemctl is-active --quiet {u}') == 0:
|
||||
check_output(f'systemctl stop {u}')
|
||||
running_units.append(u)
|
||||
|
@ -251,14 +249,13 @@ def tearDownModule():
|
|||
|
||||
shutil.rmtree(networkd_ci_path)
|
||||
|
||||
for u in ['systemd-networkd.service', 'systemd-resolved.service']:
|
||||
for u in ['systemd-networkd.service', 'systemd-resolved.service', 'systemd-udevd.service']:
|
||||
check_output(f'systemctl stop {u}')
|
||||
|
||||
shutil.rmtree('/run/systemd/system/systemd-networkd.service.d')
|
||||
shutil.rmtree('/run/systemd/system/systemd-resolved.service.d')
|
||||
shutil.rmtree('/run/systemd/system/systemd-udevd.service.d')
|
||||
check_output('systemctl daemon-reload')
|
||||
check_output('systemctl restart systemd-udevd.service')
|
||||
|
||||
for u in running_units:
|
||||
check_output(f'systemctl start {u}')
|
||||
|
@ -2684,7 +2681,6 @@ class NetworkdRATests(unittest.TestCase, Utilities):
|
|||
'ipv6-prefix.network',
|
||||
'ipv6-prefix-veth.network',
|
||||
'ipv6-prefix-veth-token-static.network',
|
||||
'ipv6-prefix-veth-token-static-explicit.network',
|
||||
'ipv6-prefix-veth-token-prefixstable.network']
|
||||
|
||||
def setUp(self):
|
||||
|
@ -2719,15 +2715,6 @@ class NetworkdRATests(unittest.TestCase, Utilities):
|
|||
print(output)
|
||||
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):
|
||||
copy_unit_to_networkd_unit_path('25-veth.netdev', 'ipv6-prefix.network', 'ipv6-prefix-veth-token-prefixstable.network')
|
||||
start_networkd()
|
||||
|
|
Loading…
Reference in New Issue