Skip to content

fix(network): allow inspecting pseudo networks#4953

Open
immanuwell wants to merge 1 commit into
containerd:mainfrom
immanuwell:fix-network-inspect-pseudo-networks
Open

fix(network): allow inspecting pseudo networks#4953
immanuwell wants to merge 1 commit into
containerd:mainfrom
immanuwell:fix-network-inspect-pseudo-networks

Conversation

@immanuwell

@immanuwell immanuwell commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

refs #3005

nerdctl network ls shows host and none, but nerdctl network inspect host and nerdctl network inspect none still fail. the inspect path asks to allow pseudo networks, but lookup only checked on-disk CNI configs, so these names fell through. kinda awkward.

this returns a small synthetic config for pseudo networks in that lookup path, so inspect can render them fine.

repro:

  1. run nerdctl network ls
  2. see host and none
  3. run nerdctl network inspect host
  4. before: fails with no network found matching: host
  5. after: returns JSON with "Name": "host"

checks:

  • go test ./pkg/netutil -count=1
  • go test ./pkg/inspecttypes/dockercompat -count=1
  • go test ./cmd/nerdctl/network -run ^ -count=1

Signed-off-by: immanuwell <pchpr.00@list.ru>
Comment thread pkg/netutil/netutil.go
list = make(map[string][]*NetworkConfig)
for _, req := range reqs {
if !allowPseudoNetwork && (req == "host" || req == "none") {
if !allowPseudoNetwork && isPseudoNetwork(req) {

@sathiraumesh sathiraumesh Jun 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably can do in a cleaner way i beleive and remove extra function declration and two calls

if name == "host" || name == "none" {
  if !allowPseudoNetwork {
        errs = append(errs, fmt.Errorf("pseudo network not allowed: %s", req))
        continue
    }
    cfg, err := newPseudoNetworkConfig(req)
    if err != nil {
        errs = append(errs, err)
        continue
    }
    list[req] = []*NetworkConfig{cfg}
    continue
}

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.

2 participants