Updated the resetting of the Don't Fragment bit
authorRick van Rein <rick@openfortress.nl>
Fri, 12 Jan 2018 15:34:32 +0000 (16:34 +0100)
committerRick van Rein <rick@openfortress.nl>
Fri, 12 Jan 2018 15:34:32 +0000 (16:34 +0100)
IPv6 frames MUST support 1280 bytes at least, but IPv4 frames
MAY be much smaller.  This is theoretical, but as a result, a
tunnel NEEDS to support fragmentation.

6bed4peer.c

index ab7ec4e..66fee24 100644 (file)
@@ -1852,10 +1852,15 @@ int main (int argc, char *argv []) {
        // Setup fragmentation, QoS and TTL options
        u_int yes = 1;
        u_int no = 0;
-#ifdef IP_DONTFRAG
+#if defined(IP_DONTFRAG)
        if (setsockopt (v4sox, IPPROTO_IP, IP_DONTFRAG, no, sizeof (no)) == -1) {
                syslog (LOG_ERR, "Failed to permit fragmentation -- not all peers may be accessible with MTU 1280");
        }
+#elif defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DONT)
+       int pmtuflag = IP_PMTUDISC_DONT;
+       if (setsockopt (v4sox, IP_MTU_DISCOVER, IP_MTU_DISCOVER, &pmtuflag, sizeof (pmtuflag)) == -1) {
+               syslog (LOG_ERR, "Failed to permit fragmentation -- not all peers may be accessible with MTU 1280");
+       }
 #else
 #warning "Target system lacks support for controlling packet fragmentation"
 #endif