Skip to content

Commit

Permalink
Revert "ec2: Do not enable dhcp6 on EC2 (#5104)" (#5145)
Browse files Browse the repository at this point in the history
This reverts commit f0fb841.

It appears that this bug was fixed already via another patch sometime
between the time I found the issue and submitted the PR #5104. This
patch isn't needed any longer and I want to avoid causing additional
problems.

Signed-off-by: Major Hayden <major@redhat.com>
  • Loading branch information
major committed Apr 5, 2024
1 parent 2f9812e commit 1feb329
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
4 changes: 4 additions & 0 deletions cloudinit/sources/DataSourceEc2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,8 @@ def convert_ec2_metadata_network_config(
"set-name": nic_name,
}
nic_metadata = macs_metadata.get(mac)
if nic_metadata.get("ipv6s"): # Any IPv6 addresses configured
dev_config["dhcp6"] = True
netcfg["ethernets"][nic_name] = dev_config
return netcfg
# Apply network config for all nics and any secondary IPv4/v6 addresses
Expand Down Expand Up @@ -1112,6 +1114,8 @@ def convert_ec2_metadata_network_config(
table=table,
)
if nic_metadata.get("ipv6s"): # Any IPv6 addresses configured
dev_config["dhcp6"] = True
dev_config["dhcp6-overrides"] = dhcp_override
if (
is_netplan
and nic_metadata.get("device-number")
Expand Down
24 changes: 15 additions & 9 deletions tests/unittests/sources/test_ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ def test_network_config_property_returns_version_2_network_data(self):
"match": {"macaddress": "06:17:04:d7:26:09"},
"set-name": "eth9",
"dhcp4": True,
"dhcp6": False,
"dhcp6": True,
}
},
}
Expand Down Expand Up @@ -545,7 +545,7 @@ def test_network_config_property_secondary_private_ips(self):
"2600:1f16:292:100:f153:12a3:c37c:11f9/128",
],
"dhcp4": True,
"dhcp6": False,
"dhcp6": True,
}
},
}
Expand Down Expand Up @@ -625,7 +625,7 @@ def test_network_config_cached_property_refreshed_on_upgrade(self, m_dhcp):
"match": {"macaddress": mac1},
"set-name": "eth9",
"dhcp4": True,
"dhcp6": False,
"dhcp6": True,
}
},
}
Expand Down Expand Up @@ -1154,7 +1154,7 @@ def test_convert_ec2_metadata_network_config_handles_only_dhcp6(self):
"match": {"macaddress": self.mac1},
"set-name": "eth9",
"dhcp4": True,
"dhcp6": False,
"dhcp6": True,
}
},
}
Expand Down Expand Up @@ -1234,7 +1234,7 @@ def test_convert_ec2_metadata_network_config_handles_local_v4_and_v6(self):
"match": {"macaddress": self.mac1},
"set-name": "eth9",
"dhcp4": True,
"dhcp6": False,
"dhcp6": True,
}
},
}
Expand Down Expand Up @@ -1267,7 +1267,8 @@ def test_convert_ec2_metadata_network_config_multi_nics_ipv4(self):
"set-name": "eth9",
"dhcp4": True,
"dhcp4-overrides": {"route-metric": 100},
"dhcp6": False,
"dhcp6": True,
"dhcp6-overrides": {"route-metric": 100},
},
"eth10": {
"match": {"macaddress": mac2},
Expand Down Expand Up @@ -1326,17 +1327,18 @@ def test_convert_ec2_metadata_network_config_multi_nics_ipv4_ipv6_multi_ip(
"eth9": {
"dhcp4": True,
"dhcp4-overrides": {"route-metric": 100},
"dhcp6": False,
"dhcp6": True,
"match": {"macaddress": "06:17:04:d7:26:09"},
"set-name": "eth9",
"dhcp6-overrides": {"route-metric": 100},
},
"eth10": {
"dhcp4": True,
"dhcp4-overrides": {
"route-metric": 200,
"use-routes": True,
},
"dhcp6": False,
"dhcp6": True,
"match": {"macaddress": "06:17:04:d7:26:08"},
"set-name": "eth10",
"routes": [
Expand All @@ -1359,6 +1361,10 @@ def test_convert_ec2_metadata_network_config_multi_nics_ipv4_ipv6_multi_ip(
"table": 101,
},
],
"dhcp6-overrides": {
"route-metric": 200,
"use-routes": True,
},
"addresses": ["2600:1f16:292:100:f153:12a3:c37c:11f9/128"],
},
},
Expand Down Expand Up @@ -1388,7 +1394,7 @@ def test_convert_ec2_metadata_network_config_handles_dhcp4_and_dhcp6(self):
"match": {"macaddress": self.mac1},
"set-name": "eth9",
"dhcp4": True,
"dhcp6": False,
"dhcp6": True,
}
},
}
Expand Down

0 comments on commit 1feb329

Please sign in to comment.