implement path mtu discovery.

Hi, I've like to calculate the path mtu between one of the local interfaces and a remote address.

Perhaps there's such option using native networking framework like nsurlconnection ?

Should I need to set the DF (don't fragment) bit and send to each hop in the path, or can I acquire this value from some cached storage per connection ?

thanks

You don’t need to do this to communicate with a remote peer. Our high-level APIs, like NSURLSession and Network framework, already include path MTU code.

However, if you want to do it for some other reason, it should be feasible. The standard approach is to send a large UDP packet with the DF bit set and then monitor the incoming ICMP responses. If you get a ‘was fragmented’ ICMP, you adjust the size and retry.

The only weird part about this is monitoring ICMP responses. To do that without escalating privileges you need to use an IPPROTO_ICMP socket. See the SimplePing sample code for the details.

can I acquire this value from some cached storage per connection ?

I’m not sure. What sort of connection are you talking about here?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

implement path mtu discovery.
 
 
Q