mirror of
https://github.com/systemd/systemd.git
synced 2025-01-25 10:04:04 +03:00
Merge pull request #13565 from yuwata/network-drop-ipv6ll-address
network: drop IPv6LL address when LinkLocalAddressing=no|ipv4
This commit is contained in:
commit
e8c36cc596
@ -2389,7 +2389,7 @@ static int link_drop_foreign_config(Link *link) {
|
||||
|
||||
SET_FOREACH(address, link->addresses_foreign, i) {
|
||||
/* we consider IPv6LL addresses to be managed by the kernel */
|
||||
if (address->family == AF_INET6 && in_addr_is_link_local(AF_INET6, &address->in_addr) == 1)
|
||||
if (address->family == AF_INET6 && in_addr_is_link_local(AF_INET6, &address->in_addr) == 1 && link_ipv6ll_enabled(link))
|
||||
continue;
|
||||
|
||||
if (link_address_is_dynamic(link, address)) {
|
||||
@ -2466,7 +2466,7 @@ static int link_drop_config(Link *link) {
|
||||
|
||||
SET_FOREACH(address, link->addresses, i) {
|
||||
/* we consider IPv6LL addresses to be managed by the kernel */
|
||||
if (address->family == AF_INET6 && in_addr_is_link_local(AF_INET6, &address->in_addr) == 1)
|
||||
if (address->family == AF_INET6 && in_addr_is_link_local(AF_INET6, &address->in_addr) == 1 && link_ipv6ll_enabled(link))
|
||||
continue;
|
||||
|
||||
r = address_remove(address, link, NULL);
|
||||
|
@ -0,0 +1,6 @@
|
||||
[Match]
|
||||
Name=dummy98
|
||||
|
||||
[Network]
|
||||
LinkLocalAddressing=ipv6
|
||||
IPv6AcceptRA=no
|
@ -1435,6 +1435,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
'25-gateway-next-static.network',
|
||||
'25-sysctl-disable-ipv6.network',
|
||||
'25-sysctl.network',
|
||||
'26-link-local-addressing-ipv6.network',
|
||||
'configure-without-carrier.network',
|
||||
'routing-policy-rule-dummy98.network',
|
||||
'routing-policy-rule-test1.network']
|
||||
@ -1814,6 +1815,23 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
if os.path.exists(os.path.join(os.path.join(network_sysctl_ipv6_path, 'dummy98'), 'addr_gen_mode')):
|
||||
self.assertEqual(read_ipv6_sysctl_attr('dummy98', 'addr_gen_mode'), '1')
|
||||
|
||||
def test_link_local_addressing_remove_ipv6ll(self):
|
||||
copy_unit_to_networkd_unit_path('26-link-local-addressing-ipv6.network', '12-dummy.netdev')
|
||||
start_networkd()
|
||||
self.wait_online(['dummy98:degraded'])
|
||||
|
||||
output = check_output('ip address show dev dummy98')
|
||||
print(output)
|
||||
self.assertRegex(output, 'inet6 .* scope link')
|
||||
|
||||
copy_unit_to_networkd_unit_path('25-link-local-addressing-no.network')
|
||||
restart_networkd(1)
|
||||
self.wait_online(['dummy98:carrier'])
|
||||
|
||||
output = check_output('ip address show dev dummy98')
|
||||
print(output)
|
||||
self.assertNotRegex(output, 'inet6* .* scope link')
|
||||
|
||||
def test_sysctl(self):
|
||||
copy_unit_to_networkd_unit_path('25-sysctl.network', '12-dummy.netdev')
|
||||
start_networkd()
|
||||
|
Loading…
x
Reference in New Issue
Block a user