diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c index d1ef451004..502b9e39da 100644 --- a/src/network/networkd-address.c +++ b/src/network/networkd-address.c @@ -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"); diff --git a/test/test-network/conf/25-address-section.network b/test/test-network/conf/25-address-section.network index 4b22f7331a..3904953443 100644 --- a/test/test-network/conf/25-address-section.network +++ b/test/test-network/conf/25-address-section.network @@ -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 diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index 183d24d7a7..86a07c53b3 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -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)