118 lines
4.6 KiB
Diff
118 lines
4.6 KiB
Diff
From f0fb841883b80c71618582e43e1b3cd87a0dcb58 Mon Sep 17 00:00:00 2001
|
|
From: Major Hayden <major@redhat.com>
|
|
Date: Mon, 1 Apr 2024 18:28:12 +0000
|
|
Subject: [PATCH] ec2: Do not enable dhcp6 on EC2 (#5104)
|
|
|
|
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
|
|
|
|
Fixes GH-3980
|
|
|
|
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 9e6bfbd..fbc7761 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 ea8621a..a6801fa 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,
|
|
}
|
|
},
|
|
}
|
|
@@ -1001,7 +1001,7 @@ class TestConvertEc2MetadataNetworkConfig(test_helpers.CiTestCase):
|
|
"match": {"macaddress": self.mac1},
|
|
"set-name": "eth9",
|
|
"dhcp4": True,
|
|
- "dhcp6": True,
|
|
+ "dhcp6": False,
|
|
}
|
|
},
|
|
}
|
|
@@ -1078,7 +1078,7 @@ class TestConvertEc2MetadataNetworkConfig(test_helpers.CiTestCase):
|
|
"match": {"macaddress": self.mac1},
|
|
"set-name": "eth9",
|
|
"dhcp4": True,
|
|
- "dhcp6": True,
|
|
+ "dhcp6": False,
|
|
}
|
|
},
|
|
}
|
|
@@ -1108,8 +1108,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},
|
|
@@ -1140,7 +1139,7 @@ class TestConvertEc2MetadataNetworkConfig(test_helpers.CiTestCase):
|
|
"match": {"macaddress": self.mac1},
|
|
"set-name": "eth9",
|
|
"dhcp4": True,
|
|
- "dhcp6": True,
|
|
+ "dhcp6": False,
|
|
}
|
|
},
|
|
}
|
|
--
|
|
2.33.0
|
|
|
|
|