diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2013-10-28 13:29:10 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-10-30 15:23:15 +0100 |
commit | e7c427165f696d844be6761a27b3d7a66f5aa49c (patch) | |
tree | 8080ae1cec23d5d522a79be24cdb0bf1ffda0716 /tests/gb/gprs_ns_test.c | |
parent | ce397dee70eb03358da6eb1c1ca19ed7cf155a62 (diff) |
grps: Add test for NS messages that shall be ignored
Several messages shall not be answered when a RESET hasn't been
received on a NS-VC:
- NS_RESET_ACK (see 3GPP TS 08.16, 7.3.1)
- NS_ALIVE_ACK (see 3GPP TS 08.16, 7.4.1)
- NS_STATUS (see 3GPP TS 08.16, 7.5.1)
Sponsored-by: On-Waves ehf
Diffstat (limited to 'tests/gb/gprs_ns_test.c')
-rw-r--r-- | tests/gb/gprs_ns_test.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/gb/gprs_ns_test.c b/tests/gb/gprs_ns_test.c index c88792c7..c90d752e 100644 --- a/tests/gb/gprs_ns_test.c +++ b/tests/gb/gprs_ns_test.c @@ -486,6 +486,33 @@ static void test_nsvc() alarm(0); } +static void test_ignored_messages() +{ + struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, NULL); + struct sockaddr_in peer[1] = {{0},}; + + peer[0].sin_family = AF_INET; + peer[0].sin_port = htons(1111); + peer[0].sin_addr.s_addr = htonl(REMOTE_BSS_ADDR); + + printf("--- Send unexpected NS STATUS (should not be answered)---\n\n"); + /* Do not respond, see 3GPP TS 08.16, 7.5.1 */ + gprs_process_message(nsi, "STATUS", &peer[0], + gprs_ns_status_invalid_alive, + sizeof(gprs_ns_status_invalid_alive)); + + printf("--- Send unexpected NS ALIVE ACK (should not be answered)---\n\n"); + /* Ignore this, see 3GPP TS 08.16, 7.4.1 */ + send_ns_alive_ack(nsi, &peer[0]); + + printf("--- Send unexpected NS RESET ACK (should not be answered)---\n\n"); + /* Ignore this, see 3GPP TS 08.16, 7.3.1 */ + send_ns_reset_ack(nsi, &peer[0], 0xe001, 0xe000); + + gprs_ns_destroy(nsi); + nsi = NULL; +} + static void test_bss_port_changes() { struct gprs_ns_inst *nsi = gprs_ns_instantiate(gprs_ns_callback, NULL); @@ -832,6 +859,7 @@ int main(int argc, char **argv) printf("===== NS protocol test START\n"); test_nsvc(); + test_ignored_messages(); test_bss_port_changes(); test_bss_reset_ack(); test_sgsn_reset(); |