-
Notifications
You must be signed in to change notification settings - Fork 447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support IP fragmentation #52
Comments
Basically. What you need is...
Broadly, how it would work is:
|
The main issue here is that |
#51 also needs a ManagedMap. |
There is now a |
After looking at RFC 815 I have some ideas. First, the buffer for each fragmented packet will have to be manually allocated (similar to defining buffers for sockets), so the number and size can be user-configured. Second, we need to check packet ID, as well as source and destination address. Something like this: struct FragmentedPacket {
assebler: Assembler,
rx_buffer: RingBuffer<'a>,
src_addr: Ipv4Address,
dst_addr: Ipv4Address,
id: u16,
// timeout?
} The interface then will have a The actual data processing would happen in ...
let mut ipv4_packet = Ipv4Packet::new_checked(eth_frame.payload())?;
let checksum_caps = self.device_capabilities.checksum.clone();
// >> here we handle fragmentation
// verify checksum before making repr (in case we need to fragment)
if checksum_caps.ipv4.rx() && !ipv4_packet.verify_checksum() { return Err(Error::Checksum) }
// contains more fragments ?
if ipv4_packet.more_frags() || ipv4_packet.frag_offset() > 0 {
// pass to the set of fragmented packets
// iter over existing IDs, either add a new fragment
// or work with an existing one
// potentially we end up with a new ipv4_packet
}
// Repr doesn't support fragmentation yet, so don't give it fragmented packets
let ipv4_repr = Ipv4Repr::parse(&ipv4_packet, &checksum_caps)?;
... Plus an appropriate feature guards. If the buffer backing fragmented packet is exhausted (too small), the packet is dropped. Thoughts? Does it look like a sane idea? |
Sounds reasonable, though I think |
Thanks. It could simply be |
IPv4 fragmentation has been implemented in #634. We still need fragmentation for IPv6. |
Does it need an special configuration to enable? I have a setup that smoltcp responses |
You need to increase the reassembly buffer size of smoltcp. You can do this using feature flags. The default buffer size is 1500 bytes. https://github.com/smoltcp-rs/smoltcp?tab=readme-ov-file#reassembly_buffer_size |
In a similar spirit, I would also like to implement support for IP fragmentation. The logic behind fragmentation is pretty straightforward, but the way to implement it less so.
So far it looks like it would need:
I think this means adding a queue to the https://github.com/m-labs/smoltcp/blob/master/src/iface/ethernet.rs
Thoughts?
The text was updated successfully, but these errors were encountered: