From nobody Thu Feb 10 19:30:35 2022 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 7B74019C07E8; Thu, 10 Feb 2022 19:30:36 +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 4Jvn0D2KZVz4tdg; Thu, 10 Feb 2022 19:30:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644521436; 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=1DB8XrrLmVLTbOIiwRB7WRYwET0HRPVb+5Zzh+qT2JU=; b=h6rRZt+HEva/qKJhVGa529Cz3dewR7BXUDYslvsKz/fSVH+z1NC6oCg+aNtMmLvueTg/Ba 8MWZD/fETE6pn06m593Za1DBLd15WJGPEEMEJQniYeYGRMjeCooGo5W3bfJaJOC4u4/rfx RaYziMypCpfrUrYVJV3qhucSm4FCNCae3k+P2XQDR/cjldt8SjabzX68zx/ix1dqFMncmU aemVdoCdLrJiiue2P7LuXZ4bM/LeXeTDJ/lpK3+22V8e6mqDRjwqcfBpKuuVGdqnraBVul TPZhW5zuOIMTZYN3hXSm39uEFsZc7+gO3upPUF1VXRakRbdFj/MDpeUwR00Spg== 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 10BE12636A; Thu, 10 Feb 2022 19:30:36 +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 21AJUZsV017146; Thu, 10 Feb 2022 19:30:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21AJUZot017145; Thu, 10 Feb 2022 19:30:35 GMT (envelope-from git) Date: Thu, 10 Feb 2022 19:30:35 GMT Message-Id: <202202101930.21AJUZot017145@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Robert Wing Subject: git: 90aacac54b83 - stable/13 - tcpmd5: return ENOENT when security association not found 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: rew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 90aacac54b8336c5c36f64001d62ab2dd581c0c2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644521436; 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=1DB8XrrLmVLTbOIiwRB7WRYwET0HRPVb+5Zzh+qT2JU=; b=XEN1msX9D8th7kLa5Rs12SX0m+Tr5QZl/Fl32ylNFcAeYcXhpwdJprZ+dnfR/xTvAxs4tQ kI03c0G6Yi0hNxx4Mcq271pEntsW9GHDpICHfHpEwlTY9l9hIOuxga0NS+yD7jvZaKVlbX 1hSM76O4Hm7NsvFw/COns7PuzMYw05h59LCgIDC6QfdZi8AIZEtY8nG77cVlJDCbUdFRrW cpzQN5q6/2xKzyW8BRQtNtgtqbsWHLoMNHLpl8oGtDiDnIfwF0PabFaRTfL2mkpakuW192 VmLFQkhhEcajpjPpUeV+kIc3V5QH0Nq4Wk+s4xvMp/KYEsz+tkKZBy/fB94l6A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1644521436; a=rsa-sha256; cv=none; b=uDb1vLV9/r6DsrCyaPrb1SrCgG7ToA1WyZ6TjyqtWExflzVNN8FiuK0UlV7hxzDkn5gmgF TsNlSw7xrjhnEXnQLdY+IgeTv3rqBMz2lvfu+8KZuU5XMyxl69MAq/uz4OGdOa66Jg5jOt h8+gYQipOmkyXnG0zdxQ73dSInJTqGKzaYkxRyli28+REtjCzh7KvrzoR5nANF5wH/CUeJ ZRcPZRdG2yNdpckKVBs6QOtsXpox9/HAEVrP/MA0NEw7qwF1AwoWpWGP9yi8UhQFaz97g3 0yHn//MJ8JX8OuTSJ9h5M3/O4CmrsUFmSbtYdqpB+OR6GzKXDXLKTj3dtKM2xA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=90aacac54b8336c5c36f64001d62ab2dd581c0c2 commit 90aacac54b8336c5c36f64001d62ab2dd581c0c2 Author: Robert Wing AuthorDate: 2022-01-09 01:07:10 +0000 Commit: Robert Wing CommitDate: 2022-02-10 19:28:54 +0000 tcpmd5: return ENOENT when security association not found Return ENOENT from tcp_ipsec_input() when a security association is not found. This allows callers of TCP_MD5_INPUT() to differentiate between a security association not found and receiving a bad signature. Also return ENOENT from tcp_ipsec_output() for consistency. Reviewed by: ae Sponsored by: nepustil.net Sponsored by: Klara Inc. Differential Revision: https://reviews.freebsd.org/D33226 (cherry picked from commit 91d388119ae229702538b96d79cf76556cf0ecf4) --- sys/netipsec/xform_tcp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/netipsec/xform_tcp.c b/sys/netipsec/xform_tcp.c index 54681f7df5d2..b53544cd00fb 100644 --- a/sys/netipsec/xform_tcp.c +++ b/sys/netipsec/xform_tcp.c @@ -251,7 +251,7 @@ setsockaddrs(const struct mbuf *m, union sockaddr_union *src, * th pointer to TCP header * buf pointer to storage for computed MD5 digest * - * Return 0 if successful, otherwise return -1. + * Return 0 if successful, otherwise return error code. */ static int tcp_ipsec_input(struct mbuf *m, struct tcphdr *th, u_char *buf) @@ -267,7 +267,7 @@ tcp_ipsec_input(struct mbuf *m, struct tcphdr *th, u_char *buf) sav = key_allocsa_tcpmd5(&saidx); if (sav == NULL) { KMOD_TCPSTAT_INC(tcps_sig_err_buildsig); - return (EACCES); + return (ENOENT); } /* * tcp_input() operates with TCP header fields in host @@ -307,7 +307,7 @@ tcp_ipsec_output(struct mbuf *m, struct tcphdr *th, u_char *buf) sav = key_allocsa_tcpmd5(&saidx); if (sav == NULL) { KMOD_TCPSTAT_INC(tcps_sig_err_buildsig); - return (EACCES); + return (ENOENT); } tcp_signature_compute(m, th, sav, buf); key_freesav(&sav);