From 51a40ff003d357d3664c7b04d94b81d863f1ea94 Mon Sep 17 00:00:00 2001 From: Christian Spielberger Date: Wed, 19 Jun 2024 07:32:40 +0200 Subject: [PATCH 01/18] release v3.13.0 (#1144) --- CHANGELOG.md | 27 +++++++++++++++++++++++++++ CMakeLists.txt | 4 ++-- debian/changelog | 12 ++++++++++++ mk/Doxyfile | 2 +- 4 files changed, 42 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50320665d..3c3e456c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,33 @@ 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.13.0] - 2024-06-19 + +## What's Changed +* http/client: use dynamically sized buffers for PEM setters by @maximilianfridrich in https://github.com/baresip/re/pull/1117 +* tls: allow secure TLS renegotiation by @maximilianfridrich in https://github.com/baresip/re/pull/1121 +* tls: always enable USE_OPENSSL_SRTP by @alfredh in https://github.com/baresip/re/pull/1122 +* main: remove call to openssl init by @alfredh in https://github.com/baresip/re/pull/1120 +* sip/transp: Allow ACK w/o Max-Forwards header by @juha-h in https://github.com/baresip/re/pull/1124 +* net: remove NET_ADDRSTRLEN by @alfredh in https://github.com/baresip/re/pull/1123 +* ci/ios: increase min deployment target by @sreimers in https://github.com/baresip/re/pull/1126 +* tls/http: add certificate chain setters by @maximilianfridrich in https://github.com/baresip/re/pull/1125 +* sipsess/connect: set sess->established immediately on 200 receival by @maximilianfridrich in https://github.com/baresip/re/pull/1128 +* test/cmake: add crypt32 linking for WIN32 by @sreimers in https://github.com/baresip/re/pull/1130 +* ci/sanitizers: use clang-17 by @sreimers in https://github.com/baresip/re/pull/1131 +* ci/sanitizer: add undefined behavior sanitizer by @sreimers in https://github.com/baresip/re/pull/1132 +* sip: verify call-id, to-tag, cseq of INVITE response by @maximilianfridrich in https://github.com/baresip/re/pull/1129 +* ci: remove one unneeded directory change by @alfredh in https://github.com/baresip/re/pull/1134 +* test: change GENERATOR_SSRC from define to type by @alfredh in https://github.com/baresip/re/pull/1133 +* tls: refactoring SNI ctx usage for libressl support by @sreimers in https://github.com/baresip/re/pull/1136 +* test: add test_rtcp_loop() by @alfredh in https://github.com/baresip/re/pull/1137 +* ci/coverage: increase min coverage by @sreimers in https://github.com/baresip/re/pull/1138 +* ci/coverage: use json summary and upload html details by @sreimers in https://github.com/baresip/re/pull/1139 +* sip: add host param to sip_send_conn by @sreimers in https://github.com/baresip/re/pull/1141 + + +**Full Changelog**: https://github.com/baresip/re/compare/v3.12.0...v3.13.0 + ## [v3.12.0] - 2024-05-15 ## What's Changed diff --git a/CMakeLists.txt b/CMakeLists.txt index a951df07c..aa619e39a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,13 +14,13 @@ cmake_minimum_required(VERSION 3.14) project(re - VERSION 3.12.0 + VERSION 3.13.0 LANGUAGES C HOMEPAGE_URL https://github.com/baresip/re DESCRIPTION "Generic library for real-time communications" ) -set(PROJECT_SOVERSION 24) # bump if ABI breaks +set(PROJECT_SOVERSION 25) # 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 ced7077e5..a42e88786 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +libre (3.13.0) unstable; urgency=medium + + * version 3.13.0 + + -- Christian Spielberger Wed, 19 Jun 2024 07:12:37 +0100 + +libre (3.12.0) unstable; urgency=medium + + * version 3.12.0 + + -- Alfred E. Heggestad Wed, 15 May 2024 08:37:35 +0200 + libre (3.11.0) unstable; urgency=medium * version 3.11.0 diff --git a/mk/Doxyfile b/mk/Doxyfile index 3a646e6d0..6b15fbd76 100644 --- a/mk/Doxyfile +++ b/mk/Doxyfile @@ -4,7 +4,7 @@ # Project related configuration options #--------------------------------------------------------------------------- PROJECT_NAME = libre -PROJECT_NUMBER = 3.12.0 +PROJECT_NUMBER = 3.13.0 OUTPUT_DIRECTORY = ../re-dox CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English From f723cc4fcbd45fc626424a8fe09901f71f486387 Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" <114750+alfredh@users.noreply.github.com> Date: Wed, 19 Jun 2024 08:39:28 +0200 Subject: [PATCH 02/18] aumix: use mutex_alloc() (#1142) * aumix: use mutex_alloc() * aumix_debug: use const --- include/rem_aumix.h | 2 +- rem/aumix/aumix.c | 54 ++++++++++++++++++++++----------------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/include/rem_aumix.h b/include/rem_aumix.h index 41f715df6..4017fa27d 100644 --- a/include/rem_aumix.h +++ b/include/rem_aumix.h @@ -33,4 +33,4 @@ int aumix_source_put(struct aumix_source *src, const int16_t *sampv, size_t sampc); void aumix_source_readh(struct aumix_source *src, aumix_read_h *readh); void aumix_source_flush(struct aumix_source *src); -int aumix_debug(struct re_printf *pf, struct aumix *mix); +int aumix_debug(struct re_printf *pf, const struct aumix *mix); diff --git a/rem/aumix/aumix.c b/rem/aumix/aumix.c index e7f0ced50..c3458e425 100644 --- a/rem/aumix/aumix.c +++ b/rem/aumix/aumix.c @@ -21,7 +21,7 @@ /** Defines an Audio mixer */ struct aumix { - mtx_t mutex; + mtx_t *mutex; cnd_t cond; struct list srcl; thrd_t thread; @@ -62,21 +62,22 @@ static void destructor(void *arg) { struct aumix *mix = arg; - mtx_lock(&mix->mutex); + mtx_lock(mix->mutex); bool run = mix->run; - mtx_unlock(&mix->mutex); + mtx_unlock(mix->mutex); if (run) { - mtx_lock(&mix->mutex); + mtx_lock(mix->mutex); mix->run = false; cnd_signal(&mix->cond); - mtx_unlock(&mix->mutex); + mtx_unlock(mix->mutex); thrd_join(mix->thread, NULL); } mem_deref(mix->af); + mem_deref(mix->mutex); } @@ -85,9 +86,9 @@ static void source_destructor(void *arg) struct aumix_source *src = arg; if (src->le.list) { - mtx_lock(&src->mix->mutex); + mtx_lock(src->mix->mutex); list_unlink(&src->le); - mtx_unlock(&src->mix->mutex); + mtx_unlock(src->mix->mutex); } mem_deref(src->aubuf); @@ -110,7 +111,7 @@ static int aumix_thread(void *arg) if (!silence || !frame || !mix_frame) goto out; - mtx_lock(&mix->mutex); + mtx_lock(mix->mutex); while (mix->run) { @@ -119,13 +120,13 @@ static int aumix_thread(void *arg) if (!mix->srcl.head) { mix->af = mem_deref(mix->af); - cnd_wait(&mix->cond, &mix->mutex); + cnd_wait(&mix->cond, mix->mutex); ts = 0; } else { - mtx_unlock(&mix->mutex); + mtx_unlock(mix->mutex); sys_usleep(4000); - mtx_lock(&mix->mutex); + mtx_lock(mix->mutex); } now = tmr_jiffies(); @@ -243,7 +244,7 @@ static int aumix_thread(void *arg) ts += mix->ptime; } - mtx_unlock(&mix->mutex); + mtx_unlock(mix->mutex); out: mem_deref(mix_frame); @@ -287,9 +288,8 @@ int aumix_alloc(struct aumix **mixp, uint32_t srate, mix->rec_sum.srate = srate; mix->rec_sum.sampc = mix->frame_size; - err = mtx_init(&mix->mutex, mtx_plain) != thrd_success; + err = mutex_alloc(&mix->mutex); if (err) { - err = ENOMEM; goto out; } @@ -328,9 +328,9 @@ void aumix_recordh(struct aumix *mix, aumix_record_h *recordh) if (!mix) return; - mtx_lock(&mix->mutex); + mtx_lock(mix->mutex); mix->recordh = recordh; - mtx_unlock(&mix->mutex); + mtx_unlock(mix->mutex); } @@ -345,9 +345,9 @@ void aumix_record_sumh(struct aumix *mix, aumix_record_h *recordh) if (!mix) return; - mtx_lock(&mix->mutex); + mtx_lock(mix->mutex); mix->record_sumh = recordh; - mtx_unlock(&mix->mutex); + mtx_unlock(mix->mutex); } @@ -378,10 +378,10 @@ int aumix_playfile(struct aumix *mix, const char *filepath) return EINVAL; } - mtx_lock(&mix->mutex); + mtx_lock(mix->mutex); mem_deref(mix->af); mix->af = af; - mtx_unlock(&mix->mutex); + mtx_unlock(mix->mutex); return 0; } @@ -468,9 +468,9 @@ void aumix_source_readh(struct aumix_source *src, aumix_read_h *readh) if (!src || !src->mix) return; - mtx_lock(&src->mix->mutex); + mtx_lock(src->mix->mutex); src->readh = readh; - mtx_unlock(&src->mix->mutex); + mtx_unlock(src->mix->mutex); } @@ -510,7 +510,7 @@ void aumix_source_enable(struct aumix_source *src, bool enable) mix = src->mix; - mtx_lock(&mix->mutex); + mtx_lock(mix->mutex); if (enable) { list_append(&mix->srcl, &src->le, src); @@ -520,7 +520,7 @@ void aumix_source_enable(struct aumix_source *src, bool enable) list_unlink(&src->le); } - mtx_unlock(&mix->mutex); + mtx_unlock(mix->mutex); } @@ -565,7 +565,7 @@ void aumix_source_flush(struct aumix_source *src) * * @return 0 if success, otherwise errorcode */ -int aumix_debug(struct re_printf *pf, struct aumix *mix) +int aumix_debug(struct re_printf *pf, const struct aumix *mix) { struct le *le; int err = 0; @@ -574,7 +574,7 @@ int aumix_debug(struct re_printf *pf, struct aumix *mix) return EINVAL; re_hprintf(pf, "aumix debug:\n"); - mtx_lock(&mix->mutex); + mtx_lock(mix->mutex); LIST_FOREACH(&mix->srcl, le) { struct aumix_source *src = le->data; @@ -586,6 +586,6 @@ int aumix_debug(struct re_printf *pf, struct aumix *mix) } out: - mtx_unlock(&mix->mutex); + mtx_unlock(mix->mutex); return err; } From 1bf05d819abeb51e74b11e634db9722b308a89d7 Mon Sep 17 00:00:00 2001 From: Maximilian Fridrich Date: Wed, 19 Jun 2024 08:39:46 +0200 Subject: [PATCH 03/18] sipreg/reg.c: stop retrying registers early after 401/407 (#1143) --- src/sipreg/reg.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sipreg/reg.c b/src/sipreg/reg.c index 76e558c75..9a0854f57 100644 --- a/src/sipreg/reg.c +++ b/src/sipreg/reg.c @@ -193,6 +193,7 @@ static void response_handler(int err, const struct sip_msg *msg, void *arg) { const struct sip_hdr *minexp; struct sipreg *reg = arg; + uint16_t last_scode = reg->ls.last_scode; reg->wait = failwait(reg->failc + 1); if (err || !msg || sip_request_loops(®->ls, msg->scode)) { @@ -223,6 +224,11 @@ static void response_handler(int err, const struct sip_msg *msg, void *arg) case 401: case 407: + if (reg->ls.failc > 1 && last_scode == msg->scode) { + reg->failc++; + goto out; + } + sip_auth_reset(reg->auth); err = sip_auth_authenticate(reg->auth, msg); if (err) { From 2df1a8132a30977aa256fb33344733ba54eb0f4e Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" <114750+alfredh@users.noreply.github.com> Date: Wed, 19 Jun 2024 09:14:31 +0200 Subject: [PATCH 04/18] aumix: add locking in aumix_source_count() (#1145) --- rem/aumix/aumix.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rem/aumix/aumix.c b/rem/aumix/aumix.c index c3458e425..95032be0c 100644 --- a/rem/aumix/aumix.c +++ b/rem/aumix/aumix.c @@ -399,7 +399,11 @@ uint32_t aumix_source_count(const struct aumix *mix) if (!mix) return 0; - return list_count(&mix->srcl); + mtx_lock(mix->mutex); + uint32_t count = list_count(&mix->srcl); + mtx_unlock(mix->mutex); + + return count; } From 5628b799c53508af823014b26eb38feed446713d Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" <114750+alfredh@users.noreply.github.com> Date: Wed, 19 Jun 2024 11:21:28 +0200 Subject: [PATCH 05/18] test: init err in test_sip_auth_encode() (#1146) --- test/sipauth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sipauth.c b/test/sipauth.c index 7ae8729a1..ec627f748 100644 --- a/test/sipauth.c +++ b/test/sipauth.c @@ -74,7 +74,7 @@ static int auth_handler(char **user, char **pass, const char *rlm, void *arg) static int test_sip_auth_encode(void) { - int err; + int err = 0; struct mbuf *mb, *mb_enc; struct sip_auth *auth = NULL; char buf[1024] = {0}; From cce88be38d875481a50713b98f9633a913b5eadf Mon Sep 17 00:00:00 2001 From: Sebastian Reimers Date: Sat, 22 Jun 2024 08:21:22 +0200 Subject: [PATCH 06/18] sipreg: refactor response_handler else optimization (#1147) --- src/sipreg/reg.c | 68 ++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/src/sipreg/reg.c b/src/sipreg/reg.c index 9a0854f57..7dff7bd1f 100644 --- a/src/sipreg/reg.c +++ b/src/sipreg/reg.c @@ -215,54 +215,54 @@ static void response_handler(int err, const struct sip_msg *msg, void *arg) if (reg->regid > 0 && !reg->terminated && !reg->ka) start_outbound(reg, msg); + goto out; } - else { - if (reg->terminated && !reg->registered) - goto out; - switch (msg->scode) { - - case 401: - case 407: - if (reg->ls.failc > 1 && last_scode == msg->scode) { - reg->failc++; - goto out; - } + if (reg->terminated && !reg->registered) + goto out; - sip_auth_reset(reg->auth); - err = sip_auth_authenticate(reg->auth, msg); - if (err) { - err = (err == EAUTH) ? 0 : err; - break; - } + switch (msg->scode) { - err = request(reg, false); - if (err) - break; + case 401: + case 407: + if (reg->ls.failc > 1 && last_scode == msg->scode) { + reg->failc++; + goto out; + } - return; + sip_auth_reset(reg->auth); + err = sip_auth_authenticate(reg->auth, msg); + if (err) { + err = (err == EAUTH) ? 0 : err; + break; + } - case 403: - sip_auth_reset(reg->auth); + err = request(reg, false); + if (err) break; - case 423: - minexp = sip_msg_hdr(msg, SIP_HDR_MIN_EXPIRES); - if (!minexp || !pl_u32(&minexp->val) || !reg->expires) - break; + return; - reg->expires = pl_u32(&minexp->val); + case 403: + sip_auth_reset(reg->auth); + break; - err = request(reg, false); - if (err) - break; + case 423: + minexp = sip_msg_hdr(msg, SIP_HDR_MIN_EXPIRES); + if (!minexp || !pl_u32(&minexp->val) || !reg->expires) + break; - return; - } + reg->expires = pl_u32(&minexp->val); - ++reg->failc; + err = request(reg, false); + if (err) + break; + + return; } + ++reg->failc; + out: if (!reg->expires) { if (msg && msg->scode >= 400 && msg->scode < 500) From 4f0144b5ede3e2cac6e4ee5456a917ba6131e30e Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" <114750+alfredh@users.noreply.github.com> Date: Sat, 22 Jun 2024 08:22:42 +0200 Subject: [PATCH 07/18] vidmix: improve mutex usage (#1148) --- rem/vidmix/vidmix.c | 81 ++++++++++++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 31 deletions(-) diff --git a/rem/vidmix/vidmix.c b/rem/vidmix/vidmix.c index db3432175..4eeb4e5d0 100644 --- a/rem/vidmix/vidmix.c +++ b/rem/vidmix/vidmix.c @@ -34,7 +34,7 @@ struct vidmix_source { struct le le; uint32_t pidx; thrd_t thread; - mtx_t mutex; + mtx_t *mutex; struct vidframe *frame_tx; struct vidframe *frame_rx; struct vidmix *mix; @@ -84,6 +84,7 @@ static void source_destructor(void *arg) mem_deref(src->frame_tx); mem_deref(src->frame_rx); mem_deref(src->mix); + mem_deref(src->mutex); } @@ -181,7 +182,7 @@ static int vidmix_thread(void *arg) struct vidmix *mix = src->mix; uint64_t ts = tmr_jiffies_usec(); - mtx_lock(&src->mutex); + mtx_lock(src->mutex); while (src->run) { @@ -189,9 +190,9 @@ static int vidmix_thread(void *arg) struct le *le; uint64_t now; - mtx_unlock(&src->mutex); + mtx_unlock(src->mutex); sys_usleep(4000); - mtx_lock(&src->mutex); + mtx_lock(src->mutex); now = tmr_jiffies_usec(); @@ -253,7 +254,7 @@ static int vidmix_thread(void *arg) ts += src->fint; } - mtx_unlock(&src->mutex); + mtx_unlock(src->mutex); return 0; } @@ -265,16 +266,16 @@ static int content_thread(void *arg) struct vidmix *mix = src->mix; uint64_t ts = tmr_jiffies_usec(); - mtx_lock(&src->mutex); + mtx_lock(src->mutex); while (src->run) { struct le *le; uint64_t now; - mtx_unlock(&src->mutex); + mtx_unlock(src->mutex); sys_usleep(4000); - mtx_lock(&src->mutex); + mtx_lock(src->mutex); now = tmr_jiffies_usec(); @@ -299,7 +300,7 @@ static int content_thread(void *arg) ts += src->fint; } - mtx_unlock(&src->mutex); + mtx_unlock(src->mutex); return 0; } @@ -392,11 +393,9 @@ int vidmix_source_alloc(struct vidmix_source **srcp, struct vidmix *mix, src->arg = arg; src->pidx = ++mix->next_pidx; - err = mtx_init(&src->mutex, mtx_plain) != thrd_success; - if (err) { - err = ENOMEM; + err = mutex_alloc(&src->mutex); + if (err) goto out; - } if (sz) { err = vidframe_alloc(&src->frame_tx, mix->fmt, sz); @@ -438,7 +437,14 @@ bool vidmix_source_isenabled(const struct vidmix_source *src) */ bool vidmix_source_isrunning(const struct vidmix_source *src) { - return src ? src->run : false; + if (!src) + return false; + + mtx_lock(src->mutex); + bool run = src->run; + mtx_unlock(src->mutex); + + return run; } @@ -528,16 +534,25 @@ int vidmix_source_start(struct vidmix_source *src) if (!src) return EINVAL; - if (src->run) + mtx_lock(src->mutex); + bool run = src->run; + mtx_unlock(src->mutex); + + if (run) return EALREADY; + mtx_lock(src->mutex); src->run = true; + mtx_unlock(src->mutex); err = thread_create_name(&src->thread, "vidmix", src->content ? content_thread : vidmix_thread, src); - if (err) + if (err) { + mtx_lock(src->mutex); src->run = false; + mtx_unlock(src->mutex); + } return err; } @@ -553,10 +568,14 @@ void vidmix_source_stop(struct vidmix_source *src) if (!src) return; - if (src->run) { - mtx_lock(&src->mutex); + mtx_lock(src->mutex); + bool run = src->run; + mtx_unlock(src->mutex); + + if (run) { + mtx_lock(src->mutex); src->run = false; - mtx_unlock(&src->mutex); + mtx_unlock(src->mutex); thrd_join(src->thread, NULL); } } @@ -587,10 +606,10 @@ int vidmix_source_set_size(struct vidmix_source *src, const struct vidsz *sz) clear_frame(frame); - mtx_lock(&src->mutex); + mtx_lock(src->mutex); mem_deref(src->frame_tx); src->frame_tx = frame; - mtx_unlock(&src->mutex); + mtx_unlock(src->mutex); return 0; } @@ -607,9 +626,9 @@ void vidmix_source_set_rate(struct vidmix_source *src, unsigned fps) if (!src || !fps) return; - mtx_lock(&src->mutex); + mtx_lock(src->mutex); src->fint = VIDEO_TIMEBASE/fps; - mtx_unlock(&src->mutex); + mtx_unlock(src->mutex); } @@ -624,9 +643,9 @@ void vidmix_source_set_content_hide(struct vidmix_source *src, bool hide) if (!src) return; - mtx_lock(&src->mutex); + mtx_lock(src->mutex); src->content_hide = hide; - mtx_unlock(&src->mutex); + mtx_unlock(src->mutex); } @@ -640,9 +659,9 @@ void vidmix_source_toggle_selfview(struct vidmix_source *src) if (!src) return; - mtx_lock(&src->mutex); + mtx_lock(src->mutex); src->selfview = !src->selfview; - mtx_unlock(&src->mutex); + mtx_unlock(src->mutex); } @@ -660,10 +679,10 @@ void vidmix_source_set_focus(struct vidmix_source *src, if (!src) return; - mtx_lock(&src->mutex); + mtx_lock(src->mutex); src->focus_full = focus_full; src->focus = (void *)focus_src; - mtx_unlock(&src->mutex); + mtx_unlock(src->mutex); } @@ -708,10 +727,10 @@ void vidmix_source_set_focus_idx(struct vidmix_source *src, uint32_t pidx) if (focus && focus == src->focus) focus_full = !src->focus_full; - mtx_lock(&src->mutex); + mtx_lock(src->mutex); src->focus_full = focus_full; src->focus = focus; - mtx_unlock(&src->mutex); + mtx_unlock(src->mutex); } From f3b5979d6ad78585b7f6bfd64a78449373ea6330 Mon Sep 17 00:00:00 2001 From: Maximilian Fridrich Date: Tue, 2 Jul 2024 09:39:23 +0200 Subject: [PATCH 08/18] udp/mcast: use group scopeid as interface for IPv6 (#1149) --- src/udp/mcast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/udp/mcast.c b/src/udp/mcast.c index a40ed1148..429479b8d 100644 --- a/src/udp/mcast.c +++ b/src/udp/mcast.c @@ -37,7 +37,7 @@ static int multicast_update(struct udp_sock *us, const struct sa *group, #ifdef HAVE_INET6 case AF_INET6: mreq6.ipv6mr_multiaddr = group->u.in6.sin6_addr; - mreq6.ipv6mr_interface = 0; + mreq6.ipv6mr_interface = sa_scopeid(group); err = udp_setsockopt(us, IPPROTO_IPV6, join From 209919efd6eb2c396fd25e4ce33de29d4ed29ce6 Mon Sep 17 00:00:00 2001 From: Maximilian Fridrich Date: Thu, 4 Jul 2024 09:29:20 +0200 Subject: [PATCH 09/18] .clangd: suppress -Wgnu-zero-variadic-macro-arguments (#1150) --- .clangd | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.clangd b/.clangd index e5903de15..f4d8c35a6 100644 --- a/.clangd +++ b/.clangd @@ -3,3 +3,6 @@ If: CompileFlags: Add: [-Wall, -DHAVE_INTTYPES_H, -include re.h] Remove: [-xobjective-c++-header] +--- +Diagnostics: + Suppress: "-Wgnu-zero-variadic-macro-arguments" From 4adf66a150ceca1e5e3516380a7a5b5abc2d318e Mon Sep 17 00:00:00 2001 From: Sebastian Reimers Date: Thu, 4 Jul 2024 20:24:42 +0200 Subject: [PATCH 10/18] ci/build: use only macos-latest (#1153) --- .github/workflows/build.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f3f03d15b..5553df290 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,11 +16,9 @@ jobs: matrix: build_type: [Release, Debug] compiler: [gcc, clang] - os: [ubuntu-20.04, ubuntu-22.04, macos-11, macos-12] + os: [ubuntu-20.04, ubuntu-22.04, macos-latest] exclude: - - os: macos-11 - compiler: gcc - - os: macos-12 + - os: macos-latest compiler: gcc env: CC: ${{ matrix.compiler }} From 24a78db1c3f0050af5b0b1b70f9c3cb165c80394 Mon Sep 17 00:00:00 2001 From: Sebastian Reimers Date: Thu, 4 Jul 2024 20:25:39 +0200 Subject: [PATCH 11/18] cmake: fix resolv on FreeBSD (#1152) * ci/freebsd: use ubuntu-latest * resolv functions are provided by libc instead libresolv.so --- .github/workflows/freebsd.yml | 2 +- cmake/re-config.cmake | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/freebsd.yml b/.github/workflows/freebsd.yml index 6e56cb400..26411337e 100644 --- a/.github/workflows/freebsd.yml +++ b/.github/workflows/freebsd.yml @@ -10,7 +10,7 @@ on: jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest timeout-minutes: 20 env: diff --git a/cmake/re-config.cmake b/cmake/re-config.cmake index 426a79db4..c45216800 100644 --- a/cmake/re-config.cmake +++ b/cmake/re-config.cmake @@ -55,7 +55,10 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") else() check_symbol_exists(res_ninit resolv.h HAVE_RESOLV) endif() -if(HAVE_RESOLV) +if(HAVE_RESOLV AND ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") + list(APPEND RE_DEFINITIONS HAVE_RESOLV) + set(RESOLV_LIBRARY) # Provided by libc +elseif(HAVE_RESOLV) set(RESOLV_LIBRARY resolv) list(APPEND RE_DEFINITIONS HAVE_RESOLV) else() From d3e521b9eaa5083730b8fc830c39c92776e8f02e Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" <114750+alfredh@users.noreply.github.com> Date: Thu, 4 Jul 2024 20:26:16 +0200 Subject: [PATCH 12/18] test: use h264_stap_decode_annexb() (#1151) --- test/h264.c | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/test/h264.c b/test/h264.c index 186724b10..2b8168cc2 100644 --- a/test/h264.c +++ b/test/h264.c @@ -635,29 +635,12 @@ static int depack_handle_h264(struct state *st, bool marker, } else if (H264_NALU_STAP_A == h264_hdr.type) { - while (mbuf_get_left(src) >= 2) { - - uint16_t len = ntohs(mbuf_read_u16(src)); - struct h264_nal_header lhdr; - - if (mbuf_get_left(src) < len) - return EBADMSG; - - err = h264_nal_header_decode(&lhdr, src); - if (err) - return err; - - --src->pos; - - err = mbuf_write_mem(st->mb, - st->long_startcode ? nal_seq4 : nal_seq3, - nal_seq_len); - err |= mbuf_write_mem(st->mb, mbuf_buf(src), len); - if (err) - goto out; - - src->pos += len; - } + if (st->long_startcode) + err = h264_stap_decode_annexb_long(st->mb, src); + else + err = h264_stap_decode_annexb(st->mb, src); + if (err) + goto out; } else { DEBUG_WARNING("decode: unknown NAL type %u\n", From 0bd4551b1c5371e8c5e9610fc5c629c707dba7fb Mon Sep 17 00:00:00 2001 From: Maximilian Fridrich Date: Wed, 10 Jul 2024 17:50:41 +0200 Subject: [PATCH 13/18] sipsess/reply: terminate session if no (PR)ACK received after 64*T1 (#1155) --- src/sipsess/reply.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/sipsess/reply.c b/src/sipsess/reply.c index 3f1d47104..30d98ff16 100644 --- a/src/sipsess/reply.c +++ b/src/sipsess/reply.c @@ -51,10 +51,6 @@ static void tmr_handler(void *arg) struct sipsess_reply *reply = arg; struct sipsess *sess = reply->sess; - /* wait for all pending ACKs */ - if (sess->replyl.head) - goto out; - /* we want to send bye */ if (!sess->terminated) { @@ -64,14 +60,15 @@ static void tmr_handler(void *arg) } else { sess->established = true; + mem_deref(reply); sipsess_terminate(sess, ETIMEDOUT, NULL); + return; } } else { mem_deref(sess); } -out: mem_deref(reply); } From 542a85924ebfb347b7bf1c7baa471ee5ffe2d961 Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" <114750+alfredh@users.noreply.github.com> Date: Sat, 13 Jul 2024 17:34:56 +0200 Subject: [PATCH 14/18] rtcp: send BYE manually (#1154) --- include/re_rtp.h | 1 + src/rtp/sess.c | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/re_rtp.h b/include/re_rtp.h index 05ae35a0a..449ad1a28 100644 --- a/include/re_rtp.h +++ b/include/re_rtp.h @@ -274,6 +274,7 @@ int rtcp_send_fir_rfc5104(struct rtp_sock *rs, uint32_t ssrc, int rtcp_debug(struct re_printf *pf, const struct rtp_sock *rs); void *rtcp_sock(const struct rtp_sock *rs); int rtcp_stats(struct rtp_sock *rs, uint32_t ssrc, struct rtcp_stats *stats); +int rtcp_send_bye_packet(struct rtp_sock *rs); /* RTCP utils */ int rtcp_encode(struct mbuf *mb, enum rtcp_type type, uint32_t count, ...); diff --git a/src/rtp/sess.c b/src/rtp/sess.c index 88b5773c6..6ee6e767e 100644 --- a/src/rtp/sess.c +++ b/src/rtp/sess.c @@ -65,16 +65,12 @@ struct rtcp_sess { /* Prototypes */ static void schedule(struct rtcp_sess *sess); -static int send_bye_packet(struct rtcp_sess *sess); static void sess_destructor(void *data) { struct rtcp_sess *sess = data; - if (sess->cname) - (void)send_bye_packet(sess); - tmr_cancel(&sess->tmr); mem_deref(sess->cname); @@ -509,9 +505,13 @@ static int send_rtcp_report(struct rtcp_sess *sess) } -static int send_bye_packet(struct rtcp_sess *sess) +int rtcp_send_bye_packet(struct rtp_sock *rs) { - const uint32_t ssrc = rtp_sess_ssrc(sess->rs); + if (!rs) + return EINVAL; + + struct rtcp_sess *sess = rtp_rtcp_sess(rs); + const uint32_t ssrc = rtp_sess_ssrc(rs); struct mbuf *mb; int err; From db1ad513089d1657fb38136f8658c51248dd9c34 Mon Sep 17 00:00:00 2001 From: Sebastian Reimers Date: Sat, 20 Jul 2024 15:52:44 +0200 Subject: [PATCH 15/18] cmake: check accept4 only on linux (#1157) Looks like iOS SDK is incorrectly detecting accept4 support --- cmake/re-config.cmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmake/re-config.cmake b/cmake/re-config.cmake index c45216800..f914f761f 100644 --- a/cmake/re-config.cmake +++ b/cmake/re-config.cmake @@ -80,9 +80,11 @@ if(HAVE_THREADS) list(APPEND RE_DEFINITIONS HAVE_THREADS) endif() -check_function_exists(accept4 HAVE_ACCEPT4) -if(HAVE_ACCEPT4) - list(APPEND RE_DEFINITIONS HAVE_ACCEPT4) +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + check_function_exists(accept4 HAVE_ACCEPT4) + if(HAVE_ACCEPT4) + list(APPEND RE_DEFINITIONS HAVE_ACCEPT4) + endif() endif() if(CMAKE_USE_PTHREADS_INIT) From 79bb7b0c03416b2a2e3f77b6d9f95dba67e98028 Mon Sep 17 00:00:00 2001 From: Sebastian Reimers Date: Sat, 20 Jul 2024 16:27:55 +0200 Subject: [PATCH 16/18] cmake: fix iOS HAVE_ROUTE_LIST and darwin dns --- CMakeLists.txt | 4 ++++ cmake/re-config.cmake | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aa619e39a..981052de0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -585,6 +585,10 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") src/dns/darwin/srv.c src/net/bsd/brt.c ) +elseif(${CMAKE_SYSTEM_NAME} MATCHES "iOS") + list(APPEND SRCS + src/dns/darwin/srv.c + ) elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") list(APPEND SRCS src/net/bsd/brt.c diff --git a/cmake/re-config.cmake b/cmake/re-config.cmake index f914f761f..eb2bf42a2 100644 --- a/cmake/re-config.cmake +++ b/cmake/re-config.cmake @@ -118,7 +118,6 @@ list(APPEND RE_DEFINITIONS if(UNIX) list(APPEND RE_DEFINITIONS HAVE_PWD_H - HAVE_ROUTE_LIST HAVE_SETRLIMIT HAVE_STRERROR_R HAVE_STRINGS_H @@ -131,6 +130,9 @@ if(UNIX) if(NOT ANDROID) list(APPEND RE_DEFINITIONS HAVE_GETIFADDRS) endif() + if(NOT IOS) + list(APPEND RE_DEFINITIONS HAVE_ROUTE_LIST) + endif() endif() From b8b887292563c3db73aa27789d72bec04385db09 Mon Sep 17 00:00:00 2001 From: Sebastian Reimers Date: Sat, 20 Jul 2024 16:33:15 +0200 Subject: [PATCH 17/18] ci/ios: add normal build --- .github/workflows/ios.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 6c0fde21b..36b363e53 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -15,7 +15,12 @@ jobs: steps: - uses: actions/checkout@v4 - - name: build + - name: build Xcode run: | - cmake -B build -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 -DCMAKE_DISABLE_FIND_PACKAGE_OpenSSL=ON -DUSE_OPENSSL=OFF -DCMAKE_C_FLAGS="-Werror" - cmake --build build -- CODE_SIGNING_ALLOWED=NO + cmake -B build_xcode -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 -DCMAKE_DISABLE_FIND_PACKAGE_OpenSSL=ON -DUSE_OPENSSL=OFF -DCMAKE_C_FLAGS="-Werror" + cmake --build build_xcode -- CODE_SIGNING_ALLOWED=NO + + - name: normal build + run: | + cmake -B build -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 -DCMAKE_DISABLE_FIND_PACKAGE_OpenSSL=ON -DUSE_OPENSSL=OFF -DCMAKE_C_FLAGS="-Werror" + cmake --build build -j From ab4186e9aec67d61177da89a5ccf712727d4731d Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" <114750+alfredh@users.noreply.github.com> Date: Mon, 22 Jul 2024 15:01:33 +0200 Subject: [PATCH 18/18] test: check if header and payload is set --- test/h264.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/h264.c b/test/h264.c index 2b8168cc2..9db0e0fef 100644 --- a/test/h264.c +++ b/test/h264.c @@ -670,7 +670,7 @@ static int packet_handler(bool marker, uint64_t rtp_ts, { struct state *state = arg; struct mbuf *mb_pkt = mbuf_alloc(hdr_len + pld_len); - int err; + int err = 0; if (!mb_pkt) return ENOMEM; @@ -679,8 +679,12 @@ static int packet_handler(bool marker, uint64_t rtp_ts, ++state->count; - err = mbuf_write_mem(mb_pkt, hdr, hdr_len); - err |= mbuf_write_mem(mb_pkt, pld, pld_len); + if (hdr && hdr_len) + err |= mbuf_write_mem(mb_pkt, hdr, hdr_len); + + if (pld && pld_len) + err |= mbuf_write_mem(mb_pkt, pld, pld_len); + if (err) goto out;