From nobody Sun Jun 25 19:34:56 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Qq1QS4qljz4hTKZ; Sun, 25 Jun 2023 19:34:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Qq1QS4Ht7z3Gnl; Sun, 25 Jun 2023 19:34:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687721696; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kr48IH5nQ7/ur4Mp/CEj2c1jpOPtDE4mnLFhQPKObhM=; b=swE9GkGK9NVgZgUDjiG+ZfE/gvh7SO15VnkvgBbF6xmDBhvACDimlseEpjOG+4l5r3mwK2 p+A24XIQ0FE+iSDWM/XCb51Rlg5cgJKZjW32yjpOFmjbC83FbsqYlvfAhGNFcAyQ6TCkvE 8Jili0Ry4vklL/s/O0hFhZ5I+5WdlAAAVanT5fIlAY6rjbpFnQrTHUT1P8vwvXCUHMjhmx CJA6MitSRcZttvifX8tGhf5Bz1M0aQNE3UwVOlzM6wD4cuOsG2mESwYgVKbfEHnMgIMFNn 5zWLWsFllXDIwlRk8yZSRxlNYeD8c5dkyTDdoPmN+Dtb5h8HGKmmBMj6Bw7HSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687721696; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kr48IH5nQ7/ur4Mp/CEj2c1jpOPtDE4mnLFhQPKObhM=; b=alemGQMJFPVBRyZEeQH9g/TR2d9wKcxHfUC/ktTSC9Y8fxMou9fiqIVMoa4Yjnul+VnlNL h5KqhULD0VJ59iHqOqLDEeaBNFgEJZp1PFdzw6aLkatAnndKIEpv48Tttn0MSSVO9s3koW v8AcnXszvzbUn3d+vGuqGSwKO+rGfJ+7GG+eAxmpSMqx/R44zBZVBnFJ1wjR9WtLSOBGDE CU+SGzVocmE9e3ToAtuWAT0gV39qUYdG4j/FUILw5jHY08IKoFtNspFfsm9ubsF0hLfi5y Ia9Z5EmBB8A7mDlOwaAVSNUUnKzEwTAtyrlwgTRpTqz+nVKIDEf/tRWfOW2CKA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1687721696; a=rsa-sha256; cv=none; b=DIY/8LY4e5/1SZHQpEBBnEQ4rY9pmjH1sOKmPcDN0QT4HMu1xjbrIjBCPM8AkXMuJCAscm NOxNJsAfQWGrp0D9kSJTcSuvOgilaYviAchn/0PmtHtaGUKTHAAno8RYzTRSUUcX+311vn 31i2jTyi2NZSp4aOYEp9SbPS5WESuRL7XxZMJjv77V9RHjLIXkXRQIl0hL4c/1vO6qLy9+ lSZrCzAcdg14yEmk3unYA0OZ/uR44HdUrcFdi2hKdUv0h10lTWVk1pVBYPU2mJ8EEbxpWJ mhQfQ24q/aSNvQUlfMke4CdRT++xxnNU6UOCmnkGQF6YEpg4jDm7EGSyert9Yg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Qq1QS3K2lzfv0; Sun, 25 Jun 2023 19:34:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 35PJYuFr041502; Sun, 25 Jun 2023 19:34:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35PJYujm041501; Sun, 25 Jun 2023 19:34:56 GMT (envelope-from git) Date: Sun, 25 Jun 2023 19:34:56 GMT Message-Id: <202306251934.35PJYujm041501@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 462dbcf3ce60 - stable/13 - sctp: enforce Kahn's rule during the handshake List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 462dbcf3ce60ecc3dedca61999e52372b8552810 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=462dbcf3ce60ecc3dedca61999e52372b8552810 commit 462dbcf3ce60ecc3dedca61999e52372b8552810 Author: Michael Tuexen AuthorDate: 2023-03-16 16:40:40 +0000 Commit: Michael Tuexen CommitDate: 2023-06-25 19:34:34 +0000 sctp: enforce Kahn's rule during the handshake Don't take RTT measurements on packets containing INIT or COOKIE-ECHO chunks, when they were retransmitted. (cherry picked from commit 8ed1e2c88012cfca9fc4131a2637452cc9106b81) --- sys/netinet/sctp_input.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/sys/netinet/sctp_input.c b/sys/netinet/sctp_input.c index a0e0d683b5fe..9eeb8f3fbd23 100644 --- a/sys/netinet/sctp_input.c +++ b/sys/netinet/sctp_input.c @@ -508,8 +508,6 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset, SCTP_FROM_SCTP_INPUT, __LINE__); } - stcb->asoc.overall_error_count = 0; - net->error_count = 0; /* * Cancel the INIT timer, We do this first before queueing the @@ -521,8 +519,12 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int offset, asoc->primary_destination, SCTP_FROM_SCTP_INPUT + SCTP_LOC_3); /* calculate the RTO */ - sctp_calculate_rto(stcb, asoc, net, &asoc->time_entered, - SCTP_RTT_FROM_NON_DATA); + if (asoc->overall_error_count == 0) { + sctp_calculate_rto(stcb, asoc, net, &asoc->time_entered, + SCTP_RTT_FROM_NON_DATA); + } + stcb->asoc.overall_error_count = 0; + net->error_count = 0; retval = sctp_send_cookie_echo(m, offset, initack_limit, stcb, net); return (retval); } @@ -2756,7 +2758,6 @@ sctp_handle_cookie_ack(struct sctp_cookie_ack_chunk *cp SCTP_UNUSED, SCTP_FROM_SCTP_INPUT, __LINE__); } - asoc->overall_error_count = 0; sctp_stop_all_cookie_timers(stcb); /* process according to association state */ if (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED) { @@ -2775,6 +2776,12 @@ sctp_handle_cookie_ack(struct sctp_cookie_ack_chunk *cp SCTP_UNUSED, sctp_calculate_rto(stcb, asoc, net, &asoc->time_entered, SCTP_RTT_FROM_NON_DATA); } + /* + * Since we did not send a HB make sure we don't double + * things. + */ + asoc->overall_error_count = 0; + net->hb_responded = 1; (void)SCTP_GETTIME_TIMEVAL(&asoc->time_entered); sctp_ulp_notify(SCTP_NOTIFY_ASSOC_UP, stcb, 0, NULL, SCTP_SO_NOT_LOCKED); if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || @@ -2784,11 +2791,6 @@ sctp_handle_cookie_ack(struct sctp_cookie_ack_chunk *cp SCTP_UNUSED, soisconnected(stcb->sctp_socket); } } - /* - * since we did not send a HB make sure we don't double - * things - */ - net->hb_responded = 1; if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { /*