From owner-svn-src-head@freebsd.org Sat Nov 21 16:25:10 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2CC2A33481; Sat, 21 Nov 2015 16:25:10 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DF1A1507; Sat, 21 Nov 2015 16:25:10 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tALGP9GP090140; Sat, 21 Nov 2015 16:25:09 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tALGP9vJ090138; Sat, 21 Nov 2015 16:25:09 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201511211625.tALGP9vJ090138@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 21 Nov 2015 16:25:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r291137 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Nov 2015 16:25:10 -0000 Author: tuexen Date: Sat Nov 21 16:25:09 2015 New Revision: 291137 URL: https://svnweb.freebsd.org/changeset/base/291137 Log: Don't send SHUTDOWN chunk when the association is in a front state and the applications calls shutdown(..., SHUT_WR) or shutdown(..., SHUT_RDWR). MFC after: 1 week. Modified: head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Sat Nov 21 16:25:03 2015 (r291136) +++ head/sys/netinet/sctp_pcb.c Sat Nov 21 16:25:09 2015 (r291137) @@ -3640,13 +3640,11 @@ sctp_inpcb_free(struct sctp_inpcb *inp, * macro here since le_next will get freed as part of the * sctp_free_assoc() call. */ - if (so) { #ifdef IPSEC + if (ip_pcb->inp_sp != NULL) { ipsec_delete_pcbpolicy(ip_pcb); -#endif /* IPSEC */ - - /* Unlocks not needed since the socket is gone now */ } +#endif if (ip_pcb->inp_options) { (void)sctp_m_free(ip_pcb->inp_options); ip_pcb->inp_options = 0; Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Sat Nov 21 16:25:03 2015 (r291136) +++ head/sys/netinet/sctp_usrreq.c Sat Nov 21 16:25:09 2015 (r291137) @@ -1007,16 +1007,15 @@ sctp_shutdown(struct socket *so) } else { netp = stcb->asoc.primary_destination; } - if (TAILQ_EMPTY(&asoc->send_queue) && + if ((SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) && + TAILQ_EMPTY(&asoc->send_queue) && TAILQ_EMPTY(&asoc->sent_queue) && (asoc->stream_queue_cnt == 0)) { if (asoc->locked_on_sending) { goto abort_anyway; } /* there is nothing queued to send, so I'm done... */ - if (SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) { - SCTP_STAT_DECR_GAUGE32(sctps_currestab); - } + SCTP_STAT_DECR_GAUGE32(sctps_currestab); SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT); SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING); sctp_stop_timers_for_shutdown(stcb);