Conversation
- ifutil.py: Add retry loop (10s timeout) in set_dhcp() for non-blocking DHCP clients like dhcpcd. The previous code checked for an IP address immediately after ifup returned, but dhcpcd forks and assigns the address asynchronously (~3s delay). - ifutil.py: Add get_ipv6conf() to retrieve global-scope IPv6 address and prefix length via 'ip -6 addr show'. - confconsole.py: Display IPv6 address in both the main services screen and the networking configuration screen when available. Tested on Proxmox LXC unprivileged container (Moodle v19, Trixie) with dhcpcd as the sole DHCP client (dual-stack DHCPv4/DHCPv6).
_get_default_nic() only checked IPv4 via get_ipconf(), causing confconsole to report 'Networking is not yet configured' on IPv6-only hosts despite having a valid global address. Add get_ipv6conf() fallback in _validip(): if no valid IPv4 is found, check for a global-scope IPv6 address before declaring the interface unconfigured. This enables IPv6-first deployments to pass the network check without requiring an IPv4 address.
Pass IPv6 address as $ip6addr to services.txt template instead of appending it after substitution. Uses safe_substitute so appliances without $ip6addr in their services.txt are unaffected. Ref: turnkeylinux/tracker#1658
|
Let me know what you think @OnGle |
|
|
||
| hostname = netinfo.get_hostname().upper() | ||
|
|
||
| ipv6_addr, ipv6_prefix = ifutil.get_ipv6conf(ifname) |
There was a problem hiding this comment.
Hey Jed,
get_ipv6conf(ifname) is called twice in usage() — once around line 513 (before safe_substitute) and again around line 527 (where it's actually used for the IPv6 Web/SSH display). The first call result is never referenced, so it's a redundant subprocess call on every screen render.
Two options:
- Just remove the first call.
- Keep it and pass
ip6addrintosafe_substitute()so applianceservices.txttemplates can reference$ip6addrin the future:
text = Template(t).safe_substitute(
appname=self.appname,
hostname=hostname,
ipaddr=ip_addr,
ip6addr=ipv6_addr or '',
)Then the second call becomes unnecessary.
I'd lean toward option 2 — it's forward-compatible and safe_substitute won't break anything if the variable isn't used in the template.
marcos-mendez
left a comment
There was a problem hiding this comment.
Sorry got a litttle messy my comment but here it is
|
|
||
| hostname = netinfo.get_hostname().upper() | ||
|
|
||
| ipv6_addr, ipv6_prefix = ifutil.get_ipv6conf(ifname) |
|
Thanks @marcos-mendez 😁 Looking closer it's called 4 times...! First @ 334 in I've removed that last one and moved TBH I think now we're making ipv6 a "first class citizen" refactoring the whole layout would be nice. As an aside, @OnGle & I have often talked about possibly ditching dialog altogether. But all of that's for another day... |
|
FYI I've just packaged this and pushed it to the TKL |
Copy of @marcos-mendez's #101 PR - see that for full details of the IPv6 update.
This PR: