From 92eca2dc3a1129397132d10f01ea24076311cf29 Mon Sep 17 00:00:00 2001 From: Christian Spielberger Date: Wed, 6 Mar 2024 11:43:58 +0100 Subject: [PATCH 1/7] debian: bump version v3.9.0 (#1076) --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 680bcc80e..c36de2a2a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +libre (3.9.0) unstable; urgency=medium + + * version 3.9.0 + + -- Alfred E. Heggestad Wed, 31 Jan 2024 08:29:02 +0100 + libre (3.8.0) unstable; urgency=medium * version 3.8.0 From 66d3d1c87b485f3a27919a010b61e1727b6ce060 Mon Sep 17 00:00:00 2001 From: Sebastian Reimers Date: Wed, 6 Mar 2024 12:19:43 +0100 Subject: [PATCH 2/7] ci/abi: bump reference --- .github/workflows/abi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/abi.yml b/.github/workflows/abi.yml index 3926a9084..a287d4873 100644 --- a/.github/workflows/abi.yml +++ b/.github/workflows/abi.yml @@ -15,7 +15,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - ref: 'v3.7.0' + ref: 'v3.9.0' path: old - uses: actions/checkout@v4 From 88fd4e30f390dc34017eca3b1e8d377ce3ee35a7 Mon Sep 17 00:00:00 2001 From: Sebastian Reimers Date: Wed, 6 Mar 2024 13:33:06 +0100 Subject: [PATCH 3/7] sip/transp: reset tcp timeout on websocket receive (#1075) fixes #1074 --- src/sip/transp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sip/transp.c b/src/sip/transp.c index eb6062fd6..e62e9f18d 100644 --- a/src/sip/transp.c +++ b/src/sip/transp.c @@ -945,6 +945,8 @@ static void websock_recv_handler(const struct websock_hdr *hdr, if (mb->end <= 4) return; + tmr_start(&conn->tmr, TCP_IDLE_TIMEOUT * 1000, conn_tmr_handler, conn); + start = mb->pos; err = sip_msg_decode(&msg, mb); From 4030c796dacbd5723069c7eb86b627416d8a97ea Mon Sep 17 00:00:00 2001 From: Christian Spielberger Date: Wed, 6 Mar 2024 14:01:45 +0100 Subject: [PATCH 4/7] release v3.10.0 (#1077) --- CHANGELOG.md | 21 +++++++++++++++++++++ CMakeLists.txt | 4 ++-- debian/changelog | 6 ++++++ mk/Doxyfile | 2 +- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8fc0b66c..0d15fd9fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,27 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v3.10.0] - 2024-03-06 + +## What's Changed +* transp: deref qent only if qentp is not set by @maximilianfridrich in https://github.com/baresip/re/pull/1061 +* sipsess: fix doxygen comments by @alfredh in https://github.com/baresip/re/pull/1062 +* aufile: fix doxygen comment by @alfredh in https://github.com/baresip/re/pull/1063 +* ci/codeql: bump action v3 by @sreimers in https://github.com/baresip/re/pull/1064 +* misc: text2pcap helpers (RTP/RTCP capturing) by @sreimers in https://github.com/baresip/re/pull/1065 +* ci/mingw: bump upload/download-artifact and cache versions by @sreimers in https://github.com/baresip/re/pull/1066 +* transp,tls: add TLS client verification by @maximilianfridrich in https://github.com/baresip/re/pull/1059 +* fmt/text2pcap: cleanup by @sreimers in https://github.com/baresip/re/pull/1067 +* ci/android: cache openssl build by @sreimers in https://github.com/baresip/re/pull/1068 +* ci/misc: fix double push/pull runs by @sreimers in https://github.com/baresip/re/pull/1069 +* fmt/text2pcap: fix coverity return value warning by @sreimers in https://github.com/baresip/re/pull/1070 +* sipsess/listen: improve glare handling by @maximilianfridrich in https://github.com/baresip/re/pull/1071 +* conf: add conf_get_i32 by @sreimers in https://github.com/baresip/re/pull/1072 + + +**Full Changelog**: https://github.com/baresip/re/compare/v3.9.0...v3.10.0 + + ## [v3.9.0] - 2024-01-31 ## What's Changed diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f9af1f6e..a2a3d0e72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,13 +14,13 @@ cmake_minimum_required(VERSION 3.14) project(re - VERSION 3.9.0 + VERSION 3.10.0 LANGUAGES C HOMEPAGE_URL https://github.com/baresip/re DESCRIPTION "Generic library for real-time communications" ) -set(PROJECT_SOVERSION 21) # bump if ABI breaks +set(PROJECT_SOVERSION 22) # bump if ABI breaks # Pre-release identifier, comment out on a release # Increment for breaking changes (dev2, dev3...) diff --git a/debian/changelog b/debian/changelog index c36de2a2a..bcc86a4ba 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +libre (3.10.0) unstable; urgency=medium + + * version 3.10.0 + + -- Christian Spielberger Wed, 6 Mar 2024 11:40:00 +0100 + libre (3.9.0) unstable; urgency=medium * version 3.9.0 diff --git a/mk/Doxyfile b/mk/Doxyfile index fcca5223e..c946e921c 100644 --- a/mk/Doxyfile +++ b/mk/Doxyfile @@ -4,7 +4,7 @@ # Project related configuration options #--------------------------------------------------------------------------- PROJECT_NAME = libre -PROJECT_NUMBER = 3.9.0 +PROJECT_NUMBER = 3.10.0 OUTPUT_DIRECTORY = ../re-dox CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English From c2a23778ca109dbe60a24b24b65a3d6f8f14834a Mon Sep 17 00:00:00 2001 From: Sebastian Reimers Date: Tue, 12 Mar 2024 10:15:30 +0100 Subject: [PATCH 5/7] ci/clang-analyze: bump clang version and fix status-bugs (#1079) * ci/clang-analyze: bump clang version and fix status-bugs * add verbose flag * misc: fix clang analyzer warnings test/httpauth.c:654:3: warning: Value stored to 'mb_printed' is never read test/sipsess.c:216:2: warning: 1st function call argument is an uninitialized Value test/sipsess.c:236:2: warning: 1st function call argument is an uninitialized Value test/sipsess.c:535:2: warning: 1st function call argument is an uninitialized value --- .github/workflows/clang-analyze.yml | 8 ++++---- src/fmt/time.c | 2 +- test/httpauth.c | 8 ++++---- test/sipsess.c | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/clang-analyze.yml b/.github/workflows/clang-analyze.yml index 10de2c285..567e95ae7 100644 --- a/.github/workflows/clang-analyze.yml +++ b/.github/workflows/clang-analyze.yml @@ -23,10 +23,10 @@ jobs: - name: Install clang-tools run: | wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - - sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" - sudo apt-get update && sudo apt-get install -y clang-tools-15 + sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" + sudo apt-get update && sudo apt-get install -y clang-tools-17 - name: analyze run: | - cmake -B build -DCMAKE_C_COMPILER=clang-15 - analyze-build-15 --cdb build/compile_commands.json + cmake -B build -DCMAKE_C_COMPILER=clang-17 + analyze-build-17 --cdb build/compile_commands.json --status-bugs -v diff --git a/src/fmt/time.c b/src/fmt/time.c index 76410c438..20e8c7d50 100644 --- a/src/fmt/time.c +++ b/src/fmt/time.c @@ -148,7 +148,7 @@ int fmt_timestamp_us(struct re_printf *pf, void *arg) int h, m, s; uint64_t us; struct timespec tspec; - struct tm tm; + struct tm tm = {0}; #if defined(WIN32) && !defined(__MINGW32__) timespec_get(&tspec, TIME_UTC); diff --git a/test/httpauth.c b/test/httpauth.c index 950b7c64e..322dc0b13 100644 --- a/test/httpauth.c +++ b/test/httpauth.c @@ -651,13 +651,13 @@ int test_httpauth_digest_response(void) goto out; } - mb_printed = mem_deref (mb_printed); - resp = mem_deref(resp); + mem_deref(mb_printed); + mem_deref(resp); continue; out: - mb_printed = mem_deref (mb_printed); - resp = mem_deref(resp); + mem_deref(mb_printed); + mem_deref(resp); break; } diff --git a/test/sipsess.c b/test/sipsess.c index 0fd63f035..f9cd05b85 100644 --- a/test/sipsess.c +++ b/test/sipsess.c @@ -203,7 +203,7 @@ static int make_sdp(struct mbuf **mbp, const char *sdp) static void send_update_a(void *arg) { struct test *test = arg; - struct mbuf *desc; + struct mbuf *desc = NULL; int err; err = make_sdp(&desc, sdp_a); @@ -223,7 +223,7 @@ static void send_update_a(void *arg) static void send_update_b(void *arg) { struct test *test = arg; - struct mbuf *desc; + struct mbuf *desc = NULL; int err; err = make_sdp(&desc, sdp_b); @@ -433,7 +433,7 @@ static void close_handler(int err, const struct sip_msg *msg, void *arg) static void conn_handler(const struct sip_msg *msg, void *arg) { struct test *test = arg; - struct mbuf *desc; + struct mbuf *desc = NULL; int err; char *hdrs = test->rel100_b == REL100_REQUIRED ? "Require: 100rel\r\n" : ""; From 3d051cd1a83c5205194f3cf4055b6a54c07f9aec Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 12 Mar 2024 19:55:25 +0300 Subject: [PATCH 6/7] main: Flush list of deleted fhs on fd_poll errors. (#1081) This makes sure deleted fhs structs are not left allocated on fd_poll errors. --- src/main/main.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/main.c b/src/main/main.c index 923988341..3fa4c16c9 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -741,6 +741,7 @@ static int fd_poll(struct re *re) const uint64_t to = tmr_next_timeout(re->tmrl); int i, n; int nfds = re->nfds; + int err = 0; struct re_fhs *fhs = NULL; #ifdef HAVE_SELECT fd_set rfds, wfds, efds; @@ -827,11 +828,14 @@ static int fd_poll(struct re *re) default: (void)to; DEBUG_WARNING("no polling method set\n"); - return EINVAL; + err = EINVAL; + goto out; } - if (n < 0) - return RE_ERRNO_SOCK; + if (n < 0) { + err = RE_ERRNO_SOCK; + goto out; + } /* Check for events */ for (i=0; (n > 0) && (i < nfds); i++) { @@ -908,7 +912,8 @@ static int fd_poll(struct re *re) #endif default: - return EINVAL; + err = EINVAL; + goto out; } if (!flags) @@ -926,10 +931,11 @@ static int fd_poll(struct re *re) --n; } + out: /* Delayed fhs deref to avoid dangling fhs pointers */ fhsld_flush(re); - return 0; + return err; } From 45611b9e56625b496999b63e5b2d74549a2fdf2c Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 12 Mar 2024 22:05:11 +0300 Subject: [PATCH 7/7] main: Use slist for fhs delete list. (#1082) This fixes a potential memory leak in fd_close, if reallocating mbuf in fhsld delete list fails. Switching the delete list implementation to a single-linked list allows to avoid dynamic memory allocation (and the associated point of failure) in fd_close. --- src/main/main.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/src/main/main.c b/src/main/main.c index 3fa4c16c9..8e08d7d50 100644 --- a/src/main/main.c +++ b/src/main/main.c @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include @@ -72,6 +71,7 @@ struct re_fhs { int flags; /**< Polling flags (Read, Write, etc.) */ fd_h* fh; /**< Event handler */ void* arg; /**< Handler argument */ + struct re_fhs* next; /**< Next element in the delete list */ }; /** Polling loop data */ @@ -82,7 +82,7 @@ struct re { RE_ATOMIC bool polling; /**< Is polling flag */ int sig; /**< Last caught signal */ struct tmrl *tmrl; /**< List of timers */ - struct mbuf *fhsld; /**< fhs delete list */ + struct re_fhs *fhsld; /**< fhs single-linked delete list */ #ifdef HAVE_SELECT struct re_fhs **fhsl; /**< Select fhs pointer list */ #endif @@ -111,18 +111,14 @@ static void poll_close(struct re *re); static void fhsld_flush(struct re *re) { - if (!re->fhsld) - return; - - re->fhsld->pos = 0; + struct re_fhs *fhs = re->fhsld; + re->fhsld = NULL; - while (re->fhsld->pos < re->fhsld->end) { - intptr_t p = mbuf_read_ptr(re->fhsld); - mem_deref((void *)p); + while (fhs) { + struct re_fhs *next = fhs->next; + mem_deref(fhs); + fhs = next; } - - re->fhsld->pos = 0; - re->fhsld->end = 0; } @@ -135,7 +131,6 @@ static void re_destructor(void *arg) mem_deref(re->mutex); mem_deref(re->async); mem_deref(re->tmrl); - mem_deref(re->fhsld); } @@ -163,12 +158,6 @@ int re_alloc(struct re **rep) if (!re) return ENOMEM; - re->fhsld = mbuf_alloc(64 * sizeof(void *)); - if (!re->fhsld) { - err = ENOMEM; - goto out; - } - err = mutex_alloc_tp(&re->mutex, mtx_recursive); if (err) { @@ -722,7 +711,10 @@ struct re_fhs *fd_close(struct re_fhs *fhs) DEBUG_INFO("fd_close: fd=%d\n", fhs->fd); } - mbuf_write_ptr(re->fhsld, (intptr_t)fhs); + re_assert(fhs->next == NULL); + fhs->next = re->fhsld; + re->fhsld = fhs; + --re->nfds; return NULL;