From owner-svn-src-all@FreeBSD.ORG Sun Aug 15 13:25:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58141106574F; Sun, 15 Aug 2010 13:25:19 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2D6FC8FC14; Sun, 15 Aug 2010 13:25:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7FDPJWY061616; Sun, 15 Aug 2010 13:25:19 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7FDPJfE061613; Sun, 15 Aug 2010 13:25:19 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201008151325.o7FDPJfE061613@svn.freebsd.org> From: Andre Oppermann Date: Sun, 15 Aug 2010 13:25:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211333 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Aug 2010 13:25:19 -0000 Author: andre Date: Sun Aug 15 13:25:18 2010 New Revision: 211333 URL: http://svn.freebsd.org/changeset/base/211333 Log: Fix the interaction between 'ICMP fragmentation needed' MTU updates, path MTU discovery and the tcp_minmss limiter for very small MTU's. When the MTU suggested by the gateway via ICMP, or if there isn't any the next smaller step from ip_next_mtu(), is lower than the floor enforced by net.inet.tcp.minmss (default 216) the value is ignored and the default MSS (512) is used instead. However the DF flag in the IP header is still set in tcp_output() preventing fragmentation by the gateway. Fix this by using tcp_minmss as the MSS and clear the DF flag if the suggested MTU is too low. This turns off path MTU dissovery for the remainder of the session and allows fragmentation to be done by the gateway. Only MTU's smaller than 256 are affected. The smallest official MTU specified is for AX.25 packet radio at 256 octets. PR: kern/146628 Tested by: Matthew Luckie MFC after: 1 week Modified: head/sys/netinet/tcp_output.c head/sys/netinet/tcp_subr.c Modified: head/sys/netinet/tcp_output.c ============================================================================== --- head/sys/netinet/tcp_output.c Sun Aug 15 13:07:08 2010 (r211332) +++ head/sys/netinet/tcp_output.c Sun Aug 15 13:25:18 2010 (r211333) @@ -1186,8 +1186,10 @@ timer: * This might not be the best thing to do according to RFC3390 * Section 2. However the tcp hostcache migitates the problem * so it affects only the first tcp connection with a host. + * + * NB: Don't set DF on small MTU/MSS to have a safe fallback. */ - if (V_path_mtu_discovery) + if (V_path_mtu_discovery && tp->t_maxopd > V_tcp_minmss) ip->ip_off |= IP_DF; error = ip_output(m, tp->t_inpcb->inp_options, NULL, Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Sun Aug 15 13:07:08 2010 (r211332) +++ head/sys/netinet/tcp_subr.c Sun Aug 15 13:25:18 2010 (r211333) @@ -1339,11 +1339,9 @@ tcp_ctlinput(int cmd, struct sockaddr *s if (!mtu) mtu = ip_next_mtu(ip->ip_len, 1); - if (mtu < max(296, V_tcp_minmss - + sizeof(struct tcpiphdr))) - mtu = 0; - if (!mtu) - mtu = V_tcp_mssdflt + if (mtu < V_tcp_minmss + + sizeof(struct tcpiphdr)) + mtu = V_tcp_minmss + sizeof(struct tcpiphdr); /* * Only cache the the MTU if it