From 2af6de638dfaebce8dfdce5e5c2e41e343e9d0fe Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 2 May 2025 08:13:25 -0400 Subject: [PATCH] MT#62735 add tests for I2a2cdd9476 Change-Id: I772b2854f3ed3d36705bc2488786f6661a94cf28 --- t/auto-daemon-tests.pl | 69 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/t/auto-daemon-tests.pl b/t/auto-daemon-tests.pl index 344583121..ec1f00016 100755 --- a/t/auto-daemon-tests.pl +++ b/t/auto-daemon-tests.pl @@ -84,6 +84,75 @@ sub stun_succ { +($sock_a, $sock_b, $sock_c) = new_call([qw(198.51.100.1 7188)], [qw(198.51.100.3 7190)], [qw(198.51.100.5 5192)]); + +($port_a) = offer('SRTP hijack <> RTP', { 'transport-protocol' => 'RTP/AVP' }, < RTP', { }, < $NGCP::Rtpclient::SRTP::crypto_suites{AES_CM_128_HMAC_SHA1_80}, + key => 'QjnnaukLn7iwASAs0YLzPUplJkjOhTZK2dvOwo6c', +}; +$srtp_ctx_b = { + cs => $NGCP::Rtpclient::SRTP::crypto_suites{AES_CM_128_HMAC_SHA1_80}, + key => $srtp_key_b, +}; + + snd($sock_b, $port_a, rtp(8, 1000, 3000, 0x1234, "\x00" x 160)); +srtp_rcv($sock_a, $port_b, rtpm(8, 1000, 3000, 0x1234, "\x00" x 160), $srtp_ctx_b); + +srtp_snd($sock_a, $port_b, rtp(8, 2000, 4000, 0x6543, "\x11" x 160), $srtp_ctx_a); + rcv($sock_b, $port_a, rtpm(8, 2000, 4000, 0x6543, "\x11" x 160)); + +# attempt inject/hijack + + snd($sock_c, $port_b, rtp(8, 2001, 4160, 0x6543, "\x11" x 160)); + rcv_no($sock_b); + + snd($sock_b, $port_a, rtp(8, 1001, 3160, 0x1234, "\x00" x 160)); + rcv_no($sock_c); +srtp_rcv($sock_a, $port_b, rtpm(8, 1001, 3160, 0x1234, "\x00" x 160), $srtp_ctx_b); + + + + new_call; offer('L16 default', { codec => { transcode => ['L16/44100'] } }, <