diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2018-02-21 00:39:36 +0100 |
---|---|---|
committer | Neels Hofmeyr <neels@hofmeyr.de> | 2018-03-15 19:18:14 +0100 |
commit | 10719b74c362591cd01c3766f74ef03639203e1d (patch) | |
tree | 4e0fed5a071f24099c9b565e11fe02f4af3f8774 /tests | |
parent | 5926e840ccdea595fb63e0a51e3069882e4ce73c (diff) |
implement support for 3-digit MNC with leading zeros
Add 3-digit flags and use the new RAI and LAI API from libosmocore throughout
the code base to be able to handle an MNC < 100 that has three digits (leading
zeros).
Note that in gbproxy_test.ok, 0-0 changes to 000-000 instead of 000-00, because
the parsed ra buffer is 000000 which results in 000-000, while 00f000 would
result in 000-00. IOW this is expected.
Change-Id: I7437dfaa586689e2bef0d4be6537e5577a8f6c26
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gbproxy/gbproxy_test.c | 29 | ||||
-rw-r--r-- | tests/gbproxy/gbproxy_test.ok | 12 |
2 files changed, 16 insertions, 25 deletions
diff --git a/tests/gbproxy/gbproxy_test.c b/tests/gbproxy/gbproxy_test.c index 080c96bbf..8edb17148 100644 --- a/tests/gbproxy/gbproxy_test.c +++ b/tests/gbproxy/gbproxy_test.c @@ -131,12 +131,11 @@ static int dump_peers(FILE *stream, int indent, time_t now, struct gbproxy_patch_state *state = &peer->patch_state; gsm48_parse_ra(&raid, peer->ra); - rc = fprintf(stream, "%*s NSEI %u, BVCI %u, %sblocked, " - "RAI %u-%u-%u-%u\n", + rc = fprintf(stream, "%*s NSEI %u, BVCI %u, %sblocked, RAI %s\n", indent, "", peer->nsei, peer->bvci, peer->blocked ? "" : "not ", - raid.mcc, raid.mnc, raid.lac, raid.rac); + osmo_rai_name(&raid)); if (rc < 0) return rc; @@ -1657,8 +1656,7 @@ static void test_gbproxy_ra_patching() bssgp_nsi = nsi; gbcfg.nsi = bssgp_nsi; gbcfg.nsip_sgsn_nsei = SGSN_NSEI; - gbcfg.core_mcc = 123; - gbcfg.core_mnc = 456; + gbcfg.core_plmn = (struct osmo_plmn_id){ .mcc = 123, .mnc = 456 }; gbcfg.core_apn = talloc_zero_size(NULL, 100); gbcfg.core_apn_size = gprs_str_to_apn(gbcfg.core_apn, 100, "foo.bar"); gbcfg.patch_ptmsi = 0; @@ -1998,8 +1996,7 @@ static void test_gbproxy_ptmsi_assignment() bssgp_nsi = nsi; gbcfg.nsi = bssgp_nsi; gbcfg.nsip_sgsn_nsei = SGSN_NSEI; - gbcfg.core_mcc = 0; - gbcfg.core_mnc = 0; + gbcfg.core_plmn = (struct osmo_plmn_id){}; gbcfg.core_apn = talloc_zero_size(NULL, 100); gbcfg.core_apn_size = gprs_str_to_apn(gbcfg.core_apn, 100, "foo.bar"); gbcfg.patch_ptmsi = 0; @@ -2232,8 +2229,7 @@ static void test_gbproxy_ptmsi_patching() bssgp_nsi = nsi; gbcfg.nsi = bssgp_nsi; gbcfg.nsip_sgsn_nsei = SGSN_NSEI; - gbcfg.core_mcc = 123; - gbcfg.core_mnc = 456; + gbcfg.core_plmn = (struct osmo_plmn_id){ .mcc = 123, .mnc = 456 }; gbcfg.core_apn = talloc_zero_size(NULL, 100); gbcfg.core_apn_size = gprs_str_to_apn(gbcfg.core_apn, 100, "foo.bar"); gbcfg.patch_ptmsi = 1; @@ -2551,8 +2547,7 @@ static void test_gbproxy_ptmsi_patching_bad_cases() bssgp_nsi = nsi; gbcfg.nsi = bssgp_nsi; gbcfg.nsip_sgsn_nsei = SGSN_NSEI; - gbcfg.core_mcc = 123; - gbcfg.core_mnc = 456; + gbcfg.core_plmn = (struct osmo_plmn_id){ .mcc = 123, .mnc = 456 }; gbcfg.core_apn = talloc_zero_size(NULL, 100); gbcfg.core_apn_size = gprs_str_to_apn(gbcfg.core_apn, 100, "foo.bar"); gbcfg.patch_ptmsi = 1; @@ -2735,8 +2730,7 @@ static void test_gbproxy_imsi_acquisition() bssgp_nsi = nsi; gbcfg.nsi = bssgp_nsi; gbcfg.nsip_sgsn_nsei = SGSN_NSEI; - gbcfg.core_mcc = 123; - gbcfg.core_mnc = 456; + gbcfg.core_plmn = (struct osmo_plmn_id){ .mcc = 123, .mnc = 456 }; gbcfg.core_apn = talloc_zero_size(NULL, 100); gbcfg.core_apn_size = gprs_str_to_apn(gbcfg.core_apn, 100, "foo.bar"); gbcfg.patch_ptmsi = 1; @@ -3061,8 +3055,7 @@ static void test_gbproxy_secondary_sgsn() bssgp_nsi = nsi; gbcfg.nsi = bssgp_nsi; gbcfg.nsip_sgsn_nsei = SGSN_NSEI; - gbcfg.core_mcc = 123; - gbcfg.core_mnc = 456; + gbcfg.core_plmn = (struct osmo_plmn_id){ .mcc = 123, .mnc = 456 }; gbcfg.core_apn = talloc_zero_size(NULL, 100); gbcfg.core_apn_size = gprs_str_to_apn(gbcfg.core_apn, 100, "foo.bar"); gbcfg.patch_ptmsi = 1; @@ -3540,8 +3533,7 @@ static void test_gbproxy_keep_info() gbcfg.nsip_sgsn_nsei = SGSN_NSEI; gbcfg.patch_ptmsi = 0; gbcfg.acquire_imsi = 1; - gbcfg.core_mcc = 0; - gbcfg.core_mnc = 0; + gbcfg.core_plmn = (struct osmo_plmn_id){}; gbcfg.core_apn = NULL; gbcfg.core_apn_size = 0; gbcfg.route_to_sgsn2 = 0; @@ -4841,8 +4833,7 @@ static void test_gbproxy_stored_messages() bssgp_nsi = nsi; gbcfg.nsi = bssgp_nsi; gbcfg.nsip_sgsn_nsei = SGSN_NSEI; - gbcfg.core_mcc = 0; - gbcfg.core_mnc = 0; + gbcfg.core_plmn = (struct osmo_plmn_id){}; gbcfg.core_apn = talloc_zero_size(NULL, 100); gbcfg.core_apn_size = gprs_str_to_apn(gbcfg.core_apn, 100, "foo.bar"); gbcfg.patch_ptmsi = 0; diff --git a/tests/gbproxy/gbproxy_test.ok b/tests/gbproxy/gbproxy_test.ok index ff86b67ea..5d77dc903 100644 --- a/tests/gbproxy/gbproxy_test.ok +++ b/tests/gbproxy/gbproxy_test.ok @@ -7249,7 +7249,7 @@ Test TLLI replacement: Add TLLI 1, IMSI 1 Add TLLI 2, IMSI 1 (should replace TLLI 1) Peers: - NSEI 0, BVCI 20, not blocked, RAI 0-0-0-0 + NSEI 0, BVCI 20, not blocked, RAI 000-000-0-0 TLLI cache size : 1 TLLI-Cache: 1 TLLI c000162e, IMSI 03242526, AGE 0, IMSI matches @@ -7258,7 +7258,7 @@ Test IMSI replacement: Add TLLI 1, IMSI 1 Add TLLI 1, IMSI 2 (should replace IMSI 1) Peers: - NSEI 0, BVCI 20, not blocked, RAI 0-0-0-0 + NSEI 0, BVCI 20, not blocked, RAI 000-000-0-0 TLLI cache size : 1 TLLI-Cache: 1 TLLI c00004d2, IMSI 06272829, AGE 0, IMSI matches @@ -7267,7 +7267,7 @@ Test TLLI expiry, max_len == 1: Add TLLI 1, IMSI 1 Add TLLI 2, IMSI 2 (should replace IMSI 1) Peers: - NSEI 0, BVCI 20, not blocked, RAI 0-0-0-0 + NSEI 0, BVCI 20, not blocked, RAI 000-000-0-0 TLLI cache size : 1 TLLI-Cache: 1 TLLI c000162e, IMSI 06272829, AGE 0, IMSI matches @@ -7276,7 +7276,7 @@ Test TLLI expiry, max_age == 1: Add TLLI 1, IMSI 1 (should expire after timeout) Add TLLI 2, IMSI 2 (should not expire after timeout) Peers: - NSEI 0, BVCI 20, not blocked, RAI 0-0-0-0 + NSEI 0, BVCI 20, not blocked, RAI 000-000-0-0 TLLI cache size : 1 TLLI-Cache: 1 TLLI c000162e, IMSI 06272829, AGE 1, IMSI matches @@ -7286,7 +7286,7 @@ Test TLLI expiry, max_len == 2, max_age == 1: Add TLLI 2, IMSI 2 (should expire after timeout) Add TLLI 3, IMSI 3 (should not expire after timeout) Peers: - NSEI 0, BVCI 20, not blocked, RAI 0-0-0-0 + NSEI 0, BVCI 20, not blocked, RAI 000-000-0-0 TLLI cache size : 3 TLLI-Cache: 3 TLLI c0000d80, IMSI 12345678, AGE 0, IMSI matches @@ -7294,7 +7294,7 @@ Test TLLI expiry, max_len == 2, max_age == 1: TLLI c00004d2, IMSI 03242526, AGE 2, IMSI matches Remove stale TLLIs Peers: - NSEI 0, BVCI 20, not blocked, RAI 0-0-0-0 + NSEI 0, BVCI 20, not blocked, RAI 000-000-0-0 TLLI cache size : 1 TLLI-Cache: 1 TLLI c0000d80, IMSI 12345678, AGE 0, IMSI matches |