Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You do it with the <code>setsockopt()</code> call, by using the <code>IP_DONTFRAG</code> option::</p> <pre><code>int val = 1; setsockopt(sd, IPPROTO_IP, IP_DONTFRAG, &amp;val, sizeof(val)); </code></pre> <p><a href="http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/apis/ssocko.htm" rel="noreferrer">Here's</a> a page explaining this in further detail.</p> <p>For Linux, it appears you have to use the <code>IP_MTU_DISCOVER</code> option with the value <code>IP_PMTUDISC_DO</code> (or <code>IP_PMTUDISC_DONT</code> to turn it off):</p> <pre><code>int val = IP_PMTUDISC_DO; setsockopt(sd, IPPROTO_IP, IP_MTU_DISCOVER, &amp;val, sizeof(val)); </code></pre> <p>I haven't tested this, just looked in the header files and a bit of a web search so you'll need to test it.</p> <p>As to whether there's another way the DF flag could be set:</p> <blockquote> <p>I find nowhere in my program where the "force DF flag" is set, yet <code>tcpdump</code> suggests it is. Is there any other way this could get set?</p> </blockquote> <p>From this excellent page <a href="http://linux.die.net/man/7/ip" rel="noreferrer">here</a>:</p> <blockquote> <p><code>IP_MTU_DISCOVER:</code> Sets or receives the Path MTU Discovery setting for a socket. When enabled, Linux will perform Path MTU Discovery as defined in RFC 1191 on this socket. The don't fragment flag is set on all outgoing datagrams. The system-wide default is controlled by the <code>ip_no_pmtu_disc</code> <code>sysctl</code> for <code>SOCK_STREAM</code> sockets, and disabled on all others. For non <code>SOCK_STREAM</code> sockets it is the user's responsibility to packetize the data in MTU sized chunks and to do the retransmits if necessary. The kernel will reject packets that are bigger than the known path MTU if this flag is set (with <code>EMSGSIZE</code>). </p> </blockquote> <p>This looks to me like you can set the system-wide default using <code>sysctl</code>:</p> <pre><code>sysctl ip_no_pmtu_disc </code></pre> <p>returns <code>"error: "ip_no_pmtu_disc" is an unknown key"</code> on my system but it may be set on yours. Other than that, I'm not aware of anything else (other than <code>setsockopt()</code> as previously mentioned) that can affect the setting.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload