Support for cloning packets whose underlying data is a B: ByteSlice
.
#1599
Labels
customer-request
Documents customer requests.
B: ByteSlice
.
#1599
What is the name of your project?
Fuchsia netstack3
Please provide a link to your project (GitHub repository, crates.io page, etc).
https://cs.opensource.google/fuchsia/fuchsia/+/main:src/connectivity/network/netstack3/
What features would you like from zerocopy?
Netstack3 uses the packet-formats crate for parsing of various packet types, including IP Packets. For example,
Ipv4Packet<B: Byteslice>
, is a known-to-be-valid IPv4 packet backed by an underlying byte slice. There are instances in Netstack3 where an IP packet must be multiplexed, such as supporting multicast routing, where a received IP packet may need to be forwarded out of multiple interfaces. Each send needs the ability to mutate the packet (E.g. for things like Network Address Translation), so I'd like each send to get their own unique copy of the original packet.I can do this today with something similar to:
However, the parse on the final line is wasted work: we already know the bytes encompass a valid
Ipv4Packet
. I'd like to be able to clone the underlying data and construct a newIpv4Packet
that simply adopts the new data as assumed to be valid.The text was updated successfully, but these errors were encountered: