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