Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable temporary address generation when renderer is NetworkManager (LP: #1948027) – change in behavior #244

Merged
merged 5 commits into from
Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/nm.c
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,8 @@ write_nm_conf_access_point(const NetplanNetDefinition* def, const char* rootdir,
g_key_file_set_string(kf, "ipv6", "addr-gen-mode", addr_gen_mode_str(def->ip6_addr_gen_mode));
if (def->ip6_privacy)
g_key_file_set_integer(kf, "ipv6", "ip6-privacy", 2);
else
g_key_file_set_integer(kf, "ipv6", "ip6-privacy", 0);
if (def->gateway6)
g_key_file_set_string(kf, "ipv6", "gateway", def->gateway6);
if (def->ip6_nameservers) {
Expand Down
2 changes: 1 addition & 1 deletion tests/generator/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
ConfigureWithoutCarrier=yes\n'
NM_WG = '[connection]\nid=netplan-wg0\ntype=wireguard\ninterface-name=wg0\n\n[wireguard]\nprivate-key=%s\nlisten-port=%s\n%s\
\n\n[ipv4]\nmethod=manual\naddress1=15.15.15.15/24\ngateway=20.20.20.21\n\n[ipv6]\nmethod=manual\naddress1=\
2001:de:ad:be:ef:ca:fe:1/128\n'
2001:de:ad:be:ef:ca:fe:1/128\nip6-privacy=0\n'
ND_WG = '[NetDev]\nName=wg0\nKind=wireguard\n\n[WireGuard]\nPrivateKey%s\nListenPort=%s\n%s\n'
ND_VLAN = '[NetDev]\nName=%s\nKind=vlan\n\n[VLAN]\nId=%d\n'
SD_WPA = '''[Unit]
Expand Down
10 changes: 10 additions & 0 deletions tests/generator/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,7 @@ def test_eth_dhcp6(self):

[ipv6]
method=auto
ip6-privacy=0
'''})

def test_eth_dhcp4_and_6(self):
Expand All @@ -1069,6 +1070,7 @@ def test_eth_dhcp4_and_6(self):

[ipv6]
method=auto
ip6-privacy=0
'''})

def test_ip6_addr_gen_mode(self):
Expand Down Expand Up @@ -1096,6 +1098,7 @@ def test_ip6_addr_gen_mode(self):
[ipv6]
method=auto
addr-gen-mode=1
ip6-privacy=0
''',
'enblue': '''[connection]
id=netplan-enblue
Expand All @@ -1111,6 +1114,7 @@ def test_ip6_addr_gen_mode(self):
[ipv6]
method=auto
addr-gen-mode=0
ip6-privacy=0
'''})

def test_ip6_addr_gen_token(self):
Expand Down Expand Up @@ -1139,6 +1143,7 @@ def test_ip6_addr_gen_token(self):
method=auto
addr-gen-mode=0
token=::2
ip6-privacy=0
''',
'enblue': '''[connection]
id=netplan-enblue
Expand All @@ -1155,6 +1160,7 @@ def test_ip6_addr_gen_token(self):
method=auto
addr-gen-mode=0
token=::2
ip6-privacy=0
'''})

def test_eth_manual_addresses(self):
Expand Down Expand Up @@ -1184,6 +1190,7 @@ def test_eth_manual_addresses(self):
[ipv6]
method=manual
address1=2001:FFfe::1/64
ip6-privacy=0
'''})
self.assert_networkd({})
self.assert_nm_udev(None)
Expand Down Expand Up @@ -1214,6 +1221,7 @@ def test_eth_manual_addresses_dhcp(self):
[ipv6]
method=manual
address1=2001:FFfe::1/64
ip6-privacy=0
'''})

def test_eth_ipv6_privacy(self):
Expand Down Expand Up @@ -1264,6 +1272,7 @@ def test_gateway(self):
[ipv6]
method=manual
address1=2001:FFfe::1/64
ip6-privacy=0
gateway=2001:FFfe::2
'''})

