From nobody Fri Sep 15 17:37:58 2023 X-Original-To: dev-commits-src-all@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 4RnLxf6bSqz4tQBZ; Fri, 15 Sep 2023 17:37:58 +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 4RnLxf63QSz3HV8; Fri, 15 Sep 2023 17:37:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694799478; 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=b/peXpAsRdXDF6X4TxdjwzJ2Pfb0NKa74Zo7edKN0gE=; b=pDFXsoQf9gr3DCNyjeKqbdE9FH+8sDMpb8nw59Gg+kcPrS3x9knr4nSTj1R2omOry0oDlq R1genDjfVrLa4FQM9AUrn19vEjHBLOVfs2M0WpiPFNqePav8d+gKxhD6AZLxJK5tT8DAOd qwIL4SwU5xPMvUC6+HQFerOdHkZtvhDYpsRIInU3kDicL8MTKwTHsgh4xMek2OZ3+Ubgdd p0MkAxPR1NkIBHmgzEuKjoM9SWa7N1xMTtLvOJOROy2BhHX4SfGL7mOhB1K+/h27UPxHRX 6XBQP8P1ToCwDEYK9RzxO8PDeC2rSEtxY7d57mHH/KG01s6FWxbp9FqKUwYInA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694799478; a=rsa-sha256; cv=none; b=Pl+bqZPX6O+jvk6WEhcZ7c4h3Qy5nCIk4ADR0L0ka7+FQxMiG3ZJSwaMR9J+MHF7+WP4Ve g3zDOjbaBm+4vDPiagUiJwrnnRjH8HCWVTS8ziLOLmZ4MhQAMTuX3ymE2kusT8o/MrEUtX Ks9V8oc2FIuu9SgliJosoXWF/ojd4q61F2qXCbs1oZJXO0d0+0NDtDocsQZcHf8V62JyDL xAZqOXlR08dzLmwPsLrXLVvi3wKvyTKid1Ol2HrdiSv2U6yCprzUdyojZUNSsUJaWMkvzW AJqj+xRax+BFK+PP8L18/svKIde3Rp3NCSReNxIcXqjQAQFPHR1b0MM8p5fjMw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694799478; 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=b/peXpAsRdXDF6X4TxdjwzJ2Pfb0NKa74Zo7edKN0gE=; b=l0hh38OR3LxNf/vTnJZfSf1H+CkhsBVxKB7k1nD+TV7bC9XMIIizXeHoWJqoXIeavXsqp6 7DrXkO+n6i35uoihv8v94gZQgN3v5gOShkKWl8lsczg6l/ISDaAvwZK7wYb85Y9UukXEKu 0HSSmim4aGprUjJQWPubrTm/FjtDqJLOjgj/O1GQMpY7NdY9nziuVt1yu2lNwtvxQbkvq+ AYIcyvJDZ+ROD4eEHA6sj9WIVAOZYnVLBqPXDs8+6M4q11N/gy4/G16zhqEnyFQcVVFrCC 0D28MZE5G49NH0aRnHPjX0ZRWqywANhHt8ml6Vy/n8D9UpwS/3nZNp6AXmtWMA== 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 4RnLxf4pZyzYTv; Fri, 15 Sep 2023 17:37:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 38FHbwCt039734; Fri, 15 Sep 2023 17:37:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38FHbwuN039732; Fri, 15 Sep 2023 17:37:58 GMT (envelope-from git) Date: Fri, 15 Sep 2023 17:37:58 GMT Message-Id: <202309151737.38FHbwuN039732@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: 073055503957 - stable/14 - sctp: cleanup SCTP AUTH related notification List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/14 X-Git-Reftype: branch X-Git-Commit: 073055503957a78daae0fdbd688a803f56e778a6 Auto-Submitted: auto-generated The branch stable/14 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=073055503957a78daae0fdbd688a803f56e778a6 commit 073055503957a78daae0fdbd688a803f56e778a6 Author: Michael Tuexen AuthorDate: 2023-09-08 11:13:43 +0000 Commit: Michael Tuexen CommitDate: 2023-09-15 17:35:57 +0000 sctp: cleanup SCTP AUTH related notification This makes consistent use of the parameters and ensures that all SCTP AUTH related notifications are using sctp_ulp_notify(). No functional change intended. --- sys/netinet/sctp_auth.c | 32 ++++++++++++++++---------------- sys/netinet/sctp_auth.h | 2 +- sys/netinet/sctputil.c | 15 ++++++--------- 3 files changed, 23 insertions(+), 26 deletions(-) diff --git a/sys/netinet/sctp_auth.c b/sys/netinet/sctp_auth.c index 67f0d26fa0d5..3c1962233347 100644 --- a/sys/netinet/sctp_auth.c +++ b/sys/netinet/sctp_auth.c @@ -575,7 +575,7 @@ sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t key_id, int so_locked) if ((skey->refcount <= 2) && (skey->deactivated)) { /* notify ULP that key is no longer used */ sctp_ulp_notify(SCTP_NOTIFY_AUTH_FREE_KEY, stcb, - key_id, 0, so_locked); + 0, &key_id, so_locked); SCTPDBG(SCTP_DEBUG_AUTH2, "%s: stcb %p key %u no longer used, %d\n", __func__, (void *)stcb, key_id, skey->refcount); @@ -1312,7 +1312,7 @@ sctp_deact_sharedkey(struct sctp_tcb *stcb, uint16_t keyid) /* are there other refcount holders on the key? */ if (skey->refcount == 1) { /* no other users, send a notification for this key */ - sctp_ulp_notify(SCTP_NOTIFY_AUTH_FREE_KEY, stcb, keyid, 0, + sctp_ulp_notify(SCTP_NOTIFY_AUTH_FREE_KEY, stcb, 0, &keyid, SCTP_SO_LOCKED); } @@ -1654,15 +1654,10 @@ sctp_handle_auth(struct sctp_tcb *stcb, struct sctp_auth_chunk *auth, return (-1); } /* generate a notification if this is a new key id */ - if (stcb->asoc.authinfo.recv_keyid != shared_key_id) - /* - * sctp_ulp_notify(SCTP_NOTIFY_AUTH_NEW_KEY, stcb, - * shared_key_id, (void - * *)stcb->asoc.authinfo.recv_keyid); - */ - sctp_notify_authentication(stcb, SCTP_AUTH_NEW_KEY, - shared_key_id, stcb->asoc.authinfo.recv_keyid, - SCTP_SO_NOT_LOCKED); + if (stcb->asoc.authinfo.recv_keyid != shared_key_id) { + sctp_ulp_notify(SCTP_NOTIFY_AUTH_NEW_KEY, stcb, 0, + &shared_key_id, SCTP_SO_NOT_LOCKED); + } /* compute a new recv assoc key and cache it */ if (stcb->asoc.authinfo.recv_key != NULL) sctp_free_key(stcb->asoc.authinfo.recv_key); @@ -1705,7 +1700,7 @@ sctp_handle_auth(struct sctp_tcb *stcb, struct sctp_auth_chunk *auth, */ void sctp_notify_authentication(struct sctp_tcb *stcb, uint32_t indication, - uint16_t keyid, uint16_t alt_keyid, int so_locked) + uint16_t keyid, int so_locked) { struct mbuf *m_notify; struct sctp_authkey_event *auth; @@ -1714,8 +1709,7 @@ sctp_notify_authentication(struct sctp_tcb *stcb, uint32_t indication, if ((stcb == NULL) || (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) || (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) || - (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) - ) { + (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET)) { /* If the socket is gone we are out of here */ return; } @@ -1737,7 +1731,12 @@ sctp_notify_authentication(struct sctp_tcb *stcb, uint32_t indication, auth->auth_flags = 0; auth->auth_length = sizeof(*auth); auth->auth_keynumber = keyid; - auth->auth_altkeynumber = alt_keyid; + /* XXXMT: The following is BSD specific. */ + if (indication == SCTP_AUTH_NEW_KEY) { + auth->auth_altkeynumber = stcb->asoc.authinfo.recv_keyid; + } else { + auth->auth_altkeynumber = 0; + } auth->auth_indication = indication; auth->auth_assoc_id = sctp_get_associd(stcb); @@ -1757,7 +1756,8 @@ sctp_notify_authentication(struct sctp_tcb *stcb, uint32_t indication, /* not that we need this */ control->tail_mbuf = m_notify; sctp_add_to_readq(stcb->sctp_ep, stcb, control, - &stcb->sctp_socket->so_rcv, 1, SCTP_READ_LOCK_NOT_HELD, so_locked); + &stcb->sctp_socket->so_rcv, 1, + SCTP_READ_LOCK_NOT_HELD, so_locked); } /*- diff --git a/sys/netinet/sctp_auth.h b/sys/netinet/sctp_auth.h index 8bfdbaa6d4f6..279ecb6831cd 100644 --- a/sys/netinet/sctp_auth.h +++ b/sys/netinet/sctp_auth.h @@ -212,7 +212,7 @@ sctp_handle_auth(struct sctp_tcb *stcb, struct sctp_auth_chunk *ch, struct mbuf *m, uint32_t offset); extern void sctp_notify_authentication(struct sctp_tcb *stcb, - uint32_t indication, uint16_t keyid, uint16_t alt_keyid, int so_locked); + uint32_t indication, uint16_t keyid, int so_locked); extern int sctp_validate_init_auth_params(struct mbuf *m, int offset, int limit); diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 381f67f40b99..ea960a3e6376 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -4197,19 +4197,16 @@ sctp_ulp_notify(uint32_t notification, struct sctp_tcb *stcb, sctp_notify_shutdown_event(stcb); break; case SCTP_NOTIFY_AUTH_NEW_KEY: - sctp_notify_authentication(stcb, SCTP_AUTH_NEW_KEY, error, - (uint16_t)(uintptr_t)data, - so_locked); + sctp_notify_authentication(stcb, SCTP_AUTH_NEW_KEY, + *(uint16_t *)data, so_locked); break; case SCTP_NOTIFY_AUTH_FREE_KEY: - sctp_notify_authentication(stcb, SCTP_AUTH_FREE_KEY, error, - (uint16_t)(uintptr_t)data, - so_locked); + sctp_notify_authentication(stcb, SCTP_AUTH_FREE_KEY, + *(uint16_t *)data, so_locked); break; case SCTP_NOTIFY_NO_PEER_AUTH: - sctp_notify_authentication(stcb, SCTP_AUTH_NO_AUTH, error, - (uint16_t)(uintptr_t)data, - so_locked); + sctp_notify_authentication(stcb, SCTP_AUTH_NO_AUTH, + 0, so_locked); break; case SCTP_NOTIFY_SENDER_DRY: sctp_notify_sender_dry_event(stcb, so_locked);