You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The maximum theoretic UDP payload size is 65,507: 65,535 (2^16 - 1) - 20 (ip header) - 8 (udp header). In practice Linux should limit the size of a message sent by userspace so that it fits within the MTU for the egress interface, and return EMSGSIZE if the packet wouldn't fit within the MTU (even if IP fragmentation is supported).
Shadow currently uses the 65,507 byte message limit and ignores the MTU. This means that 65,535 byte UDP packets can be sent over Shadow's network interface and they aren't fragmented since Shadow doesn't support IP fragmentation.
A fix wouldn't be as straightforward as simply limiting sendmsg calls to 1500 - 20 - 8 bytes though. While currently both the eth0 and loopback interfaces in Shadow use an MTU of 1500, on Linux loopback uses an MTU of 65,536 (see #3200). We also have integration tests that check if we can send a ~65,000 bytes UDP message over loopback. If we wanted to properly support the MTU, we'd need to get the MTU for the interface that the message would be sent over. For example an unbound UDP socket can send messages to both external addresses and a localhost address. I don't know what Linux does, but I'm guessing it uses the routing table to figure out what interface the message would be sent on, and then looks up the MTU of that interface before deciding if it should return EMSGSIZE or not. In Shadow, sometimes loopback packets are sent over the Internet interface, so it gets a bit complicated if the two interfaces have different MTUs.
The text was updated successfully, but these errors were encountered:
The maximum theoretic UDP payload size is 65,507: 65,535 (2^16 - 1) - 20 (ip header) - 8 (udp header). In practice Linux should limit the size of a message sent by userspace so that it fits within the MTU for the egress interface, and return
EMSGSIZE
if the packet wouldn't fit within the MTU (even if IP fragmentation is supported).Shadow currently uses the 65,507 byte message limit and ignores the MTU. This means that 65,535 byte UDP packets can be sent over Shadow's network interface and they aren't fragmented since Shadow doesn't support IP fragmentation.
A fix wouldn't be as straightforward as simply limiting sendmsg calls to 1500 - 20 - 8 bytes though. While currently both the eth0 and loopback interfaces in Shadow use an MTU of 1500, on Linux loopback uses an MTU of 65,536 (see #3200). We also have integration tests that check if we can send a ~65,000 bytes UDP message over loopback. If we wanted to properly support the MTU, we'd need to get the MTU for the interface that the message would be sent over. For example an unbound UDP socket can send messages to both external addresses and a localhost address. I don't know what Linux does, but I'm guessing it uses the routing table to figure out what interface the message would be sent on, and then looks up the MTU of that interface before deciding if it should return
EMSGSIZE
or not. In Shadow, sometimes loopback packets are sent over the Internet interface, so it gets a bit complicated if the two interfaces have different MTUs.The text was updated successfully, but these errors were encountered: