<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">On 12/05/2022 07.31, [EXT] Rick van
      Rein wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:20220512113129.GE32393@openfortress.nl">
      <pre class="moz-quote-pre" wrap="">Hello,

IPv6 routers never fragment packets.  Rather, they drop a packet that
is too large for a (local) MTU and send back ICMPv6 "Packet Too Big".
This seems to cause loss of larger SIP messages when an ISP tunnels
their IPv6 at the expense of the MTU.

The pmtu_discovery flag sets Don't Fragment in IPv4 traffic; in IPv6
this is an implied property.  Does Kamailio learn a lower MTU from
any "Packet Too Big" for IPv6 even if pmtu_discovery is not set?
Future resends can then be fragemented appropriately.

The udp_mtu setting diverts to another protocol, but that would be a
setting as low as the worst peer, impacting all.  It would be a weird
struggle with a telco serving many.  PMTU would be better to rely on,
but how does it work in Kamailio?
</pre>
    </blockquote>
    <p>I haven't looked at the Kamailio code either, but in general this
      is handled by the network stack directly (e.g. the Linux kernel),
      transparent to the application (Kamailio).</p>
    <ol>
      <li>The application wants to send a packet and uses the
        appropriate API (e.g. the kernel's send() system call).</li>
      <li>The kernel takes care to actually send the packet out to its
        destination.<br>
      </li>
      <li>The packet then hits an MTU barrier along its path. The packet
        is discarded by the remote router and the router sends back an
        ICMPv6 packet to the originator.</li>
      <li>The kernel receives this ICMPv6 packet and from this learns
        that the path MTU to that destination is lower. The application
        generally is not notified about this. An automatic
        retransmission also doesn't happen.<br>
      </li>
      <li>The application wants to send another packet to the same
        destination (e.g. in Kamailio's case probably a retransmission
        of the first one, as that packet was never acknowledged).</li>
      <li>The application does exactly the same thing as in step 1.</li>
      <li>The kernel now knows about the smaller PMTU to that packet's
        destination and will therefore fragment the packet appropriately
        before sending the fragments out.<br>
      </li>
    </ol>
    Cheers<br>
  </body>
</html>