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

fix(smartos): Add addrconf IPv6 support #5831

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

blackhelicoptersdotnet
Copy link

@blackhelicoptersdotnet blackhelicoptersdotnet commented Oct 21, 2024

Proposed Commit Message

fix(smartos): Add `addrconf` IPv6 support

SmartOS uses `addrconf` as a special value to indicate that an IPv6
address should be obtained via DHCPv6 or SLAAC. cloud-init does not
know how to handle this.

Added logic to DataSourceSmartOS.py to properly recognise and handle
this value.

Additional Context

The vendor's documentation describes how this is supposed to work.

https://docs.smartos.org/setting-up-ipv6-in-a-zone/

This works fine for native and lx-branded zones (where network configuration is handled by other means), but not for KVM or Bhyve zones in which cloud-init is expected to perform the appropriate configuration.

Before this change, addrconf would be passed through to cloud-init as a static address, causing errors.

# cloud-init status -l
status: error
extended_status: error
boot_status_code: enabled-by-generator
last_update: Mon, 21 Oct 2024 00:52:15 +0000
detail:
Cloud-init enabled by systemd cloud-init-generator
errors:
	- Address addrconf is not a valid ip address
	- Address addrconf is not a valid ip address
recoverable_errors:
ERROR:
	- Address addrconf is not a valid ip network
	- Address addrconf is not a valid ip network
WARNING:
	- failed stage init
	- failed stage init-local

Test Steps

  1. On a SmartOS host, follow the vendor's documentation to create a bhyve or kvm zone with the addrconf keyword in the NIC configuration.

  2. On the guest, check to see that an IPv6 address was autoconfigured.

# ip addr
[...]
2: net0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether e2:7f:c1:50:eb:99 brd ff:ff:ff:ff:ff:ff
    altname enp0s6
    inet 10.64.1.130/26 brd 10.64.1.191 scope global noprefixroute net0
       valid_lft forever preferred_lft forever
    inet6 2001:0db8::a8ac:2e5d:33d9:fdcd/128 scope global noprefixroute
       valid_lft forever preferred_lft forever
    inet6 2001:0db8::e07f:c1ff:fe50:eb99/64 scope global dynamic noprefixroute
       valid_lft 2591950sec preferred_lft 604750sec
    inet6 fe80::e07f:c1ff:fe50:eb99/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

Merge type

  • Squash merge using "Proposed Commit Message"
  • Rebase and merge unique commits. Requires commit messages per-commit each referencing the pull request number (#<PR_NUM>)

@blackhelicoptersdotnet blackhelicoptersdotnet changed the title WIP: fix(smartos): Add addrconf IPv6 support fix(smartos): Add addrconf IPv6 support Oct 21, 2024
@blackhelicoptersdotnet blackhelicoptersdotnet marked this pull request as ready for review October 21, 2024 03:45
SmartOS uses `addrconf` as a special value to indicate that an IPv6
address should be obtained via DHCPv6 or SLAAC. cloud-init does not
know how to handle this.

Added logic to DataSourceSmartOS.py to properly recognise and handle
this value.
@TheRealFalcon
Copy link
Member

@blackhelicoptersdotnet , thanks for the PR! At first look, the changes look good, though there will need to be fixes for CI. To run the same checks as CI, you can run tox (with no arguments) locally.

Are you associated with the smartos project, or just providing a fix for your use case? Since I don't have the means to verify the fix myself, can add the tarball from cloud-init collect-logs from a run of this branch working as expected?

tabs->spaces
@blackhelicoptersdotnet
Copy link
Author

@TheRealFalcon Thanks for the feedback! I've pushed a fix for the check that failed CI.

Not affiliated with SmartOS, just wanted to push a fix to resolve my issue and assist whoever comes after me :)

The log tarball contains some environment details that I'd prefer not to have in the public domain. Happy to provide one privately if you like, or alternatively, if there specific files that you need I can scrub those and upload them?

@TheRealFalcon
Copy link
Member

@blackhelicoptersdotnet , sure. Could you provide the var/log/cloud-init.log and var/lib/cloud/instance/network-config.json?

@bahamat
Copy link

bahamat commented Oct 22, 2024

@TheRealFalcon Hi, I’m one of the maintainers for SmartOS (incidentally, I am also the person producing guest images that use cloud-init), so I can speak to that side of things. The keyword addrconf is how we indicate dynamic IPv6 addressing, whether DHCPv6 or SLAAC.

@blackhelicoptersdotnet
Copy link
Author

@TheRealFalcon Here's the logs

cloud-init.log
network-config.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA signed The submitter of the PR has signed the CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants