Repository navigation
tun: validate acquired Linux TUN packet formats - #142
Merged
Merged
Conversation
raggi
marked this pull request as ready for review
November 20, 2026 22:04
raggi
force-pushed
the
raggi/recover-tun-725b0470
branch
from
November 20, 2026 22:45
8f7edfc to
bdf9922
Compare
raggi
force-pushed
the
raggi/recover-tun-9c2b5db8
branch
2 times, most recently
from
November 20, 2026 23:01
b151d0d to
611c1cb
Compare
illotum
approved these changes
Nov 20, 2026
Reject embedded NULs in interface names and check the flags returned by TUNGETIFF against the requested packet format. Permit older kernels to ignore IFF_MULTI_QUEUE, but reject unexpected multiqueue mode or incompatible TUN, packet-info, or virtio-header flags. For queues using virtio headers, require the header size expected by our packet parser and native byte order. Treat unavailable byte-order ioctls as native-endian defaults for compatibility with older kernels. Keep these safety checks separate from interface acquisition and active queue accounting. Add table-driven tests for incompatible headers and queue cleanup after validation or initialization failure. Updates tailscale/tailscale#22475 Signed-off-by: James Tucker <james@tailscale.com> Change-Id: I9c2b5db868840ec2ad3b9a272598e4e388c34de4
raggi
force-pushed
the
raggi/recover-tun-9c2b5db8
branch
from
November 20, 2026 23:46
611c1cb to
1d7ef0d
Compare
Member
Author
totally fair, i split it out into some local variables for clarity |
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.
Reject embedded NULs in interface names and check the flags returned by
TUNGETIFF against the requested packet format. Permit older kernels to
ignore IFF_MULTI_QUEUE, but reject unexpected multiqueue mode or
incompatible TUN, packet-info, or virtio-header flags.
For queues using virtio headers, require the header size expected by our
packet parser and native byte order. Treat unavailable byte-order ioctls
as native-endian defaults for compatibility with older kernels.
Keep these safety checks separate from interface acquisition and active
queue accounting. Add table-driven tests for incompatible headers and
queue cleanup after validation or initialization failure.
Updates tailscale/tailscale#22475
Signed-off-by: James Tucker james@tailscale.com