An unnamed link create does not pick a free device name
- Dominant language
- Go
- Stars
- 19.3k
- Forks
- 2k
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 264
Description
RTM_NEWLINK with no IFLA_IFNAME names a veth end after its NIC id (stack.go:478, :496) and never checks the name is free. A collision fails with EEXIST and leaks a goroutine (#14514). An unnamed bridge keeps the empty name (stack.go:537), and ip link can neither show nor delete it.
lo is NIC 1 and the named pair takes 2 and 3, so the unnamed create picks veth4. Linux gives veth0, veth1 and bridge0 for these two:
```
$ sudo runsc --network=none --ignore-cgroups --platform=systrap do /bin/sh -c \
'ip link add name veth4 type veth peer name p1 && ip link add type veth'
RTNETLINK answers: File exists
```
```
$ sudo runsc --network=none --ignore-cgroups --platform=systrap do /bin/sh -c \
'ip link add type bridge && ip -o link && ip link del bridge0'
1: lo: mtu 65522 \ link/loopback 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
Cannot find device "bridge0"
```
Proposed fix in #14520.
Contributor guide
Research direction
Start in stack.go at lines 478, 496, and 537, then review the proposed fix in issue #14520. Reproduce the unnamed veth and bridge commands from the report; done means unnamed links receive usable, free names, collisions do not leak a goroutine, and the resulting bridge can be shown and deleted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, linux
- Domain
- networking, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100