Skip to content

ts_packet: support yoke#235

Open
npry wants to merge 1 commit into
mainfrom
npry/packet.yoke
Open

ts_packet: support yoke#235
npry wants to merge 1 commit into
mainfrom
npry/packet.yoke

Conversation

@npry

@npry npry commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Add support for yoke to Packet{,Mut}. This enables e.g. a decrypted derp packet to carry its backing Packet around when published on the runtime bus (since it's !Sized).

Base automatically changed from npry/netmon to main June 13, 2026 10:30
@npry npry force-pushed the npry/packet.yoke branch from 244f61b to 7cf443b Compare June 13, 2026 10:34
Comment thread ts_packet/src/lib.rs
}

// SAFETY: the underlying buf ptr is on the heap, hence stable.
unsafe impl stable_deref_trait::StableDeref for PacketMut {}

@nrc nrc Jun 15, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I spent far too long thinking about this. I think in the end it is ok. My worry was about calling split_to which would mean calls to deref would return different pointers, but I don't see any of calling split_to without using an &mut self method. It might be worth documenting that, since if the Deref impls were changed to return a Bytes rather than a [u8], then this would be unsound

This will enable e.g. a decrypted derp packet to carry its backing
`Packet` around.

Signed-off-by: Nathan Perry <nathan@tailscale.com>
Change-Id: Ic26833761832d03d372d4331723d422d6a6a6964
@npry npry force-pushed the npry/packet.yoke branch from 7cf443b to 5605c14 Compare June 15, 2026 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants