git: 1593585b5ab0 - stable/14 - sctp: store vtag expire time as time_t
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 03 Aug 2024 22:26:40 UTC
The branch stable/14 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=1593585b5ab020dcca655cfbf2208e681a4bf4b6 commit 1593585b5ab020dcca655cfbf2208e681a4bf4b6 Author: Michael Tuexen <tuexen@FreeBSD.org> AuthorDate: 2024-05-10 18:25:04 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> CommitDate: 2024-08-03 22:26:10 +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 69c492bc58df..b2cafdc2f81e 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); @@ -6746,7 +6746,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 */