From b85baee230a086143d866dba4f2961b85b4421e0 Mon Sep 17 00:00:00 2001 From: Alexander Lutay Date: Wed, 8 Apr 2015 17:27:38 +0200 Subject: [PATCH 1/6] MT#11493 Release new version 4.0.0.0+0~mr4.0.0.0 Change-Id: Ibf6dd7188650438dfd6950646aacf8412fae3cb1 --- debian/changelog | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/debian/changelog b/debian/changelog index ffa836f4b..d1ff5a63f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,35 @@ +ngcp-rtpengine (4.0.0.0+0~mr4.0.0.0) unstable; urgency=medium + + [ Richard Fuchs ] + * [2db33ef] reset ICE/STUN retransmit data on triggered checks + * [20ac7cd] process nominating ICE request only once per pair + * [93294f8] don't relearn addresses if the endpoint hasn't changed + * [0b202d8] Fall back to a different address family if the requested one is unavailable + * [fd99ecf] don't close call on UDP send error + * [c0fab9b] various fixes related to ICE negotation and rtcp-mux + * [2cfc12b] fix incorrect free order of ICE components + + [ Peter Lemenkov ] + * [eba4414] Remove BuildRoot + * [597c35a] Remove duplicated text in descriptions + * [49ed2a8] Remove autoadded deps + * [b0240ee] Use generic dependency name for nc + * [cd70a8f] Use proper versionin scheme + * [8d56ed5] Typo fix in Source0 url + * [9890371] Remove no longer required section + * [234b454] Use macro instead of /etc/rc.d/init.d + * [882731b] Remove double slash + * [d25b697] Check for username,group before creating + * [e71a7e1] Consistently use rtpengine name everywhere + * [a6ab5b5] Restrict access to a working directory + * [9a12b49] Don't specify access rights for _usrsrc dir + * [3b27031] Explicitly set rights on dkms.conf as 644 + + [ Alexander Lutay ] + * [3a45a16] MT#7505 Add .gitreview file for rtpengine + + -- Alexander Lutay Wed, 08 Apr 2015 17:26:40 +0200 + ngcp-rtpengine (3.3.0.0+0~mr4.0.0.0) unstable; urgency=low [ Sergey Lavrov ] From 3acc850083240edbc14ddbc7fe6a556fbce5e295 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 9 Apr 2015 09:49:50 -0400 Subject: [PATCH 2/6] zero-fill padding bytes --- daemon/stun.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/daemon/stun.c b/daemon/stun.c index 85ac584ea..3a5de6273 100644 --- a/daemon/stun.c +++ b/daemon/stun.c @@ -271,6 +271,11 @@ INLINE void __output_add(struct msghdr *mh, struct tlv *tlv, unsigned int len, u iov = &mh->msg_iov[mh->msg_iovlen++]; iov->iov_base = append; /* must have space for padding */ iov->iov_len = (append_len + 3) & 0xfffc; + + if ((append_len & 0x3)) { + if (memcmp(append + append_len, "\0\0\0", 4 - (append_len & 0x3))) + memset(append + append_len, 0, 4 - (append_len & 0x3)); + } } } From d50208488d0b49dd3149b9bfdd1a60e1e275b430 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Thu, 9 Apr 2015 09:50:15 -0400 Subject: [PATCH 3/6] fix refcount bug fixes double-free and mem corruption bugs (segfault fix) closes #96 --- daemon/ice.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/daemon/ice.c b/daemon/ice.c index dcd7c0fd9..25ee60e2b 100644 --- a/daemon/ice.c +++ b/daemon/ice.c @@ -283,11 +283,11 @@ static int __copy_cand(struct call *call, struct ice_candidate *dst, const struc } static void __ice_reset(struct ice_agent *ag) { + __agent_deschedule(ag); AGENT_CLEAR2(ag, COMPLETED, NOMINATING); __ice_agent_free_components(ag); ZERO(ag->active_components); ZERO(ag->start_nominating); - ZERO(ag->next_check); ZERO(ag->last_run); __ice_agent_initialize(ag); } @@ -518,7 +518,7 @@ static void __agent_schedule_abs(struct ice_agent *ag, const struct timeval *tv) if (ag->next_check.tv_sec && timeval_cmp(&ag->next_check, &nxt) <= 0) goto nope; /* already scheduled sooner */ if (!g_tree_remove(ice_agents_timers, ag)) - obj_hold(ag); /* if it wasn't removed (should never happen), we make a new reference */ + obj_hold(ag); /* if it wasn't removed, we make a new reference */ ag->next_check = nxt; g_tree_insert(ice_agents_timers, ag, ag); cond_broadcast(&ice_agents_timers_cond); @@ -532,7 +532,7 @@ static void __agent_deschedule(struct ice_agent *ag) { goto nope; /* already descheduled */ ret = g_tree_remove(ice_agents_timers, ag); ZERO(ag->next_check); - if (ret) /* should always be true */ + if (ret) obj_put(ag); nope: mutex_unlock(&ice_agents_timers_lock); From 46c60e5284c543be5230a976329fd7e1c08ca98c Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Mon, 13 Apr 2015 22:21:09 +0200 Subject: [PATCH 4/6] MT#12519 debian/control: switch from Pre-Depends to Suggests for ngcp-system-tools package On upgrades from 2.8 LTS we have to install ngcp-rtpengine-kernl-dkms package before the upgrade in order to get dkms to work. No need to upgrade the new version of ngcp-system-tools too Change-Id: I36fbfdffc5ca1e283ba0e8d5a42a96a72fbf324e --- debian/control | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index 146e2d6ed..09b49a5a8 100644 --- a/debian/control +++ b/debian/control @@ -17,7 +17,7 @@ Homepage: http://sipwise.com/ Package: ngcp-rtpengine-daemon Architecture: any -Pre-Depends: ngcp-system-tools +Suggests: ngcp-system-tools Depends: ${misc:Depends}, ${shlibs:Depends} Conflicts: ngcp-mediaproxy-ng-daemon @@ -63,7 +63,7 @@ Description: IPtables kernel module for the NGCP media proxy - source. Package: ngcp-rtpengine-kernel-dkms Architecture: all -Pre-Depends: ngcp-system-tools +Suggests: ngcp-system-tools Depends: dkms (>= 1.95), ${misc:Depends} Conflicts: ngcp-mediaproxy-ng-kernel-dkms From 4ea8d9603358bb336abb19fbdf947dd2a936f875 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 14 Apr 2015 11:35:30 -0400 Subject: [PATCH 5/6] remove stray compiler warning --- daemon/cli.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/daemon/cli.c b/daemon/cli.c index 711812531..88cddafe1 100644 --- a/daemon/cli.c +++ b/daemon/cli.c @@ -17,11 +17,13 @@ static const char* TRUNCATED = " ... Output truncated. Increase Output Buffer ...\n"; -#define truncate_output(x) do { x -= strlen(TRUNCATED)+1; x += sprintf(x,"%s",TRUNCATED); } while (0); +#define truncate_output(x) strcpy(x - strlen(TRUNCATED) - 1, TRUNCATED) -#define ADJUSTLEN(printlen,outbuflen,replybuffer) do { if (printlen>=(outbufend-replybuffer)) \ - truncate_output(replybuffer); \ - replybuffer += (printlen>=outbufend-replybuffer)?outbufend-replybuffer:printlen; } while (0); +#define ADJUSTLEN(printlen,outbuflen,replybuffer) do { \ + replybuffer += (printlen>=outbufend-replybuffer)?outbufend-replybuffer:printlen; \ + if (replybuffer == outbufend) \ + truncate_output(replybuffer); \ + } while (0); static void cli_incoming_list_totals(char* buffer, int len, struct callmaster* m, char* replybuffer, const char* outbufend) { int printlen=0; From ba48d7b518739cbf4dd97c1da8353329764e1eef Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 15 Apr 2015 11:06:31 -0400 Subject: [PATCH 6/6] fix call timeout when ICE fails --- daemon/call.c | 11 ++++++----- daemon/ice.c | 9 +++++++++ daemon/ice.h | 1 + 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index 34255e1d9..16a254aaa 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -1083,6 +1083,7 @@ static void call_timer_iterator(void *key, void *val, void *ptr) { struct call_monologue *ml; GSList *i; enum call_stream_state css; + atomic64 *timestamp; rwlock_lock_r(&c->master_lock); log_info_call(c); @@ -1104,6 +1105,8 @@ static void call_timer_iterator(void *key, void *val, void *ptr) { for (it = c->streams; it; it = it->next) { ps = it->data; + timestamp = &ps->last_packet; + if (!ps->media) goto next; sfd = ps->sfd; @@ -1114,10 +1117,8 @@ static void call_timer_iterator(void *key, void *val, void *ptr) { css = call_stream_state_machine(ps); - if (css == CSS_ICE) { - good = 1; - goto next; - } + if (css == CSS_ICE) + timestamp = &ps->media->ice_agent->last_activity; if (hlp->ports[sfd->fd.localport]) goto next; @@ -1135,7 +1136,7 @@ no_sfd: tmp_t_reason = 2; } - if (poller_now - atomic64_get(&ps->last_packet) < check) + if (poller_now - atomic64_get(timestamp) < check) good = 1; next: diff --git a/daemon/ice.c b/daemon/ice.c index 25ee60e2b..b7e9ea81b 100644 --- a/daemon/ice.c +++ b/daemon/ice.c @@ -249,6 +249,8 @@ static void __ice_agent_initialize(struct ice_agent *ag) { create_random_ice_string(call, &ag->ufrag[1], 8); create_random_ice_string(call, &ag->pwd[1], 26); + + atomic64_set(&ag->last_activity, poller_now); } static struct ice_agent *__ice_agent_new(struct call_media *media) { @@ -322,6 +324,7 @@ void ice_update(struct ice_agent *ag, struct stream_params *sp) { if (!ag) return; + atomic64_set(&ag->last_activity, poller_now); media = ag->media; call = media->call; @@ -690,6 +693,8 @@ static void __do_ice_checks(struct ice_agent *ag) { if (!ag->pwd[0].s) return; + atomic64_set(&ag->last_activity, poller_now); + __DBG("running checks, call "STR_FORMAT" tag "STR_FORMAT"", STR_FMT(&ag->call->callid), STR_FMT(&ag->media->monologue->tag)); @@ -1049,6 +1054,8 @@ int ice_request(struct packet_stream *ps, struct sockaddr_in6 *src, struct in6_a if (!ag) return -1; + atomic64_set(&ag->last_activity, poller_now); + ifa = get_interface_from_address(ag->local_interface, dst); err = "ICE/STUN binding request received on unknown local interface address"; if (!ifa) @@ -1157,6 +1164,8 @@ int ice_response(struct packet_stream *ps, struct sockaddr_in6 *src, struct in6_ if (!ag) return -1; + atomic64_set(&ag->last_activity, poller_now); + mutex_lock(&ag->lock); pair = g_hash_table_lookup(ag->transaction_hash, transaction); diff --git a/daemon/ice.h b/daemon/ice.h index 44fe15adc..cd7922ee4 100644 --- a/daemon/ice.h +++ b/daemon/ice.h @@ -111,6 +111,7 @@ struct ice_agent { struct call_media *media; struct local_interface *local_interface; int desired_family; + atomic64 last_activity; mutex_t lock; /* for elements below. and call must be locked in R */ /* lock order: in_lock first, then agent->lock */