fix(cli): forkd doctor no longer warns on idle TAP (admin-UP + no peer)#155
Merged
Conversation
… peer) The tap device check was reading only /sys/class/net/<dev>/operstate. For a TUN/TAP device the natural idle state is admin-UP + operstate= DOWN (NO-CARRIER) — operstate only flips to up/unknown when a peer attaches (firecracker process). The check now also reads /sys/class/net/<dev>/flags and treats IFF_UP set + any operstate as PASS. False-warns on a freshly-set-up host with no live sandbox go away. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The tap-device check was reading only `/sys/class/net//operstate`. For a TUN/TAP device the natural idle state is admin-UP + operstate=DOWN (NO-CARRIER) — operstate only flips to up/unknown when a peer attaches (a firecracker process). On a properly-configured host with no live sandbox, doctor was emitting a false WARN.
Before
```
⚠ tap device forkd-tap0 (down)
→ sudo ip link set forkd-tap0 up — or rerun scripts/host-tap.sh
```
After
```
✓ tap device forkd-tap0 (admin-UP, idle)
```
When a sandbox IS live and a peer is attached:
```
✓ tap device forkd-tap0 (up, peer attached)
```
Implementation
Also read `/sys/class/net//flags` and check bit 0 (`IFF_UP`). If admin says UP, PASS regardless of operstate. The check still FAILs if the device doesn't exist and WARNs if it exists but admin is DOWN.
Why now
About to use the doctor output in a Show HN launch screenshot — the false-warn made the "14 checks all pass" claim a lie on the cold dev box. Worth fixing for actual users too.
🤖 Generated with Claude Code