We're writing a Network.framework version of our peer-to-peer video streaming implementation, and are running into issues when the UDP message size becomes large enough to cause fragmentation. When this happens, it fails to reassemble with the following error:
nw_protocol_ipv6_process_reassembly [C5.1:2] Failed to reassemble IPv6 Fragmentation ID 4293396248, dropping 1 frames
This happens both over en0 and awdl0. Any insights as to why this is happening would be greatly appreciated!
We're writing a Network.framework version of our peer-to-peer video streaming implementation …
You really want to try to avoid UDP fragmentation, especially for a video streaming app. It causes many problems:
Each extra fragment doubles the chance of the whole datagram getting lost.
Reassembling the fragments is expensive.
Network infrastructure often sends fragments via the slow path.
A better approach is to implement your own segmentation so that each of your UDP datagrams is below the path MTU. If “peer-to-peer” means “only on the local network”, you can use
nw_connection_get_maximum_datagram_size
to get the MTU. If not, you’ll have to do
path MTU discovery.
Having said that, there are specific situations where large UDP datagrams are unavoidable (for example, when dealing with IKEv2 peers that don’t support RFC 7383), so it’s clear that the Network framework should deal with this. Various folks have filed bugs about this and the problem should be fixed in the currently seeded major OS releases (r. 45766979).
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"