Skip to content

net: handle %d interface names for netDevices - #2382

Closed
sairex53 wants to merge 1 commit into
containers:mainfrom
sairex53:fix/netdev-name-template
Closed

sairex53 wants to merge 1 commit into
containers:mainfrom
sairex53:fix/netdev-name-template

Conversation

@sairex53

Copy link
Copy Markdown

Fixes #2331

When netDevices.name contains %d, the kernel chooses the final interface name during rename. crun was asking the kernel to move and rename the device in one request, then looking it up by the literal template. Move it first, look it up by its original name in the target network namespace, then rename it there and continue configuring it by ifindex.

Add a regression case to the net-device test using newtest%d and verifying that newtest0 is available inside the container.

Validation on Fedora 44 aarch64:

  • make -j2 crun
  • Issue reproducer passed in a temporary rootless user/network namespace (crun exit: 0); confirmed it failed before the fix with No such device
  • make clang-format, python3 -m py_compile tests/test_devices.py, git diff --check

Move devices with a `%d` name template before renaming them in the target
network namespace. This lets the kernel expand the template and lets crun
continue configuring the interface by its index. Add a regression test.

Signed-off-by: Eduard Zateev <hackerowskiy@gmail.com>
Assisted-by: Codex GPT-6

@kolyshkin kolyshkin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

FWIW runc also has the same issue (meaning, I guess, no one uses %d interface names).

@kolyshkin

Copy link
Copy Markdown
Collaborator

Closing this PR because this account is engaged in PR farming (see moby/buildkit#7303 (comment) for details).

@sairex53 please do not contribute to this repo.

@kolyshkin kolyshkin closed this Oct 22, 2026
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.

crun fails creation when netDevices.name contains the supported %d template

2 participants