]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #1154: Disable Path-MTU discovery on intercepted requests
authorserassio <>
Wed, 9 Feb 2005 20:01:40 +0000 (20:01 +0000)
committerserassio <>
Wed, 9 Feb 2005 20:01:40 +0000 (20:01 +0000)
This patch adds a disable-pmtu-discovery option to http_port directive
allowing one to disable Path-MTU discovery on accelerated requests.

Based on 2.5 patch.

src/cache_cf.cc
src/cf.data.pre
src/client_side.cc
src/enums.h
src/structs.h

index a0b1d67a89266ce1d7e38d185a0303c6c71fab96..600725fbf46b082a5cc3107243f19c3c5527760d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cache_cf.cc,v 1.462 2005/01/03 16:08:25 robertc Exp $
+ * $Id: cache_cf.cc,v 1.463 2005/02/09 13:01:40 serassio Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
@@ -2639,6 +2639,8 @@ parse_http_port_specification(http_port_list * s, char *token)
     unsigned short port = 0;
     char *t;
 
+    s->disable_pmtu_discovery = DISABLE_PMTU_OFF;
+
     if ((t = strchr(token, ':'))) {
         /* host:port */
         host = token;
@@ -2693,6 +2695,15 @@ parse_http_port_option(http_port_list * s, char *token)
         s->accel = 1;
     } else if (strcmp(token, "accel") == 0) {
         s->accel = 1;
+    } else if (strncmp(token, "disable-pmtu-discovery=", 23) == 0) {
+        if (!strcasecmp(token + 23, "off"))
+            s->disable_pmtu_discovery = DISABLE_PMTU_OFF;
+        else if (!strcasecmp(token + 23, "transparent"))
+            s->disable_pmtu_discovery = DISABLE_PMTU_TRANSPARENT;
+        else if (!strcasecmp(token + 23, "always"))
+            s->disable_pmtu_discovery = DISABLE_PMTU_ALWAYS;
+        else
+            self_destruct();
     } else {
         self_destruct();
     }
@@ -2773,6 +2784,17 @@ dump_generic_http_port(StoreEntry * e, const char *n, const http_port_list * s)
 
     if (s->vport)
         storeAppendPrintf(e, " vport");
+
+    if (s->disable_pmtu_discovery != DISABLE_PMTU_OFF) {
+        const char *pmtu;
+
+        if (s->disable_pmtu_discovery == DISABLE_PMTU_ALWAYS)
+            pmtu = "always";
+        else
+            pmtu = "transparent";
+
+        storeAppendPrintf(e, " disable-pmtu-discovery=%s", pmtu);
+    }
 }
 
 static void
index ded863ba7d79b87cd6298b1550b23ad046ad57e4..8c27869862e36bc97ce2a4d9b8316d5399bfc554 100644 (file)
@@ -1,6 +1,6 @@
 
 #
-# $Id: cf.data.pre,v 1.373 2005/01/29 19:41:22 serassio Exp $
+# $Id: cf.data.pre,v 1.374 2005/02/09 13:01:40 serassio Exp $
 #
 #
 # SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -100,6 +100,21 @@ DOC_START
           protocol=    Protocol to reconstruct accelerated requests with.
                        Defaults to http
 
+          disable-pmtu-discovery=
+                        Control Path-MTU discovery usage:
+                            off         lets OS decide on what to do (default).
+                            transparent disable PMTU discovery when transparent
+                                        support is enabled.
+                            always      disable always PMTU discovery.
+
+       In many setups of transparently intercepting proxies Path-MTU
+       discovery can not work on traffic towards the clients. This is
+       the case when the intercepting device does not fully track
+       connections and fails to forward ICMP must fragment messages
+       to the cache server. If you have such setup and experience that
+       certain clients sporadically hang or never complete requests set
+       disable-pmtu-discovery option to 'transparent'.
+
        If you run Squid on a dual-homed machine with an internal
        and an external interface we recommend you to specify the
        internal address:port in http_port. This way Squid will only be
index b2f78b118bab01edf2ba815c731cc911dd712b2d..2844333ddd5020da2e8ce8185468d8979e503b67 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.679 2005/01/23 11:32:42 serassio Exp $
+ * $Id: client_side.cc,v 1.680 2005/02/09 13:01:40 serassio Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -2805,6 +2805,26 @@ connStateCreate(struct sockaddr_in *peer, struct sockaddr_in *me, int fd, http_p
         }
     }
 
+    if (port->disable_pmtu_discovery != DISABLE_PMTU_OFF &&
+            (result->transparent() || port->disable_pmtu_discovery == DISABLE_PMTU_ALWAYS))
+    {
+#if defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DONT)
+        int i = IP_PMTUDISC_DONT;
+        setsockopt(fd, SOL_IP, IP_MTU_DISCOVER, &i, sizeof i);
+
+#else
+
+        static int reported = 0;
+
+        if (!reported) {
+            debug(33, 1) ("Notice: httpd_accel_no_pmtu_disc not supported on your platform\n");
+            reported = 1;
+        }
+
+#endif
+
+    }
+
     result->flags.readMoreRequests = 1;
     return result;
 }
index 3bb386969f74ce27e7718e5d810d3e8e82a4424f..b19f5532ae5df927c1ecf5609495584edcea4d02 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: enums.h,v 1.239 2004/12/21 17:52:53 robertc Exp $
+ * $Id: enums.h,v 1.240 2005/02/09 13:01:40 serassio Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -738,4 +738,10 @@ typedef enum {
     CLF_NONE
 } customlog_type;
 
+enum {
+    DISABLE_PMTU_OFF,
+    DISABLE_PMTU_ALWAYS,
+    DISABLE_PMTU_TRANSPARENT
+};
+
 #endif /* SQUID_ENUMS_H */
index f1b4752bfedfb3074dbd2a9603e2ea5e785aa477..652f050c523085ea99288b83c6e3f5fe2e9c70f9 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.507 2005/01/08 22:50:45 hno Exp $
+ * $Id: structs.h,v 1.508 2005/02/09 13:01:40 serassio Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -180,6 +180,7 @@ unsigned int vhost:
     1; /* uses host header */
 
     int vport;                 /* virtual port support, -1 for dynamic, >0 static*/
+    int disable_pmtu_discovery;
 };