Expand Down Expand Up @@ -1298,6 +1307,7 @@ def test_nameserver(self):

[ipv6]
method=manual
ip6-privacy=0
dns=1234::FFFF;
dns-search=lab;kitchen;
''',
Expand Down
1 change: 1 addition & 0 deletions tests/generator/test_dhcp_overrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,5 +422,6 @@ def test_override_default_metric_v6(self):

[ipv6]
method=auto
ip6-privacy=0
route-metric=6666
'''})
7 changes: 7 additions & 0 deletions tests/generator/test_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,7 @@ def test_route_v6_single(self):
[ipv6]
method=manual
address1=2001:f00f:f00f::2/64
ip6-privacy=0
route1=2001:dead:beef::2/64,2001:beef:beef::1
'''})

Expand Down Expand Up @@ -875,6 +876,7 @@ def test_route_v6_multiple(self):
[ipv6]
method=manual
address1=2001:f00f:f00f::2/64
ip6-privacy=0
route1=2001:dead:beef::2/64,2001:beef:beef::1
route2=2001:dead:feed::2/64,2001:beef:beef::2,1000
'''})
Expand Down Expand Up @@ -904,6 +906,7 @@ def test_route_v6_default(self):
[ipv6]
method=manual
address1=2001:dead:beef::2/64
ip6-privacy=0
route1=::/0,2001:beef:beef::1
'''})

Expand Down Expand Up @@ -948,6 +951,7 @@ def test_routes_mixed(self):
[ipv6]
method=manual
address1=2001:f00f::2/128
ip6-privacy=0
route1=2001:dead:beef::2/64,2001:beef:beef::1,997
route2=2001:f00f:f00f::fe/64,2001:beef:feed::1
'''})
Expand Down Expand Up @@ -1272,6 +1276,7 @@ def test_use_routes_v6(self):

[ipv6]
method=auto
ip6-privacy=0
ignore-auto-routes=true
never-default=true
'''})
Expand Down Expand Up @@ -1302,6 +1307,7 @@ def test_default_metric_v4(self):

[ipv6]
method=auto
ip6-privacy=0
'''})

def test_default_metric_v6(self):
Expand Down Expand Up @@ -1329,5 +1335,6 @@ def test_default_metric_v6(self):

[ipv6]
method=auto
ip6-privacy=0
route-metric=5050
'''})
3 changes: 3 additions & 0 deletions tests/generator/test_tunnels.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ def test_simple_multi_pass(self):
[ipv6]
method=manual
address1=2001:de:ad:be:ef:ca:fe:1/128
ip6-privacy=0
''',
'br0.nmconnection': '''[connection]
id=netplan-br0
Expand Down Expand Up @@ -977,6 +978,7 @@ def test_sit_he(self):
[ipv6]
method=manual
address1=2001:cafe:face::1/64
ip6-privacy=0
''',
'he-ipv6': '''[connection]
id=netplan-he-ipv6
Expand All @@ -994,6 +996,7 @@ def test_sit_he(self):
[ipv6]
method=manual
address1=2001:dead:beef::2/64
ip6-privacy=0
gateway=2001:dead:beef::1
'''})

Expand Down
2 changes: 2 additions & 0 deletions tests/generator/test_vlans.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ def test_vlan(self):

[ipv6]
method=auto
ip6-privacy=0
'''})
self.assert_nm_udev(None)

Expand Down Expand Up @@ -302,5 +303,6 @@ def test_vlan_sriov(self):

[ipv6]
method=auto
ip6-privacy=0
'''})
self.assert_nm_udev(None)
2 changes: 2 additions & 0 deletions tests/parser/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ def normalize_keyfile(self, file_contents):
# Normalize lines
if k == 'addr-gen-mode':
v = v.replace('1', 'stable-privacy').replace('0', 'eui64')
elif k == 'ip6-privacy' and v == '0':
continue
elif k == 'wake-on-lan' and v == '1':
continue
elif k == 'stp' and v == 'true':
Expand Down