netfrag: Limiting tcp/ip packets size

A few days ago I hit an awful bug in the iOS’s TCPI/IP stack which drove me crazy for a while since everything worked fine on other devices except a brand new iPad.

The problem appears when UDP packet’s payload is larger than 9200 bytes; Beyond this limit the app will always read 9216 Bytes, losing the rest of the data.

I need large UDP packages since I am working on a Real-Time video transmission protocol which need as little latency as possible < 100ms and quality must be acceptable. I need large UDP packets in both side, specially in the producing device, since otherwise latency will increase due to network stack overload. Other guys have also complained about the same issue after iOS 6 upgrade broke theirs VPN/IPSec app. As a workaround I have created a tool which acts as a proxy limiting the max size of packets and generating extra ones when required. You can find it here:

The intended use is the following:

$ netfrag --src-udp 3333 --to-udp 3434 9100
  • Listen in a local port 333 (UDP/TCP selectable)
  • Connects to the remote port (TCP/UDP: connects means connect())
  • Read input data as much as the desired amount: 9100 Bytes in this case, and send to destination