Reputation: 7380
I am developing a protocol over UDP to be used in a local network, there will be only a switch (cisco, 3com, etc) between source and destination, both Linux systems, same MTU. How often should I expect udp packets to be duplicated (obviously not by me but by the switch or maybe the server) at the destination in this case? I need this to know if to implement a duplication check in my code or not.
Upvotes: 8
Views: 16833
Reputation: 19
I am actually suffering some issues on an application since I haven't implemented checks to avoid duplicated packets.
Adding a simple increment check wouldn't work as expected sometimes. Why? Routers can change the inbound/outbound routes for UDP packets easily even in real time, wich can cause a delay in some packets. This can cause the next scenario:
So, instead I am betting in same-same-but-different mechanism:
Hopefully this will help you avoid duplicated packets completely. It doesn't matter if your protocol it's un/encrypted, the random values will help you to get unique checksums (hopefully you won't have a checksum collision in the last N packets).
Upvotes: 0
Reputation: 434
From memory of a story I've read ~20 years ago...
There was a faulty router that duplicated UDP packets. Long story short it was found that some interrupt was raised excessively frequently. That caused the following scenario:
Upvotes: 3
Reputation: 1114
Switches will send packets to all interfaces when using broadcasts or under extreme conditions (full MAC Address Table). This can lead to duplication if there is a loop between two or more switches and if the Spanning Tree Protocol is not used. So the answer is rarely.
Upvotes: 10
Reputation: 1972
The possibility to receive duplicate UDP packets in destination host depends on number of destination interfaces that receives the packet from the source host. The destination will receive three duplicate UDP packets if three of its interfaces(eth1, eth2, eth_int) can fetch the packets from source at same time.
Upvotes: 0