From 10719b74c362591cd01c3766f74ef03639203e1d Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Wed, 21 Feb 2018 00:39:36 +0100 Subject: 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 --- include/osmocom/sgsn/gb_proxy.h | 7 +++--- src/gprs/gb_proxy.c | 47 ++++++++++++++++++++--------------------- src/gprs/gb_proxy_patch.c | 40 ++++++++++++++++++++--------------- src/gprs/gb_proxy_vty.c | 32 ++++++++++++++++------------ src/gprs/gprs_gb_parse.c | 9 +++----- src/gprs/gprs_gmm.c | 9 ++++---- src/gprs/gprs_utils.c | 8 ++++--- src/gprs/sgsn_auth.c | 7 +++--- src/gprs/sgsn_vty.c | 8 +++---- tests/gbproxy/gbproxy_test.c | 29 +++++++++---------------- tests/gbproxy/gbproxy_test.ok | 12 +++++------ 11 files changed, 103 insertions(+), 105 deletions(-) diff --git a/include/osmocom/sgsn/gb_proxy.h b/include/osmocom/sgsn/gb_proxy.h index e10894fc3..2540a7e5b 100644 --- a/include/osmocom/sgsn/gb_proxy.h +++ b/include/osmocom/sgsn/gb_proxy.h @@ -3,6 +3,7 @@ #include +#include #include #include @@ -101,8 +102,7 @@ struct gbproxy_config { struct rate_ctr_group *ctrg; /* force mcc/mnc */ - int core_mnc; - int core_mcc; + struct osmo_plmn_id core_plmn; uint8_t* core_apn; size_t core_apn_size; int tlli_max_age; @@ -120,8 +120,7 @@ struct gbproxy_config { }; struct gbproxy_patch_state { - int local_mnc; - int local_mcc; + struct osmo_plmn_id local_plmn; /* List of TLLIs for which patching is enabled */ struct llist_head logical_links; diff --git a/src/gprs/gb_proxy.c b/src/gprs/gb_proxy.c index 63c3a6127..7d2151830 100644 --- a/src/gprs/gb_proxy.c +++ b/src/gprs/gb_proxy.c @@ -192,8 +192,7 @@ static void gbprox_update_current_raid(uint8_t *raid_enc, const char *log_text) { struct gbproxy_patch_state *state = &peer->patch_state; - const int old_local_mcc = state->local_mcc; - const int old_local_mnc = state->local_mnc; + const struct osmo_plmn_id old_plmn = state->local_plmn; struct gprs_ra_id raid; if (!raid_enc) @@ -202,28 +201,31 @@ static void gbprox_update_current_raid(uint8_t *raid_enc, gsm48_parse_ra(&raid, raid_enc); /* save source side MCC/MNC */ - if (!peer->cfg->core_mcc || raid.mcc == peer->cfg->core_mcc) { - state->local_mcc = 0; + if (!peer->cfg->core_plmn.mcc || raid.mcc == peer->cfg->core_plmn.mcc) { + state->local_plmn.mcc = 0; } else { - state->local_mcc = raid.mcc; + state->local_plmn.mcc = raid.mcc; } - if (!peer->cfg->core_mnc || raid.mnc == peer->cfg->core_mnc) { - state->local_mnc = 0; + if (!peer->cfg->core_plmn.mnc + || !osmo_mnc_cmp(raid.mnc, raid.mnc_3_digits, + peer->cfg->core_plmn.mnc, peer->cfg->core_plmn.mnc_3_digits)) { + state->local_plmn.mnc = 0; + state->local_plmn.mnc_3_digits = false; } else { - state->local_mnc = raid.mnc; + state->local_plmn.mnc = raid.mnc; + state->local_plmn.mnc_3_digits = raid.mnc_3_digits; } - if (old_local_mcc != state->local_mcc || - old_local_mnc != state->local_mnc) + if (osmo_plmn_cmp(&old_plmn, &state->local_plmn)) LOGP(DGPRS, LOGL_NOTICE, "Patching RAID %sactivated, msg: %s, " - "local: %d-%d, core: %d-%d\n", - state->local_mcc || state->local_mnc ? + "local: %s, core: %s\n", + state->local_plmn.mcc || state->local_plmn.mnc ? "" : "de", log_text, - state->local_mcc, state->local_mnc, - peer->cfg->core_mcc, peer->cfg->core_mnc); + osmo_plmn_name(&state->local_plmn), + osmo_plmn_name2(&peer->cfg->core_plmn)); } uint32_t gbproxy_make_bss_ptmsi(struct gbproxy_peer *peer, @@ -559,7 +561,7 @@ static int gbprox_process_bssgp_ul(struct gbproxy_config *cfg, struct gbproxy_link_info *link_info = NULL; uint32_t sgsn_nsei = cfg->nsip_sgsn_nsei; - if (!cfg->core_mcc && !cfg->core_mnc && !cfg->core_apn && + if (!cfg->core_plmn.mcc && !cfg->core_plmn.mnc && !cfg->core_apn && !cfg->acquire_imsi && !cfg->patch_ptmsi && !cfg->route_to_sgsn2) return 1; @@ -665,7 +667,7 @@ static int gbprox_process_bssgp_ul(struct gbproxy_config *cfg, return 1; } -/* patch BSSGP message to use core_mcc/mnc on the SGSN side */ +/* patch BSSGP message to use core_plmn.mcc/mnc on the SGSN side */ static void gbprox_process_bssgp_dl(struct gbproxy_config *cfg, struct msgb *msg, struct gbproxy_peer *peer) @@ -677,7 +679,7 @@ static void gbprox_process_bssgp_dl(struct gbproxy_config *cfg, struct timespec ts = {0,}; struct gbproxy_link_info *link_info = NULL; - if (!cfg->core_mcc && !cfg->core_mnc && !cfg->core_apn && + if (!cfg->core_plmn.mcc && !cfg->core_plmn.mnc && !cfg->core_apn && !cfg->acquire_imsi && !cfg->patch_ptmsi && !cfg->route_to_sgsn2) return; @@ -994,9 +996,8 @@ static int gbprox_rx_sig_from_bss(struct gbproxy_config *cfg, sizeof(from_peer->ra)); gsm48_parse_ra(&raid, from_peer->ra); LOGP(DGPRS, LOGL_INFO, "NSEI=%u BSSGP SUSPEND/RESUME " - "RAI snooping: RAI %u-%u-%u-%u behind BVCI=%u\n", - nsei, raid.mcc, raid.mnc, raid.lac, - raid.rac , from_peer->bvci); + "RAI snooping: RAI %s behind BVCI=%u\n", + nsei, osmo_rai_name(&raid), from_peer->bvci); /* FIXME: This only supports one BSS per RA */ break; case BSSGP_PDUT_BVC_RESET: @@ -1037,10 +1038,8 @@ static int gbprox_rx_sig_from_bss(struct gbproxy_config *cfg, TLVP_VAL(&tp, BSSGP_IE_CELL_ID), sizeof(from_peer->ra)); gsm48_parse_ra(&raid, from_peer->ra); - LOGP(DGPRS, LOGL_INFO, "NSEI=%u/BVCI=%u " - "Cell ID %u-%u-%u-%u\n", nsei, - bvci, raid.mcc, raid.mnc, raid.lac, - raid.rac); + LOGP(DGPRS, LOGL_INFO, "NSEI=%u/BVCI=%u Cell ID %s\n", + nsei, bvci, osmo_rai_name(&raid)); } if (cfg->route_to_sgsn2) copy_to_sgsn2 = 1; diff --git a/src/gprs/gb_proxy_patch.c b/src/gprs/gb_proxy_patch.c index 1be9c2451..496f605dd 100644 --- a/src/gprs/gb_proxy_patch.c +++ b/src/gprs/gb_proxy_patch.c @@ -36,45 +36,51 @@ static void gbproxy_patch_raid(struct gsm48_ra_id *raid_enc, struct gbproxy_peer int to_bss, const char *log_text) { struct gbproxy_patch_state *state = &peer->patch_state; - int old_mcc; - int old_mnc; + struct osmo_plmn_id old_plmn; struct gprs_ra_id raid; enum gbproxy_peer_ctr counter = to_bss ? GBPROX_PEER_CTR_RAID_PATCHED_SGSN : GBPROX_PEER_CTR_RAID_PATCHED_BSS; - if (!state->local_mcc || !state->local_mnc) + if (!state->local_plmn.mcc || !state->local_plmn.mnc) return; gsm48_parse_ra(&raid, (uint8_t *)raid_enc); - old_mcc = raid.mcc; - old_mnc = raid.mnc; + old_plmn = (struct osmo_plmn_id){ + .mcc = raid.mcc, + .mnc = raid.mnc, + .mnc_3_digits = raid.mnc_3_digits, + }; if (!to_bss) { /* BSS -> SGSN */ - if (state->local_mcc) - raid.mcc = peer->cfg->core_mcc; + if (state->local_plmn.mcc) + raid.mcc = peer->cfg->core_plmn.mcc; - if (state->local_mnc) - raid.mnc = peer->cfg->core_mnc; + if (state->local_plmn.mnc) { + raid.mnc = peer->cfg->core_plmn.mnc; + raid.mnc_3_digits = peer->cfg->core_plmn.mnc_3_digits; + } } else { /* SGSN -> BSS */ - if (state->local_mcc) - raid.mcc = state->local_mcc; + if (state->local_plmn.mcc) + raid.mcc = state->local_plmn.mcc; - if (state->local_mnc) - raid.mnc = state->local_mnc; + if (state->local_plmn.mnc) { + raid.mnc = state->local_plmn.mnc; + raid.mnc_3_digits = state->local_plmn.mnc_3_digits; + } } LOGP(DGPRS, LOGL_DEBUG, "Patching %s to %s: " - "%d-%d-%d-%d -> %d-%d-%d-%d\n", + "%s-%d-%d -> %s\n", log_text, to_bss ? "BSS" : "SGSN", - old_mcc, old_mnc, raid.lac, raid.rac, - raid.mcc, raid.mnc, raid.lac, raid.rac); + osmo_plmn_name(&old_plmn), raid.lac, raid.rac, + osmo_rai_name(&raid)); gsm48_encode_ra(raid_enc, &raid); rate_ctr_inc(&peer->ctrg->ctr[counter]); @@ -276,7 +282,7 @@ int gbproxy_patch_llc(struct msgb *msg, uint8_t *llc, size_t llc_len, return have_patched; } -/* patch BSSGP message to use core_mcc/mnc on the SGSN side */ +/* patch BSSGP message to use core_plmn.mcc/mnc on the SGSN side */ void gbproxy_patch_bssgp(struct msgb *msg, uint8_t *bssgp, size_t bssgp_len, struct gbproxy_peer *peer, struct gbproxy_link_info *link_info, int *len_change, diff --git a/src/gprs/gb_proxy_vty.c b/src/gprs/gb_proxy_vty.c index 25ef75651..423c582f3 100644 --- a/src/gprs/gb_proxy_vty.c +++ b/src/gprs/gb_proxy_vty.c @@ -71,9 +71,7 @@ static void gbprox_vty_print_peer(struct vty *vty, struct gbproxy_peer *peer) gsm48_parse_ra(&raid, peer->ra); vty_out(vty, "NSEI %5u, PTP-BVCI %5u, " - "RAI %u-%u-%u-%u", - peer->nsei, peer->bvci, - raid.mcc, raid.mnc, raid.lac, raid.rac); + "RAI %s", peer->nsei, peer->bvci, osmo_rai_name(&raid)); if (peer->blocked) vty_out(vty, " [BVC-BLOCKED]"); @@ -89,12 +87,12 @@ static int config_write_gbproxy(struct vty *vty) vty_out(vty, " sgsn nsei %u%s", g_cfg->nsip_sgsn_nsei, VTY_NEWLINE); - if (g_cfg->core_mcc > 0) - vty_out(vty, " core-mobile-country-code %d%s", - g_cfg->core_mcc, VTY_NEWLINE); - if (g_cfg->core_mnc > 0) - vty_out(vty, " core-mobile-network-code %d%s", - g_cfg->core_mnc, VTY_NEWLINE); + if (g_cfg->core_plmn.mcc > 0) + vty_out(vty, " core-mobile-country-code %s%s", + osmo_mcc_name(g_cfg->core_plmn.mcc), VTY_NEWLINE); + if (g_cfg->core_plmn.mnc > 0) + vty_out(vty, " core-mobile-network-code %s%s", + osmo_mnc_name(g_cfg->core_plmn.mnc, g_cfg->core_plmn.mnc_3_digits), VTY_NEWLINE); for (match_id = 0; match_id < ARRAY_SIZE(g_cfg->matches); ++match_id) { struct gbproxy_match *match = &g_cfg->matches[match_id]; @@ -170,7 +168,14 @@ DEFUN(cfg_gbproxy_core_mnc, "core-mobile-network-code <1-999>", GBPROXY_CORE_MNC_STR "NCC value\n") { - g_cfg->core_mnc = atoi(argv[0]); + uint16_t mnc; + bool mnc_3_digits; + if (osmo_mnc_from_str(argv[0], &mnc, &mnc_3_digits)) { + vty_out(vty, "%% Invalid MNC: %s%s", argv[0], VTY_NEWLINE); + return CMD_WARNING; + } + g_cfg->core_plmn.mnc = mnc; + g_cfg->core_plmn.mnc_3_digits = mnc_3_digits; return CMD_SUCCESS; } @@ -179,7 +184,8 @@ DEFUN(cfg_gbproxy_no_core_mnc, "no core-mobile-network-code", NO_STR GBPROXY_CORE_MNC_STR) { - g_cfg->core_mnc = 0; + g_cfg->core_plmn.mnc = 0; + g_cfg->core_plmn.mnc_3_digits = false; return CMD_SUCCESS; } @@ -190,7 +196,7 @@ DEFUN(cfg_gbproxy_core_mcc, "core-mobile-country-code <1-999>", GBPROXY_CORE_MCC_STR "MCC value\n") { - g_cfg->core_mcc = atoi(argv[0]); + g_cfg->core_plmn.mcc = atoi(argv[0]); return CMD_SUCCESS; } @@ -199,7 +205,7 @@ DEFUN(cfg_gbproxy_no_core_mcc, "no core-mobile-country-code", NO_STR GBPROXY_CORE_MCC_STR) { - g_cfg->core_mcc = 0; + g_cfg->core_plmn.mcc = 0; return CMD_SUCCESS; } diff --git a/src/gprs/gprs_gb_parse.c b/src/gprs/gprs_gb_parse.c index ba78e8977..18565ae65 100644 --- a/src/gprs/gprs_gb_parse.c +++ b/src/gprs/gprs_gb_parse.c @@ -551,24 +551,21 @@ void gprs_gb_log_parse_context(int log_level, if (parse_ctx->bssgp_raid_enc) { struct gprs_ra_id raid; gsm48_parse_ra(&raid, parse_ctx->bssgp_raid_enc); - LOGPC(DGPRS, log_level, "%s BSSGP RAID %u-%u-%u-%u", sep, - raid.mcc, raid.mnc, raid.lac, raid.rac); + LOGPC(DGPRS, log_level, "%s BSSGP RAID %s", sep, osmo_rai_name(&raid)); sep = ","; } if (parse_ctx->raid_enc) { struct gprs_ra_id raid; gsm48_parse_ra(&raid, parse_ctx->raid_enc); - LOGPC(DGPRS, log_level, "%s RAID %u-%u-%u-%u", sep, - raid.mcc, raid.mnc, raid.lac, raid.rac); + LOGPC(DGPRS, log_level, "%s RAID %s", sep, osmo_rai_name(&raid)); sep = ","; } if (parse_ctx->old_raid_enc) { struct gprs_ra_id raid; gsm48_parse_ra(&raid, parse_ctx->old_raid_enc); - LOGPC(DGPRS, log_level, "%s old RAID %u-%u-%u-%u", sep, - raid.mcc, raid.mnc, raid.lac, raid.rac); + LOGPC(DGPRS, log_level, "%s old RAID %s", sep, osmo_rai_name(&raid)); sep = ","; } diff --git a/src/gprs/gprs_gmm.c b/src/gprs/gprs_gmm.c index 9313e989e..c9fb8da8a 100644 --- a/src/gprs/gprs_gmm.c +++ b/src/gprs/gprs_gmm.c @@ -1673,12 +1673,11 @@ static int gsm48_rx_gmm_ra_upd_req(struct sgsn_mm_ctx *mmctx, struct msgb *msg, LOGMMCTXP(LOGL_INFO, mmctx, "Looked up by matching TLLI and P_TMSI. " "BSSGP TLLI: %08x, P-TMSI: %08x (%08x), " - "TLLI: %08x (%08x), RA: %d-%d-%d-%d\n", + "TLLI: %08x (%08x), RA: %s\n", msgb_tlli(msg), mmctx->p_tmsi, mmctx->p_tmsi_old, mmctx->gb.tlli, mmctx->gb.tlli_new, - mmctx->ra.mcc, mmctx->ra.mnc, - mmctx->ra.lac, mmctx->ra.rac); + osmo_rai_name(&mmctx->ra)); mmctx->gmm_state = GMM_COMMON_PROC_INIT; } @@ -1687,8 +1686,8 @@ static int gsm48_rx_gmm_ra_upd_req(struct sgsn_mm_ctx *mmctx, struct msgb *msg, { /* We cannot use the mmctx */ LOGMMCTXP(LOGL_INFO, mmctx, - "The MM context cannot be used, RA: %d-%d-%d-%d\n", - mmctx->ra.mcc, mmctx->ra.mnc, + "The MM context cannot be used, RA: %03d-%0*d-%d-%d\n", + mmctx->ra.mcc, mmctx->ra.mnc_3_digits, mmctx->ra.mnc, mmctx->ra.lac, mmctx->ra.rac); mmctx = NULL; } diff --git a/src/gprs/gprs_utils.c b/src/gprs/gprs_utils.c index 307699bed..d7cef1cce 100644 --- a/src/gprs/gprs_utils.c +++ b/src/gprs/gprs_utils.c @@ -239,8 +239,10 @@ void gprs_parse_tmsi(const uint8_t *value, uint32_t *tmsi) } int gprs_ra_id_equals(const struct gprs_ra_id *id1, - const struct gprs_ra_id *id2) + const struct gprs_ra_id *id2) { - return (id1->mcc == id2->mcc && id1->mnc == id2->mnc && - id1->lac == id2->lac && id1->rac == id2->rac); + return (id1->mcc == id2->mcc + && !osmo_mnc_cmp(id1->mnc, id1->mnc_3_digits, + id2->mnc, id2->mnc_3_digits) + && id1->lac == id2->lac && id1->rac == id2->rac); } diff --git a/src/gprs/sgsn_auth.c b/src/gprs/sgsn_auth.c index 92712ef98..6fb32b711 100644 --- a/src/gprs/sgsn_auth.c +++ b/src/gprs/sgsn_auth.c @@ -133,9 +133,10 @@ enum sgsn_auth_state sgsn_auth_state(struct sgsn_mm_ctx *mmctx) if (check_net) { /* We simply assume that the IMSI exists, as long as it is part * of 'our' network */ - snprintf(mccmnc, sizeof(mccmnc), "%03d%02d", - mmctx->ra.mcc, mmctx->ra.mnc); - if (strncmp(mccmnc, mmctx->imsi, 5) == 0) + snprintf(mccmnc, sizeof(mccmnc), "%s%s", + osmo_mcc_name(mmctx->ra.mcc), + osmo_mnc_name(mmctx->ra.mnc, mmctx->ra.mnc_3_digits)); + if (strncmp(mccmnc, mmctx->imsi, mmctx->ra.mnc_3_digits ? 6 : 5) == 0) return SGSN_AUTH_ACCEPTED; } diff --git a/src/gprs/sgsn_vty.c b/src/gprs/sgsn_vty.c index 9d1d86d39..07d4293db 100644 --- a/src/gprs/sgsn_vty.c +++ b/src/gprs/sgsn_vty.c @@ -484,11 +484,9 @@ static void vty_dump_mmctx(struct vty *vty, const char *pfx, pfx, mm->imsi, mm->imei, mm->p_tmsi, VTY_NEWLINE); vty_out(vty, "%s MSISDN: %s, TLLI: %08x%s HLR: %s", pfx, mm->msisdn, mm->gb.tlli, mm->hlr, VTY_NEWLINE); - vty_out(vty, "%s MM State: %s, Routeing Area: %u-%u-%u-%u, " - "Cell ID: %u%s", pfx, - get_value_string(gprs_mm_st_strs, mm->gmm_state), - mm->ra.mcc, mm->ra.mnc, mm->ra.lac, mm->ra.rac, - mm->gb.cell_id, VTY_NEWLINE); + vty_out(vty, "%s MM State: %s, Routeing Area: %s, Cell ID: %u%s", + pfx, get_value_string(gprs_mm_st_strs, mm->gmm_state), + osmo_rai_name(&mm->ra), mm->gb.cell_id, VTY_NEWLINE); vty_out_rate_ctr_group(vty, " ", mm->ctrg); 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 -- cgit v1.2.3