Skip to content

xdp: replace the IPv6 destination panic with a debug_assert - #15563

Merged
alexpyattaev merged 2 commits into
anza-xyz:masterfrom
latent-9:xdp-ipv6-drop-warn
Nov 5, 2026
Merged

alexpyattaev merged 2 commits into
anza-xyz:masterfrom
latent-9:xdp-ipv6-drop-warn

Conversation

@latent-9

@latent-9 latent-9 commented Sep 26, 2026 •

Copy link
Copy Markdown

Problem

The tx loop panicked on an IPv6 destination:

let mut frame = umem.reserve().unwrap();
let IpAddr::V4(dst_ip) = addr.ip() else {
    panic!("IPv6 not supported");
};

after waiting for ring space and after reserving a umem frame, killing the solTransmIO thread 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 returns None for 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 public TxPacket trait, whose dst_addrs accepts plain SocketAddrs 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 a warn! here would spam logs.

Test plan

Verified with cargo check, clippy (-D warnings) and cargo fmt --check for 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.

@alexpyattaev

Copy link
Copy Markdown

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.

@latent-9

Copy link
Copy Markdown
Author

Makes sense -- debug_assert!(false, "IPv6 destination in XDP tx loop") it is. Will update.

@latent-9

latent-9 commented Sep 28, 2026 •

Copy link
Copy Markdown
Author

Pushed the update, the panic is now debug_assert!(false, "IPv6 destination in XDP tx loop"), checked before waiting for ring space or reserving a frame so the release-mode drop is clean. Let me know if anything else needs changing.

@alexpyattaev alexpyattaev added the CI Pull Request is ready to enter CI label Sep 29, 2026
@anza-team anza-team removed the CI Pull Request is ready to enter CI label Sep 29, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.4%. Comparing base (a748ed1) to head (1c5d399).
⚠️ Report is 84 commits behind head on master.

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread xdp/src/tx_loop.rs Resolved
@latent-9

latent-9 commented Sep 30, 2026 •

Copy link
Copy Markdown
Author

Moved the IPv6 comment into the run function's doc comment the code is unchanged. Pushed in 01363c8.

@latent-9

Copy link
Copy Markdown
Author

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.

@alexpyattaev
alexpyattaev self-requested a review October 14, 2026 09:54
@alexpyattaev alexpyattaev added the CI Pull Request is ready to enter CI label Nov 4, 2026
@github-actions github-actions Bot removed the CI Pull Request is ready to enter CI label Nov 4, 2026
latent-9 added 2 commits November 4, 2026 21:06
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.
@alexpyattaev alexpyattaev added the CI Pull Request is ready to enter CI label Nov 4, 2026
@github-actions github-actions Bot removed the CI Pull Request is ready to enter CI label Nov 4, 2026
@alexpyattaev alexpyattaev added the CI Pull Request is ready to enter CI label Nov 4, 2026
@github-actions github-actions Bot removed the CI Pull Request is ready to enter CI label Nov 4, 2026

@alexpyattaev alexpyattaev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@alexpyattaev
alexpyattaev added this pull request to the merge queue Nov 5, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Nov 5, 2026
@alexpyattaev
alexpyattaev added this pull request to the merge queue Nov 5, 2026
Merged via the queue into anza-xyz:master with commit f073c57 Nov 5, 2026
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants