I'm running Debian. If I use Python's scapy module to formulate a UDP packet, and add a payload bigger than about 1500 bytes, my program crashes, even though the maximum payload of UDP is supposed to be 65,507 bytes.
Is there some Linux setting that prevents me from creating a large UDP packet? Can I adjust the setting?
Edit: I'm creating packets in a loop in Python, and I'm racing against the clock. The program is a traffic generator that is meant to generate traffic at a set limit (ex: 500 packets per second). If it's set for 500 packets per second for example, it only has one second to generate 500 packets, because in the next second, it will have another 500 packets to generate, so it can't fall behind.
Right now, I'm hitting a limit of about 400 packets per second before it can't keep up. There are a few solutions to this in theory:
- Use multithreading - something I plan to look into
- Create bigger UDP packets, resulting in less overhead
- What I'm looking into now
Yes, if I make UDP packets with a payload bigger than 1500 bytes, they will be fragmented. From what I understand, the Kernel will handle that. What I'm hoping for is that the kernel, written in C, can fragment a single, large UDP packet into multiple packets and send them out faster than my Python can generate multiple smaller packets. I'm not sure if this is true or not, but it's very easy to test, assuming I can tell the kernel to stop dropping my large UDP packets and actually fragment them and send them out.