diff --git a/daemon/call.c b/daemon/call.c index 04e0efb91..764725349 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/cli.c b/daemon/cli.c index 37bca6ac4..e41397c08 100644 --- a/daemon/cli.c +++ b/daemon/cli.c @@ -18,11 +18,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; diff --git a/daemon/ice.c b/daemon/ice.c index dcd7c0fd9..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) { @@ -283,11 +285,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); } @@ -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; @@ -518,7 +521,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 +535,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); @@ -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 */ 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)); + } } } 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 ] diff --git a/debian/control b/debian/control index 4077c33d6..09b49a5a8 100644 --- a/debian/control +++ b/debian/control @@ -17,6 +17,7 @@ Homepage: http://sipwise.com/ Package: ngcp-rtpengine-daemon Architecture: any +Suggests: ngcp-system-tools Depends: ${misc:Depends}, ${shlibs:Depends} Conflicts: ngcp-mediaproxy-ng-daemon @@ -62,6 +63,7 @@ Description: IPtables kernel module for the NGCP media proxy - source. Package: ngcp-rtpengine-kernel-dkms Architecture: all +Suggests: ngcp-system-tools Depends: dkms (>= 1.95), ${misc:Depends} Conflicts: ngcp-mediaproxy-ng-kernel-dkms