diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2014-10-06 21:01:26 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2014-10-09 17:22:33 +0200 |
commit | 05d481a42cb119c51773209528cc15d3d4584e79 (patch) | |
tree | 0235cde9bec83233e6f27b043d0b2287977471ea /openbsc/tests | |
parent | a5a59c9a05982efdcf2a87337d9dc763beb5c3bd (diff) |
mgcp: Do not detect the initial package as a wrap around
The Annex A code has a probation period but we don't have it. When
starting with seq_no==0 do not assume that the sequence numbers
have wrapped. Do it by moving the entire checking code into the
else.
Diffstat (limited to 'openbsc/tests')
-rw-r--r-- | openbsc/tests/mgcp/mgcp_test.c | 40 | ||||
-rw-r--r-- | openbsc/tests/mgcp/mgcp_test.ok | 1 |
2 files changed, 41 insertions, 0 deletions
diff --git a/openbsc/tests/mgcp/mgcp_test.c b/openbsc/tests/mgcp/mgcp_test.c index e145c6ab9..db2f4b35f 100644 --- a/openbsc/tests/mgcp/mgcp_test.c +++ b/openbsc/tests/mgcp/mgcp_test.c @@ -998,6 +998,45 @@ static void test_multilple_codec(void) talloc_free(cfg); } +static void test_no_cycle(void) +{ + struct mgcp_config *cfg; + struct mgcp_endpoint *endp; + + printf("Testing no sequence flow on initial packet\n"); + + cfg = mgcp_config_alloc(); + cfg->trunk.number_endpoints = 64; + mgcp_endpoints_allocate(&cfg->trunk); + + endp = &cfg->trunk.endpoints[1]; + OSMO_ASSERT(endp->net_state.stats_initialized == 0); + + mgcp_rtp_annex_count(endp, &endp->net_state, 0, 0, 2342); + OSMO_ASSERT(endp->net_state.stats_initialized == 1); + OSMO_ASSERT(endp->net_state.stats_cycles == 0); + OSMO_ASSERT(endp->net_state.stats_max_seq == 0); + + mgcp_rtp_annex_count(endp, &endp->net_state, 1, 0, 2342); + OSMO_ASSERT(endp->net_state.stats_initialized == 1); + OSMO_ASSERT(endp->net_state.stats_cycles == 0); + OSMO_ASSERT(endp->net_state.stats_max_seq == 1); + + /* now jump.. */ + mgcp_rtp_annex_count(endp, &endp->net_state, UINT16_MAX, 0, 2342); + OSMO_ASSERT(endp->net_state.stats_initialized == 1); + OSMO_ASSERT(endp->net_state.stats_cycles == 0); + OSMO_ASSERT(endp->net_state.stats_max_seq == UINT16_MAX); + + /* and wrap */ + mgcp_rtp_annex_count(endp, &endp->net_state, 0, 0, 2342); + OSMO_ASSERT(endp->net_state.stats_initialized == 1); + OSMO_ASSERT(endp->net_state.stats_cycles == UINT16_MAX + 1); + OSMO_ASSERT(endp->net_state.stats_max_seq == 0); + + talloc_free(cfg); +} + int main(int argc, char **argv) { osmo_init_logging(&log_info); @@ -1014,6 +1053,7 @@ int main(int argc, char **argv) test_packet_error_detection(0, 1); test_packet_error_detection(1, 1); test_multilple_codec(); + test_no_cycle(); printf("Done\n"); return EXIT_SUCCESS; diff --git a/openbsc/tests/mgcp/mgcp_test.ok b/openbsc/tests/mgcp/mgcp_test.ok index a25bed4d3..6ca82af2b 100644 --- a/openbsc/tests/mgcp/mgcp_test.ok +++ b/openbsc/tests/mgcp/mgcp_test.ok @@ -475,4 +475,5 @@ In TS: 160320, dTS: 160, Seq: 1002 Out TS change: 160, dTS: 160, Seq change: 1, TS Err change: in +0, out +0 Stats: Jitter = 6810, Transit = -144000 Testing multiple payload types +Testing no sequence flow on initial packet Done |