Skip to content
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

Do we need to consider the issue of IP packet reassembly #9

Closed
vnt-dev opened this issue Jun 9, 2024 · 3 comments
Closed

Do we need to consider the issue of IP packet reassembly #9

vnt-dev opened this issue Jun 9, 2024 · 3 comments

Comments

@vnt-dev
Copy link

vnt-dev commented Jun 9, 2024

let packet = match UdpPacket::new_checked(packet.payload()) {

@cavivie
Copy link
Collaborator

cavivie commented Jun 9, 2024

I don't know what you mean. Does it mean to use udp to process data with smoltcp?

@vnt-dev
Copy link
Author

vnt-dev commented Jun 9, 2024

The code for processing UDP packets in netstack-smoltcp directly converts IP payloads into UDP packets without considering the problem of IP packet segmentation.I'm not sure if this is correct, I hope you can answer it, thank you

@cavivie
Copy link
Collaborator

cavivie commented Jun 9, 2024

IP datagram > 1500 bytes (i.e. > MTU): At this time, the sender's IP layer needs to be fragmented, dividing the datagram into several pieces, so that each piece is less than MTU, while the recipient's IP layer needs to reorganize the datagram, which will do a lot more. What's more serious is due to the characteristics of UDP. When a piece of data transmission is lost, it is convenient to reorganize the datagram, which will lead to the disposal of the entire UDP datagram.

Since this crate was originally designed to integrate with the tun device, the mtu setting of the tun device should be less than or equal to 1500 as much as possible. If it is used for other purposes, we may also need to consider the problems you mentioned. The best way is to use smoltcp to process udp packets instead of directly processing udp packets like tcp. I hope this can help you.

@cavivie cavivie closed this as completed Dec 20, 2024
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

No branches or pull requests

2 participants