1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-23 10:50:16 +03:00

Merge pull request #11428 from yuwata/network-issue-9130-v2

network: wait for kernel to reply ipv6 peer address
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-01-15 16:44:27 +01:00 committed by GitHub
commit acd1220cff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View File

@ -651,8 +651,7 @@ int address_configure(
if (r < 0)
return r;
r = netlink_call_async(link->manager->rtnl, NULL, req, callback,
link_netlink_destroy_callback, link);
r = netlink_call_async(link->manager->rtnl, NULL, req, callback, link_netlink_destroy_callback, link);
if (r < 0) {
address_release(address);
return log_error_errno(r, "Could not send rtnetlink message: %m");
@ -660,7 +659,10 @@ int address_configure(
link_ref(link);
r = address_add(link, address->family, &address->in_addr, address->prefixlen, NULL);
if (address->family == AF_INET6 && !in_addr_is_null(address->family, &address->in_addr_peer))
r = address_add(link, address->family, &address->in_addr_peer, address->prefixlen, NULL);
else
r = address_add(link, address->family, &address->in_addr, address->prefixlen, NULL);
if (r < 0) {
address_release(address);
return log_error_errno(r, "Could not add address: %m");

View File

@ -12,3 +12,7 @@ Label=32
[Address]
Address=10.6.7.8/16
Label=33
[Address]
Address=2001:db8::20
Peer=2001:db8::10/128

View File

@ -659,6 +659,7 @@ class NetworkdNetWorkTests(unittest.TestCase, Utilities):
print(output)
self.assertRegex(output, 'inet 10.2.3.4 peer 10.2.3.5/16 scope global 32')
self.assertRegex(output, 'inet 10.6.7.8/16 brd 10.6.255.255 scope global 33')
self.assertRegex(output, 'inet6 2001:db8::20 peer 2001:db8::10/128 scope global')
output = subprocess.check_output(['networkctl', 'status', 'dummy98']).rstrip().decode('utf-8')
print(output)