Merge branch 'sipwise:master' into el-systemd

pull/1292/head
Karsten Horsmann 5 years ago committed by GitHub
commit fc265e0b3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -11,17 +11,18 @@ jobs:
runs-on: ubuntu-latest
name: Run unit tests
env:
FLAGS: "-ggdb -O0 -fsanitize=address -fsanitize=leak -fsanitize=undefined"
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Update APT cache
run: |
sudo apt-get update
- name: Get build dependencies
run: |
sudo apt-get build-dep -qq -y -Ppkg.ngcp-rtpengine.nobcg729 .
- name: Run unit tests with sanitizers enabled
run: |
CFLAGS="$FLAGS" LDFLAGS="$FLAGS" ASAN_OPTIONS=verify_asan_link_order=0 UBSAN_OPTIONS=print_stacktrace=1 G_SLICE=always-malloc make check
make asan-check

@ -1,6 +1,18 @@
RTPENGINE_ROOT_DIR=.
with_transcoding ?= yes
ifeq ($(DO_ASAN_FLAGS),1)
ASAN_FLAGS = -ggdb -O0 -fsanitize=address -fsanitize=leak -fsanitize=undefined
CFLAGS ?= -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wstrict-prototypes
CFLAGS += $(ASAN_FLAGS)
LDFLAGS += $(ASAN_FLAGS)
export CFLAGS
export LDFLAGS
export ASAN_OPTIONS=verify_asan_link_order=0
export UBSAN_OPTIONS=print_stacktrace=1
export G_SLICE=always-malloc
endif
include lib/lib.Makefile
.PHONY: all distclean clean coverity
@ -36,7 +48,10 @@ distclean clean:
$(MAKE) -C iptables-extension $@
$(MAKE) -C kernel-module $@
.PHONY: check
.PHONY: check asan-check
check: all
$(MAKE) -C t
asan-check:
DO_ASAN_FLAGS=1 $(MAKE) check

@ -1023,8 +1023,7 @@ static void __fill_stream(struct packet_stream *ps, const struct endpoint *epp,
if (PS_ISSET(ps, FILLED) && !MEDIA_ISSET(media, DTLS)) {
/* we reset crypto params whenever the endpoint changes */
// XXX fix WRT SSRC handling
crypto_reset(&ps->crypto);
call_stream_crypto_reset(ps);
dtls_shutdown(ps);
}
@ -1036,6 +1035,20 @@ static void __fill_stream(struct packet_stream *ps, const struct endpoint *epp,
PS_SET(ps, PIERCE_NAT);
}
void call_stream_crypto_reset(struct packet_stream *ps) {
crypto_reset(&ps->crypto);
mutex_lock(&ps->in_lock);
if (ps->ssrc_in)
ps->ssrc_in->srtp_index = 0;
mutex_unlock(&ps->in_lock);
mutex_lock(&ps->out_lock);
if (ps->ssrc_out)
ps->ssrc_out->srtp_index = 0;
mutex_unlock(&ps->out_lock);
}
/* called with call locked in R or W, but ps not locked */
enum call_stream_state call_stream_state_machine(struct packet_stream *ps) {
struct call_media *media = ps->media;

@ -816,7 +816,7 @@ void dtls_shutdown(struct packet_stream *ps) {
ps->dtls_cert = NULL;
}
crypto_reset(&ps->crypto);
call_stream_crypto_reset(ps);
}
void dtls_connection_cleanup(struct dtls_connection *c) {

@ -31,7 +31,7 @@ fi
###
if [ -x "$(which ngcp-virt-identify)" ]; then
if [ -x "$(which ngcp-virt-identify 2>/dev/null)" ]; then
if ngcp-virt-identify --type container; then
VIRT="yes"
fi

@ -541,6 +541,7 @@ void add_total_calls_duration_in_interval(struct timeval *interval_tv);
void payload_type_free(struct rtp_payload_type *p);
void __rtp_stats_update(GHashTable *dst, GHashTable *src);
int __init_stream(struct packet_stream *ps);
void call_stream_crypto_reset(struct packet_stream *ps);
const struct rtp_payload_type *__rtp_stats_codec(struct call_media *m);

@ -158,7 +158,6 @@ INLINE void crypto_cleanup(struct crypto_context *c) {
c->params.crypto_suite = NULL;
}
INLINE void crypto_reset(struct crypto_context *c) {
// XXX reset details from ssrc_ctx?
crypto_cleanup(c);
}
INLINE void crypto_params_copy(struct crypto_params *o, const struct crypto_params *i, int copy_sp) {

@ -3449,6 +3449,9 @@ static int send_proxy_packet4(struct sk_buff *skb, struct re_address *src, struc
(LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,78) && LINUX_VERSION_CODE < KERNEL_VERSION(5,5,0)) || \
(LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,158) && LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0))
if (ip_route_me_harder(par->state->net, par->state->sk, skb, RTN_UNSPEC))
#elif defined(RHEL_RELEASE_CODE) && LINUX_VERSION_CODE >= KERNEL_VERSION(4,18,0) && \
RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(8,4)
if (ip_route_me_harder(par->state->net, par->state->sk, skb, RTN_UNSPEC))
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
if (ip_route_me_harder(par->state->net, skb, RTN_UNSPEC))
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0)
@ -3549,6 +3552,9 @@ static int send_proxy_packet6(struct sk_buff *skb, struct re_address *src, struc
(LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,78) && LINUX_VERSION_CODE < KERNEL_VERSION(5,5,0)) || \
(LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,158) && LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0))
if (ip6_route_me_harder(par->state->net, par->state->sk, skb))
#elif defined(RHEL_RELEASE_CODE) && LINUX_VERSION_CODE >= KERNEL_VERSION(4,18,0) && \
RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(8,4)
if (ip6_route_me_harder(par->state->net, par->state->sk, skb))
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
if (ip6_route_me_harder(par->state->net, skb))
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0)

