From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752418AbcGARQO (ORCPT ); Fri, 1 Jul 2016 13:16:14 -0400 Received: from g9t1613g.houston.hpe.com ([15.241.32.99]:39987 "EHLO g9t1613g.houston.hpe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752152AbcGARQN (ORCPT ); Fri, 1 Jul 2016 13:16:13 -0400 Subject: Re: strange Mac OSX RST behavior To: Jason Baron , linux-kernel@vger.kernel.org, netdev@vger.kernel.org References: <1467385815-6357-1-git-send-email-jbaron@akamai.com> Cc: davem@davemloft.net, eric.dumazet@gmail.com From: Rick Jones Message-ID: <5776A3A4.8000503@hpe.com> Date: Fri, 1 Jul 2016 10:08:52 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <1467385815-6357-1-git-send-email-jbaron@akamai.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/01/2016 08:10 AM, Jason Baron wrote: > I'm wondering if anybody else has run into this... > > On Mac OSX 10.11.5 (latest version), we have found that when tcp > connections are abruptly terminated (via ^C), a FIN is sent followed > by an RST packet. That just seems, well, silly. If the client application wants to use abortive close (sigh..) it should do so, there shouldn't be this little-bit-pregnant, correct close initiation (FIN) followed by a RST. > The RST is sent with the same sequence number as the > FIN, and thus dropped since the stack only accepts RST packets matching > rcv_nxt (RFC 5961). This could also be resolved if Mac OSX replied with > an RST on the closed socket, but it appears that it does not. > > The workaround here is then to reset the connection, if the RST is > is equal to rcv_nxt - 1, if we have already received a FIN. > > The RST attack surface is limited b/c we only accept the RST after we've > accepted a FIN and have not previously sent a FIN and received back the > corresponding ACK. In other words RST is only accepted in the tcp > states: TCP_CLOSE_WAIT, TCP_LAST_ACK, and TCP_CLOSING. > > I'm interested if anybody else has run into this issue. Its problematic > since it takes up server resources for sockets sitting in TCP_CLOSE_WAIT. Isn't the server application expected to act on the read return of zero (which is supposed to be) triggered by the receipt of the FIN segment? rick jones > We are also in the process of contacting Apple to see what can be done > here...workaround patch is below.