From nobody Thu Aug 01 21:07:36 2024 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 4WZhPN5Sqxz5RSPb; Thu, 01 Aug 2024 21:07: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WZhPN4rK2z4R8H; Thu, 1 Aug 2024 21:07:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722546456; 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=0ZojAjUHU8xUWg0dqyEuYQ398v6D0z0s5HLJK4mtiI4=; b=VN08NU4GmCjqRaIHkQausUmQaoofLiwHVFNe76vZ05t7c4DTJwg8i3XCw4S01bKX1fjRDN hnGyxU7HNR+3LaBeaE1VXfGqFB2hdC6hw2jORbbOxasCRncRbJ7SyoTVlbNYIoPUw7eCvN rGZQgxDzcy1BpTYYA8ebuAJRg7Yxmzi2JOUyjBKWZv12cMed/7tmVdabN62zkZGrXOVepZ xt5K+Umy2LdHTU1sCLgBc9R4ND0elxrd3XH22vVFBmgpmzw0fpC8dqhs3ayGNVEQMQd1Cr ziBQ3sEO2GrB3nDRvyonaiqa981qpSxxNA5o5fYentQ81Ol0tJztLmER24cBPg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722546456; a=rsa-sha256; cv=none; b=VQTH4ShP8/nYMRtAcIb2+iT+5IFbrs0qjXvCn8vq34EnYQ4dArkXYIx67etNBvt4QdxG7x JdN8UlRs6Xwx6nzKyTqDx+XyDc3yhq6LnZa4/3UdG41N8HdFFjgJexBo32cBkmyEsfgUus CvhT2OhUsiNbB3/cqZH0GuWmvzccYzLpj50akn1zPh6fs+z9jpsoIkg6guMoT3V3khnZRi PYISMxyhfm1x6nGA72Ic8EpqDMwTmQgVkLBWNAO7ihyqHwOxj8TkjGiPFhO/gOhmFlhyBH HIP0uEv5qLkSvZprH65k0rRqfYaqOUO2Cp+Frn9XtLN/+cBrTpeiM8rqW82+Kw== 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=1722546456; 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=0ZojAjUHU8xUWg0dqyEuYQ398v6D0z0s5HLJK4mtiI4=; b=p0GxjGDxWKN3gkk6fFvwTwpKLBOuR4w9pRLWTeshaxQFo4ZMNOZd78Fxq0XgHehl7oczhB Vw2iy0UE1tpVhgwRmC/CbmRNXtuHacDeCf2YKO+bsm5S96Ka5ZbLgQad1WVE/wFSwa2yxb zH9Dg4b2jcqdx5a51Zuj7xhoNglfPCC4ekRhpPYOSPoK7/xdHXek17BIyHAUswcQjVz4W6 cF2hFkb8yEACpJeOvi7x5kHF+j90tW/nqJWniyHmZUgZNggkeVD24a6iIdWnccfDxxDJig JpZN/zEYr8B4w+QxaZ/1CyC35cRoM7GQ2hVUhjGKWrDYy+B62aTElYoeFgx7+Q== 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 4WZhPN4RR4z11DR; Thu, 1 Aug 2024 21:07:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 471L7aAQ091400; Thu, 1 Aug 2024 21:07:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 471L7asV091397; Thu, 1 Aug 2024 21:07:36 GMT (envelope-from git) Date: Thu, 1 Aug 2024 21:07:36 GMT Message-Id: <202408012107.471L7asV091397@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: 90f47ea0d6a5 - stable/13 - sctp: store vtag expire time as time_t 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-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/13 X-Git-Reftype: branch X-Git-Commit: 90f47ea0d6a5fe56953ecc8749a11126b874b51d Auto-Submitted: auto-generated The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=90f47ea0d6a5fe56953ecc8749a11126b874b51d commit 90f47ea0d6a5fe56953ecc8749a11126b874b51d Author: Michael Tuexen AuthorDate: 2024-05-10 18:25:04 +0000 Commit: Michael Tuexen CommitDate: 2024-08-01 21:06:50 +0000 sctp: store vtag expire time as time_t Reported by: Coverity Scan CID: 1492525 CID: 1493239 (cherry picked from commit 42aeb8d490fb7e8f4c9d27b3797179b861bd85e3) --- sys/netinet/sctp_pcb.c | 12 ++++++------ sys/netinet/sctp_pcb.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 5d603a3f26d0..f3b51b796df0 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -4540,7 +4540,7 @@ sctp_del_remote_addr(struct sctp_tcb *stcb, struct sockaddr *remaddr) } static bool -sctp_is_in_timewait(uint32_t tag, uint16_t lport, uint16_t rport, uint32_t now) +sctp_is_in_timewait(uint32_t tag, uint16_t lport, uint16_t rport, time_t now) { struct sctpvtaghead *chain; struct sctp_tagblock *twait_block; @@ -4562,7 +4562,7 @@ sctp_is_in_timewait(uint32_t tag, uint16_t lport, uint16_t rport, uint32_t now) } static void -sctp_set_vtag_block(struct sctp_timewait *vtag_block, uint32_t time, +sctp_set_vtag_block(struct sctp_timewait *vtag_block, time_t time, uint32_t tag, uint16_t lport, uint16_t rport) { vtag_block->tv_sec_at_expire = time; @@ -4577,13 +4577,13 @@ sctp_add_vtag_to_timewait(uint32_t tag, uint16_t lport, uint16_t rport) struct sctpvtaghead *chain; struct sctp_tagblock *twait_block; struct timeval now; - uint32_t time; + time_t time; int i; bool set; SCTP_INP_INFO_WLOCK_ASSERT(); (void)SCTP_GETTIME_TIMEVAL(&now); - time = (uint32_t)now.tv_sec + SCTP_BASE_SYSCTL(sctp_vtag_time_wait); + time = now.tv_sec + SCTP_BASE_SYSCTL(sctp_vtag_time_wait); chain = &SCTP_BASE_INFO(vtag_timewait)[(tag % SCTP_STACK_VTAG_HASH_SIZE)]; set = false; LIST_FOREACH(twait_block, chain, sctp_nxt_tagblock) { @@ -4595,7 +4595,7 @@ sctp_add_vtag_to_timewait(uint32_t tag, uint16_t lport, uint16_t rport) continue; } if ((twait_block->vtag_block[i].v_tag != 0) && - (twait_block->vtag_block[i].tv_sec_at_expire < (uint32_t)now.tv_sec)) { + (twait_block->vtag_block[i].tv_sec_at_expire < now.tv_sec)) { if (set) { /* Audit expires this guy */ sctp_set_vtag_block(twait_block->vtag_block + i, 0, 0, 0, 0); @@ -6726,7 +6726,7 @@ sctp_is_vtag_good(uint32_t tag, uint16_t lport, uint16_t rport, struct timeval * return (false); } } - return (!sctp_is_in_timewait(tag, lport, rport, (uint32_t)now->tv_sec)); + return (!sctp_is_in_timewait(tag, lport, rport, now->tv_sec)); } static void diff --git a/sys/netinet/sctp_pcb.h b/sys/netinet/sctp_pcb.h index 4334595f208f..ae062c553a57 100644 --- a/sys/netinet/sctp_pcb.h +++ b/sys/netinet/sctp_pcb.h @@ -130,7 +130,7 @@ struct sctp_block_entry { }; struct sctp_timewait { - uint32_t tv_sec_at_expire; /* the seconds from boot to expire */ + time_t tv_sec_at_expire; /* the seconds from boot to expire */ uint32_t v_tag; /* the vtag that can not be reused */ uint16_t lport; /* the local port used in vtag */ uint16_t rport; /* the remote port used in vtag */