@ -161,7 +161,7 @@ int rtp_payload_type_cmp_nf(const struct rtp_payload_type *a, const struct rtp_p
return 1;
if (a->channels != b->channels)
return 1;
if (str_casecmp_str(&a->encoding_with_params, &b->encoding_with_params))
if (str_casecmp_str(&a->encoding, &b->encoding))
return 1;
return 0;
}

@ -40,6 +40,58 @@ my ($sock_a, $sock_b, $sock_c, $sock_d, $port_a, $port_b, $ssrc, $ssrc_b, $resp,
new_call;
offer('t/c and implicit number of channels',
{ codec => { transcode => ['opus','PCMA'] } }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio 6000 RTP/AVP 0 102
c=IN IP4 198.51.100.20
a=rtpmap:102 opus/48000/1
a=sendrecv
----------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio PORT RTP/AVP 0 102 8
c=IN IP4 203.0.113.1
a=rtpmap:0 PCMU/8000
a=rtpmap:102 opus/48000/1
a=rtpmap:8 PCMA/8000
a=sendrecv
a=rtcp:PORT
SDP
answer('t/c and implicit number of channels',
{ }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio 6002 RTP/AVP 102
c=IN IP4 198.51.100.20
a=rtpmap:102 opus/48000
a=ptime:20
a=sendrecv
----------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio PORT RTP/AVP 102
c=IN IP4 203.0.113.1
a=rtpmap:102 opus/48000
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
($sock_a, $sock_b) = new_call([qw(198.51.100.14 6008)], [qw(198.51.100.14 6010)]);
($port_a, undef, $srtp_key_a) = offer('CN passthrough',
@ -3022,6 +3074,63 @@ SDP
if ($amr_tests) {
new_call;
offer('t/c and implicit number of channels',
{ codec => { transcode => ['AMR','PCMA'] } }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio 6000 RTP/AVP 0 102
c=IN IP4 198.51.100.20
a=rtpmap:102 AMR/8000/1
a=fmtp:102 mode-change-capability=2;max-red=0
a=sendrecv
----------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio PORT RTP/AVP 0 102 8
c=IN IP4 203.0.113.1
a=rtpmap:0 PCMU/8000
a=rtpmap:102 AMR/8000/1
a=fmtp:102 mode-change-capability=2;max-red=0
a=rtpmap:8 PCMA/8000
a=sendrecv
a=rtcp:PORT
SDP
answer('t/c and implicit number of channels',
{ }, <<SDP);
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio 6002 RTP/AVP 102
c=IN IP4 198.51.100.20
a=rtpmap:102 AMR/8000
a=fmtp:102 octet-align=0; mode-set=7; max-red=0; mode-change-capability=2
a=ptime:20
a=sendrecv
----------------------------------
v=0
o=- 1545997027 1 IN IP4 198.51.100.1
s=tester
t=0 0
m=audio PORT RTP/AVP 0 102
c=IN IP4 203.0.113.1
a=rtpmap:0 PCMU/8000
a=rtpmap:102 AMR/8000
a=fmtp:102 octet-align=0; mode-set=7; max-red=0; mode-change-capability=2
a=sendrecv
a=rtcp:PORT
a=ptime:20
SDP
# AMR-WB b2b transcoding
($sock_a, $sock_b) = new_call([qw(198.51.100.10 3062)], [qw(198.51.100.10 3064)]);

Loading…
Cancel
Save