cloud-init/Do-not-enable-dhcp6-on-EC2.patch

115 lines
4.5 KiB
Diff
Raw Normal View History

From 02d0c4852feddb0715cb515e5e552351df3d9e5f Mon Sep 17 00:00:00 2001
From: Major Hayden <major@redhat.com>
Date: Tue, 28 Mar 2023 17:16:41 -0500
Subject: [PATCH] ec2: Do not enable dhcp6 on EC2
When cloud-init finds any ipv6 information in the instance metadata, it
automatically enables dhcp6 for the network interface. However, this
brings up the instance with a broken IPv6 configuration because SLAAC
should be used for almost all situations on EC2.
Red Hat BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2092459
Fedora Pagure: https://pagure.io/cloud-sig/issue/382
Upstream: https://bugs.launchpad.net/cloud-init/+bug/1976526
Signed-off-by: Major Hayden <major@redhat.com>
---
cloudinit/sources/DataSourceEc2.py | 5 -----
tests/unittests/sources/test_ec2.py | 15 +++++++--------
2 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/cloudinit/sources/DataSourceEc2.py b/cloudinit/sources/DataSourceEc2.py
index 44665b26..b78b3e99 100644
--- a/cloudinit/sources/DataSourceEc2.py
+++ b/cloudinit/sources/DataSourceEc2.py
@@ -921,8 +921,6 @@ 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
@@ -942,9 +940,6 @@ def convert_ec2_metadata_network_config(
"match": {"macaddress": mac.lower()},
"set-name": nic_name,
}
- if nic_metadata.get("ipv6s"): # Any IPv6 addresses configured
- dev_config["dhcp6"] = True
- dev_config["dhcp6-overrides"] = dhcp_override
dev_config["addresses"] = get_secondary_addresses(nic_metadata, mac)
if not dev_config["addresses"]:
dev_config.pop("addresses") # Since we found none configured
diff --git a/tests/unittests/sources/test_ec2.py b/tests/unittests/sources/test_ec2.py
index 3fe525e3..9721cab2 100644
--- a/tests/unittests/sources/test_ec2.py
+++ b/tests/unittests/sources/test_ec2.py
@@ -432,7 +432,7 @@ class TestEc2(test_helpers.ResponsesTestCase):
"match": {"macaddress": "06:17:04:d7:26:09"},
"set-name": "eth9",
"dhcp4": True,
- "dhcp6": True,
+ "dhcp6": False,
}
},
}
@@ -513,7 +513,7 @@ class TestEc2(test_helpers.ResponsesTestCase):
"2600:1f16:292:100:f153:12a3:c37c:11f9/128",
],
"dhcp4": True,
- "dhcp6": True,
+ "dhcp6": False,
}
},
}
@@ -593,7 +593,7 @@ class TestEc2(test_helpers.ResponsesTestCase):
"match": {"macaddress": mac1},
"set-name": "eth9",
"dhcp4": True,
- "dhcp6": True,
+ "dhcp6": False,
}
},
}
@@ -1000,7 +1000,7 @@ class TestConvertEc2MetadataNetworkConfig(test_helpers.CiTestCase):
"match": {"macaddress": self.mac1},
"set-name": "eth9",
"dhcp4": True,
- "dhcp6": True,
+ "dhcp6": False,
}
},
}
@@ -1077,7 +1077,7 @@ class TestConvertEc2MetadataNetworkConfig(test_helpers.CiTestCase):
"match": {"macaddress": self.mac1},
"set-name": "eth9",
"dhcp4": True,
- "dhcp6": True,
+ "dhcp6": False,
}
},
}
@@ -1107,8 +1107,7 @@ class TestConvertEc2MetadataNetworkConfig(test_helpers.CiTestCase):
"set-name": "eth9",
"dhcp4": True,
"dhcp4-overrides": {"route-metric": 100},
- "dhcp6": True,
- "dhcp6-overrides": {"route-metric": 100},
+ "dhcp6": False,
},
"eth10": {
"match": {"macaddress": mac2},
@@ -1139,7 +1138,7 @@ class TestConvertEc2MetadataNetworkConfig(test_helpers.CiTestCase):
"match": {"macaddress": self.mac1},
"set-name": "eth9",
"dhcp4": True,
- "dhcp6": True,
+ "dhcp6": False,
}
},
}
--
2.39.2