Repository navigation
xdp: replace the IPv6 destination panic with a debug_assert - #15563
Conversation
|
This code should never handle ipv6 in XDP (as solana does not have a use-case for it). Agree that panic may be a bit too extreme of a response, could probably be a debug_assert!. warn! is definitely a non-starter there though, as it would spam logs. |
|
Makes sense -- debug_assert!(false, "IPv6 destination in XDP tx loop") it is. Will update. |
|
Pushed the update, the panic is now |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #15563 +/- ##
=========================================
- Coverage 82.4% 82.4% -0.1%
=========================================
Files 936 936
Lines 372276 372277 +1
=========================================
- Hits 307042 307000 -42
- Misses 65234 65277 +43 🚀 New features to boost your workflow:
|
|
Moved the IPv6 comment into the |
|
Checking in on this one: is the debug_assert approach still the direction you want for IPv6 destinations, or has anything changed in the XDP plans since? Happy to rebase or adjust if needed. |
The tx loop panicked on an IPv6 destination, after waiting for ring space and after reserving a umem frame, killing the solTransmIO thread and leaking the frame. Every sibling drop path in the same loop (no route, no neighbor MAC, MTU, frame size) logs a warning, releases the frame and continues, which is also the only possible behavior here: the packet is written as IPv4, so an IPv6 destination cannot be sent. Check the destination before waiting for ring space or reserving a frame, and drop with a warning like the siblings. The route lookup already returns None for IPv6 destinations, so the no-route path would have handled this gracefully if the check had not panicked first.
01363c8 to
6af5a17
Compare
Problem
The tx loop panicked on an IPv6 destination:
after waiting for ring space and after reserving a umem frame, killing the
solTransmIOthread and leaking the reserved frame. The packet is written as IPv4, so an IPv6 destination cannot be sent, and the route lookup (xdp/src/transmitter.rs) already returnsNonefor IPv6 destinations, so the no-route path would have handled this gracefully if the check had not panicked first. The panic is reachable through the publicTxPackettrait, whosedst_addrsaccepts plainSocketAddrs with no IPv4-only constraint documented.Change
Check the destination before waiting for ring space or reserving a frame, and turn the panic into
debug_assert!(false, "IPv6 destination in XDP tx loop")per review feedback: debug builds panic, release builds drop the packet silently instead of logging, since awarn!here would spam logs.Test plan
Verified with
cargo check, clippy (-D warnings) andcargo fmt --checkfor the Linux target with--features agave-unstable-api. The tx loop itself has no in-repo test harness (it needs AF_XDP), which is why this ships without a dedicated test.