diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2017-03-02 20:39:17 +0100 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2017-03-02 20:39:17 +0100 |
commit | 4e380dc32315f378fecd359ec666f5e0a9639f33 (patch) | |
tree | f539d2692cd50a4d96f6c4b980b9b13bb1057ab6 /openbsc/tests/msc_vlr/msc_vlr_tests.c | |
parent | 32cdcebdc84b620f5af681dd43f526d39532e841 (diff) |
wip
Change-Id: Ife95dfebe4cea20bb61c9216991e964b2d51d07b
Diffstat (limited to 'openbsc/tests/msc_vlr/msc_vlr_tests.c')
-rw-r--r-- | openbsc/tests/msc_vlr/msc_vlr_tests.c | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/openbsc/tests/msc_vlr/msc_vlr_tests.c b/openbsc/tests/msc_vlr/msc_vlr_tests.c index e437c7617..2c54e6a96 100644 --- a/openbsc/tests/msc_vlr/msc_vlr_tests.c +++ b/openbsc/tests/msc_vlr/msc_vlr_tests.c @@ -69,6 +69,7 @@ struct msgb *msgb_from_hex(const char *label, uint16_t size, const char *hex) void dtap_expect_tx(const char *hex) { + /* Has the previously expected dtap been received? */ OSMO_ASSERT(!dtap_tx_expected); if (!hex) return; @@ -251,19 +252,19 @@ void paging_expect_tmsi(uint32_t tmsi) paging_expecting_imsi = NULL; } -/* override, requires '-Wl,--wrap=paging_request' */ -int __real_paging_request(struct gsm_network *network, struct bsc_subscr *sub, - int type, gsm_cbfn *cbfn, void *data); -int __wrap_paging_request(struct gsm_network *network, struct bsc_subscr *sub, - int type, gsm_cbfn *cbfn, void *data) +/* override, requires '-Wl,--wrap=iu_page_cs' */ +int __real_iu_page_cs(const char *imsi, const uint32_t *tmsi, uint16_t lac); +int __wrap_iu_page_cs(const char *imsi, const uint32_t *tmsi, uint16_t lac) { - log("BTS/BSC sends out paging request to %s for channel type %d", - bsc_subscr_name(sub), type); + log("Iu sends out paging request to IMSI %s, TMSI %u, LAC %u", + imsi, tmsi? *tmsi : GSM_RESERVED_TMSI, lac); OSMO_ASSERT(paging_expecting_imsi || (paging_expecting_tmsi != GSM_RESERVED_TMSI)); if (paging_expecting_imsi) - VERBOSE_ASSERT(strcmp(paging_expecting_imsi, sub->imsi), == 0, "%d"); - if (paging_expecting_tmsi != GSM_RESERVED_TMSI) - VERBOSE_ASSERT(paging_expecting_tmsi, == sub->tmsi, "0x%08x"); + VERBOSE_ASSERT(strcmp(paging_expecting_imsi, imsi), == 0, "%d"); + if (paging_expecting_tmsi != GSM_RESERVED_TMSI) { + VERBOSE_ASSERT(tmsi != NULL, == true, "%d"); + VERBOSE_ASSERT(paging_expecting_tmsi, == *tmsi, "0x%08x"); + } paging_sent = true; paging_stopped = false; return 1; @@ -295,7 +296,7 @@ void clear_vlr() net->vlr->cfg.assign_tmsi = false; net->vlr->cfg.retrieve_imeisv = false; - rx_from_ran = RAN_GERAN_A; + rx_from_ran = RAN_UTRAN_IU; auth_request_sent = false; auth_request_expect_rand = NULL; auth_request_expect_autn = NULL; @@ -397,13 +398,11 @@ int __wrap_gsup_client_send(struct gsup_client *gsupc, struct msgb *msg) return 0; } -/* override, requires '-Wl,--wrap=gsm0808_submit_dtap' */ -int __real_gsm0808_submit_dtap(struct gsm_subscriber_connection *conn, - struct msgb *msg, int link_id, int allow_sacch); -int __wrap_gsm0808_submit_dtap(struct gsm_subscriber_connection *conn, - struct msgb *msg, int link_id, int allow_sacch) +int _validate_dtap(struct msgb *msg, enum ran_type to_ran) { - btw("DTAP --> MS: %s", osmo_hexdump_nospc(msg->data, msg->len)); + btw("DTAP --%s--> MS: %s", + ran_type_name(to_ran), + osmo_hexdump_nospc(msg->data, msg->len)); OSMO_ASSERT(dtap_tx_expected); if (msg->len != dtap_tx_expected->len @@ -423,6 +422,20 @@ int __wrap_gsm0808_submit_dtap(struct gsm_subscriber_connection *conn, return 0; } +/* override, requires '-Wl,--wrap=iu_tx' */ +int __real_iu_tx(struct msgb *msg, uint8_t sapi); +int __wrap_iu_tx(struct msgb *msg, uint8_t sapi) +{ + return _validate_dtap(msg, RAN_UTRAN_IU); +} + +/* override, requires '-Wl,--wrap=a_tx' */ +int __real_a_tx(struct msgb *msg, uint8_t sapi); +int __wrap_a_tx(struct msgb *msg, uint8_t sapi) +{ + return _validate_dtap(msg, RAN_GERAN_A); +} + static int fake_vlr_tx_lu_acc(void *msc_conn_ref, uint32_t send_tmsi) { struct gsm_subscriber_connection *conn = msc_conn_ref; @@ -662,6 +675,8 @@ int main(int argc, char **argv) net->vlr->ops.tx_auth_rej = fake_vlr_tx_auth_rej; net->vlr->ops.set_ciph_mode = fake_vlr_tx_ciph_mode_cmd; + clear_vlr(); + if (optind >= argc) run_tests(-1); else { |