From nobody Fri May 10 19:45:42 2024 X-Original-To: dev-commits-src-main@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 4VbfWC2R2pz5KJRB; Fri, 10 May 2024 19:45:43 +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 4VbfWC1whlz4RFb; Fri, 10 May 2024 19:45:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715370343; 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=RV8PevgAOl3K0jLvl+LzCm6cyppnj02VsTsiA31uzCU=; b=ofNu9VkSTmKZVcTZNqisqsc9mPwkr/Q+PcqwCUpRT5jJR6piltfFIZt4G9SVUKnJcrct4m yEgmXtnLcUxaG2E5/7oN7+NcZ0iyE1B0GwD+CG2lkthxG72RjFBY3MOyJSnUjmXV/ge/03 Ai3JCVnal1nPfqE7zSu6rm4Z3YLr4gur4+amMZfx+LBYY4DxI4QjTdxD4lSsv83Kuvx474 5lRZ54HWmmIefhUZ9/dMemulnWIC2qo/M2mdEiqU46omzYXhpAE+NebIqAWmYf6aJZTiAj qRNdhWXtA7vZpYoeXDxugi1p6IlcMeq8GVJzZzhMoVikqutTeKDmRbKlKs+3Ug== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715370343; a=rsa-sha256; cv=none; b=kGQuhvlPRHEaDbVGeZWbZBf6saQcRrvTfg3L+OiaQRGVCWOBx7+zcxaIpJH8Vu167bIOLn oPVUZHAKV1CEsT8encFkQcSzpZkHpCp9GlIQb2A8+0OrhdOyAqh4QmZuLaH0MZshJkpeeH 4aD2W8UGB9cgKy9qw2BHltbYVZhm8LRe973e801B92aYs/jnJ5NSxLt1h93q21XVP4c98G k1gEITx9807xaoEcKaQGP3K5d5aBxcGSZ+Ji3sQwSlpQRraNyCCyok+/TMUG7OIXjgPkpZ 9uBx7IzvhqiAeUg1QXORnlsC9MznD/bW1f0cgskeU30Wm+N+2wXbziJ2kyBp+g== 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=1715370343; 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=RV8PevgAOl3K0jLvl+LzCm6cyppnj02VsTsiA31uzCU=; b=yqU73QwmW64HjJ8PhXXNc1l3Ub8krZkXlNwC6QWTbFKik0+EzLCDPl2rgWjQZ1K2tRfSaK qe8ySeP8gVISQmVCfDFCwuLKU2/dR98XqQZeebJwnKhVK6sMMWowo9/br9XvZZBx7hh5FB wRohO/WINr839y9PHHpnpZVDh2/yzBYiWbWTh0fh5S+/BaDxRkH7GVAMA42WxCnBGv6JjZ e+obw9yQMGB9QQqiFVY/rI4yw9c9Z7PkZhiltwdPFC2CLtSCpQI/BBWIf9ncPqG6xcC1rl CeMKdW5bdlS4oRHwPtYv1LY0h1RKlAXSWHJrRXbcrahBzQkpZjRjewVKrn1Ihw== 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 4VbfWC1D7mzqsD; Fri, 10 May 2024 19:45:43 +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 44AJjgaQ028769; Fri, 10 May 2024 19:45:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44AJjgIi028766; Fri, 10 May 2024 19:45:42 GMT (envelope-from git) Date: Fri, 10 May 2024 19:45:42 GMT Message-Id: <202405101945.44AJjgIi028766@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 42aeb8d490fb - main - sctp: store vtag expire time as time_t Reported by: Coverity Scan CID: 1492525 CID: 1493239 MFC after: 3 days List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 42aeb8d490fb7e8f4c9d27b3797179b861bd85e3 Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=42aeb8d490fb7e8f4c9d27b3797179b861bd85e3 commit 42aeb8d490fb7e8f4c9d27b3797179b861bd85e3 Author: Michael Tuexen AuthorDate: 2024-05-10 18:25:04 +0000 Commit: Michael Tuexen CommitDate: 2024-05-10 18:28:38 +0000 sctp: store vtag expire time as time_t Reported by: Coverity Scan CID: 1492525 CID: 1493239 MFC after: 3 days --- 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 65ac584827e0..340786e3484e 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -4541,7 +4541,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; @@ -4563,7 +4563,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; @@ -4578,13 +4578,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) { @@ -4596,7 +4596,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); @@ -6745,7 +6745,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 5c6ead92bf9b..ade29fb3544d 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 */