Skip to content

feat(linux): Pass the container's host name in ip= - #1236

Closed
ananos wants to merge 1 commit into
feat/linux-hvi-v050from
feat/linux-hvi-v050-guest-hostname
Closed

ananos wants to merge 1 commit into
feat/linux-hvi-v050from
feat/linux-hvi-v050-guest-hostname

Conversation

@ananos

@ananos ananos commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Description

The same change as the PR into main (linked below), for feat/linux-hvi-v050, the branch hull and the brig bundles pin.

The guest kernel takes its host name from the fifth field of ip=, and urunc writes urunc there. This patch fills it from the OCI spec's hostname, with the same fallback to urunc for a name that is unset, over 64 bytes, or holds a : or a blank.

On this branch ip= is built in LinuxNet.ipParam(), which now takes the host name. hull builds its macOS container-boot command line through unikernels.Linux from this branch too, so once hull sets Linux.Hostname its own ip= carries the name as well.

Related issues

How was this tested?

  • New unit test TestLinuxIPParamHostname; go test ./pkg/unikontainers/unikernels/ passes on Linux amd64.
  • End to end on Linux amd64 (brig's rootless bundle, nerdctl, this urunc built static in place of 5c6bc70): ip=10.4.1.2::10.4.1.1:255.255.255.0:ubuntu-hosttest-ca9bbb82:eth0:off on the guest's kernel command line, and uname -n, /etc/hostname and nerdctl inspect all read ubuntu-hosttest-ca9bbb82. The same for claude@refactor: claude-code-refactor-20d51f16.
  • Lint: the branch's own image (golangci-lint v2.9) cannot load a config that targets go 1.27.3. With v2.15 there are 6 findings (gosec in cmd/urunc/utils.go and mount_linux.go, dupl in hvt/spt), identical on 5c6bc70 without this commit.
  • The e2e suites were not run.

LLM usage

Claude Opus 5.5 (Claude Code) ported the patch onto this branch, wrote the unit test, and ran the checks above.

Checklist

  • I have read the contribution guide.
  • The linter passes locally (make lint).
  • The e2e tests of at least one tool pass locally (make test_ctr, make test_nerdctl, make test_docker, make test_crictl).
  • If LLMs were used: I have read the llm policy.

The kernel sets its host name from the fifth field of ip=, which was
always "urunc". Fill it from the OCI spec's hostname instead, so a pod
or a named container shows its own name in the guest.

Fall back to "urunc" when the name is unset, longer than the kernel's
64 bytes, or holds a ':' or a blank, which would split the argument.

Signed-off-by: Anastassios Nanos <ananos@nofire.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant