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

net.is_ip_address could not solve ipv6 has URL encode %25 #5893

Open
volehuy1998 opened this issue Nov 21, 2024 · 0 comments
Open

net.is_ip_address could not solve ipv6 has URL encode %25 #5893

volehuy1998 opened this issue Nov 21, 2024 · 0 comments
Labels
bug Something isn't working correctly new An issue that still needs triage

Comments

@volehuy1998
Copy link

volehuy1998 commented Nov 21, 2024

Bug report

Cloud-init is not possible with IPv6 because the net.is_ip_address function cannot resolve fe80::a9fe:a9fe%25{iface}, instead of fe80::a9fe:a9fe%{iface}. Leading to the removal of IPv6 from the metadata retrieval list.

# cloudinit/sources/DataSourceOpenStack.py
DEF_MD_URLS = [
            "http://[fe80::a9fe:a9fe%25{iface}]".format(
                iface=self.distro.fallback_interface
            ),
            "http://169.254.169.254",
        ]

# cloudinit/util.py
with suppress(ValueError):
            if net.is_ip_address(parsed_url.netloc.strip("[]")):
                return True

Fix by

# cloudinit/sources/DataSourceOpenStack.py
DEF_MD_URLS = [
            "http://[fe80::a9fe:a9fe%{iface}]".format(
                iface=self.distro.fallback_interface
            ),
            "http://169.254.169.254",
        ]

# cloudinit/util.py
with suppress(ValueError):
            if net.is_ip_address(parsed_url.netloc.strip("[]")):
                return True

Steps to reproduce the problem

$ cloud-init init

Environment details

  • Cloud-init version: 24.3.1-0ubuntu0~20.04.1
  • Operating System Distribution: ubuntu 20.04
  • Cloud provider, platform or installer type: OpenStack
@volehuy1998 volehuy1998 added bug Something isn't working correctly new An issue that still needs triage labels Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly new An issue that still needs triage
Projects
None yet
Development

No branches or pull requests

1 participant