From: serassio <> Date: Wed, 9 Feb 2005 20:01:40 +0000 (+0000) Subject: Bug #1154: Disable Path-MTU discovery on intercepted requests X-Git-Tag: SQUID_3_0_PRE4~871 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5529ca8a08bb6c0ebe55ed26589ac3e8d6d1fd6c;p=thirdparty%2Fsquid.git Bug #1154: Disable Path-MTU discovery on intercepted requests 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. --- diff --git a/src/cache_cf.cc b/src/cache_cf.cc index a0b1d67a89..600725fbf4 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -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 diff --git a/src/cf.data.pre b/src/cf.data.pre index ded863ba7d..8c27869862 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -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 diff --git a/src/client_side.cc b/src/client_side.cc index b2f78b118b..2844333ddd 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -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; } diff --git a/src/enums.h b/src/enums.h index 3bb386969f..b19f5532ae 100644 --- a/src/enums.h +++ b/src/enums.h @@ -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 */ diff --git a/src/structs.h b/src/structs.h index f1b4752bfe..652f050c52 100644 --- a/src/structs.h +++ b/src/structs.h @@ -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; };