Where is the Don't Fragment Bit of the IP Flags used?

前端 未结 3 2095
醉梦人生
醉梦人生 2021-02-08 16:07

I am curious to know where the \"Don\'t Fragment\" [DF] Bit of the IP Flags is used. As fragmentation is invisible to higher layers and they don\'t care too.

I am also l

3条回答
  •  萌比男神i
    2021-02-08 16:39

    Do note that there is no standard way to set DF in C. On Linux, this code works:

    result = setsockopt(mysocket, IPPROTO_IP, 
                    IP_MTU_DISCOVER, IP_PMTUDISC_DO, sizeof(int));
    

    but it does not on FreeBSD 6

    Also, Path MTU discovery is extremely unreliable on the real Internet. Too many broken firewalls and middleboxes filter out ICMP "Packet too big" messages (here is a good way to test a candidate network administrator during an interview: ask him/her to stop ping and he/she will probably block completely ICMP.) See RFC 2923: "TCP Problems with Path MTU Discovery"

    That's the reason why the IETF now suggest a new way to test the MTU, without relying on Path MTU Discovery: RFC 4821: "Packetization Layer Path MTU Discovery"

提交回复
热议问题