pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-netif/+/29520 )


Change subject: tests/osmux: Test rx of osmux seqnum wrap around
......................................................................

tests/osmux: Test rx of osmux seqnum wrap around

This test shows that there's a bug where the first RTP packet extracted
from the received osmux batch with seqnum=0 has the M bit marked for no
good reason.

Related: SYS#5987
Change-Id: Ida658c681e84878f209ab4965d8aa821a570a580
---
M tests/osmux/osmux_output_test.c
M tests/osmux/osmux_output_test.ok
2 files changed, 42 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/20/29520/1

diff --git a/tests/osmux/osmux_output_test.c b/tests/osmux/osmux_output_test.c
index 46065fe..94d6a5b 100644
--- a/tests/osmux/osmux_output_test.c
+++ b/tests/osmux/osmux_output_test.c
@@ -390,6 +390,36 @@
        talloc_free(h_output);
 }

+/* Test how the osmux_out_handle behaves when seqnum 0xff->0x00 is received */
+static void test_output_seqnum_wraparound(void)
+{
+       struct osmux_out_handle *h_output;
+
+       printf("===test_output_seqnum_wraparound===\n");
+
+       clock_override_enable(true);
+       clock_override_set(0, 0);
+       osmux_init(0xff);
+
+       h_output = osmux_xfrm_output_alloc(NULL);
+       osmux_xfrm_output_set_rtp_ssrc(h_output, 0x7000000);
+       osmux_xfrm_output_set_rtp_pl_type(h_output, 98);
+       osmux_xfrm_output_set_tx_cb(h_output, tx_cb, h_output);
+       h_output->rtp_seq = (uint16_t)50;
+       h_output->rtp_timestamp = (uint32_t)500;
+       h_output->osmux_seq_ack = 0xff;
+
+       clock_debug("Sending osmux frame with seqnum=0");
+       PULL_NEXT(h_output);
+       clock_override_add(0, 2*TIME_RTP_PKT_MS*1000);
+       osmo_select_main(0);
+
+       clock_debug("flushing other RTP packets");
+       osmux_xfrm_output_flush(h_output);
+
+       talloc_free(h_output);
+}
+
 int main(int argc, char **argv)
 {

@@ -412,6 +442,7 @@
        test_output_2together();
        test_output_frame_lost();
        test_output_flush();
+       test_output_seqnum_wraparound();

        fprintf(stdout, "OK: Test passed\n");
        return EXIT_SUCCESS;
diff --git a/tests/osmux/osmux_output_test.ok b/tests/osmux/osmux_output_test.ok
index 53ab67d..f69c0a9 100644
--- a/tests/osmux/osmux_output_test.ok
+++ b/tests/osmux/osmux_output_test.ok
@@ -105,4 +105,15 @@
 sys={0.040000}, mono={0.040000}: dequeue: seq=59 ts=1940 enqueued=2
 sys={0.040000}, mono={0.040000}: dequeue: seq=60 ts=2100 enqueued=1
 sys={0.040000}, mono={0.040000}: dequeue: seq=61 ts=2260 enqueued=0
+===test_output_seqnum_wraparound===
+sys={0.000000}, mono={0.000000}: clock_override_set
+sys={0.000000}, mono={0.000000}: Sending osmux frame with seqnum=0
+sys={0.000000}, mono={0.000000}: dequeue: seq=50 ts=500 M enqueued=5
+sys={0.040000}, mono={0.040000}: clock_override_add
+sys={0.040000}, mono={0.040000}: dequeue: seq=51 ts=660 enqueued=4
+sys={0.040000}, mono={0.040000}: dequeue: seq=52 ts=820 enqueued=3
+sys={0.040000}, mono={0.040000}: flushing other RTP packets
+sys={0.040000}, mono={0.040000}: dequeue: seq=53 ts=980 enqueued=2
+sys={0.040000}, mono={0.040000}: dequeue: seq=54 ts=1140 enqueued=1
+sys={0.040000}, mono={0.040000}: dequeue: seq=55 ts=1300 enqueued=0
 OK: Test passed

--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/29520
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: Ida658c681e84878f209ab4965d8aa821a570a580
Gerrit-Change-Number: 29520
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-MessageType: newchange

Reply via email to