Skip to content

fix(network): distinguish missing container iface from setup failures - #865

Open
Vi-shub wants to merge 1 commit into
urunc-dev:mainfrom
Vi-shub:fix/setupnet-missing-iface-417
Open

fix(network): distinguish missing container iface from setup failures#865
Vi-shub wants to merge 1 commit into
urunc-dev:mainfrom
Vi-shub:fix/setupnet-missing-iface-417

Conversation

@Vi-shub

@Vi-shub Vi-shub commented Jul 30, 2026

Copy link
Copy Markdown

Description

SetupNet previously logged and ignored all NetworkSetup errors, so real failures (TAP creation, TC rules, permissions) could leave a container running without networking.
This change follows the guidance on #417:

  • Add network.ErrNoContainerNetwork for the "no suitable interface in the netns" case (ctr / --network none).
  • discoverContainerIface returns that sentinel.
  • SetupNet continues only when errors.Is(err, ErrNoContainerNetwork); all other errors are returned to the caller.
  • Align static network discovery wrapping with the dynamic path so the sentinel stays detectable via %w.

Related issues

How was this tested?

  • make test_network (includes TestErrNoContainerNetworkIsDetectableWhenWrapped)
    • sudo nerdctl run --rm --network none --runtime io.containerd.urunc.v2 harbor.nbfc.io/nubificus/urunc/hello-qemu-unikraft:latest → Hello world
    • sudo nerdctl run -d --name urunc-nginx --runtime io.containerd.urunc.v2 harbor.nbfc.io/nubificus/urunc/nginx-qemu-unikraft-initrd:latest → curl to container IP succeeded

LLM usage

Claude assisted with drafting the PR creation; I reviewed and verified the logic against the discussion on #417 and tested locally as 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.

Propagate real NetworkSetup failures from SetupNet, while treating
ErrNoContainerNetwork (no iface in netns) as a non-fatal no-network case.
Fixes: urunc-dev#417

Signed-off-by: Vi-shub <smsharma3121@gmail.com>
@netlify

netlify Bot commented Jul 30, 2026

Copy link
Copy Markdown

Deploy Preview for urunc canceled.

Name Link
🔨 Latest commit 9ced346
🔍 Latest deploy log https://app.netlify.com/projects/urunc/deploys/6a6b8adf1fb8a800088648a4

@Vi-shub

Vi-shub commented Jul 30, 2026

Copy link
Copy Markdown
Author

Testing results
image

@Vi-shub

Vi-shub commented Jul 30, 2026

Copy link
Copy Markdown
Author

Hi @cmainas ,
This addresses #417 as discussed. Please take a look when you have a chance. Thankyou for your time!

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.

SetupNet silently ignores network setup failures, causing containers to run without networking

1 participant