From 8eacc1a6f0930e9484e9e124fa39ea219d35903d Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Thu, 9 Mar 2017 16:51:58 +0100 Subject: vlr: allow setting assign_tmsi per-subscriber Change-Id: I7469da0ed19e1e8b292422aadfd3ae2ebc2afd57 --- openbsc/include/openbsc/vlr.h | 3 ++- openbsc/src/libmsc/gsm_04_08.c | 3 ++- openbsc/src/libvlr/vlr_lu_fsm.c | 19 +++++++++++++------ openbsc/tests/vlr/vlr_test.c | 3 ++- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/openbsc/include/openbsc/vlr.h b/openbsc/include/openbsc/vlr.h index e44425854..b45e4ae37 100644 --- a/openbsc/include/openbsc/vlr.h +++ b/openbsc/include/openbsc/vlr.h @@ -247,7 +247,8 @@ vlr_loc_update(struct osmo_fsm_inst *parent, const struct osmo_location_area_id *new_lai, bool authentication_required, enum vlr_ciph ciphering_required, - bool is_r99, bool is_utran); + bool is_r99, bool is_utran, + bool assign_tmsi); void vlr_loc_update_conn_timeout(struct osmo_fsm_inst *fi); diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c index 0e44ba68f..26a5050e2 100644 --- a/openbsc/src/libmsc/gsm_04_08.c +++ b/openbsc/src/libmsc/gsm_04_08.c @@ -419,7 +419,8 @@ int mm_rx_loc_upd_req(struct gsm_subscriber_connection *conn, struct msgb *msg) is_utran || conn->network->authentication_required, conn->network->a5_encryption, classmark_is_r99(&conn->classmark), - is_utran); + is_utran, + net->vlr->cfg.assign_tmsi); if (!lu_fsm) { DEBUGP(DRR, "%s: Can't start LU FSM\n", mi_string); return 0; diff --git a/openbsc/src/libvlr/vlr_lu_fsm.c b/openbsc/src/libvlr/vlr_lu_fsm.c index e9fed2d25..b2c490f98 100644 --- a/openbsc/src/libvlr/vlr_lu_fsm.c +++ b/openbsc/src/libvlr/vlr_lu_fsm.c @@ -308,6 +308,7 @@ struct lu_compl_vlr_priv { void *parent_event_data; enum vlr_fsm_result result; uint8_t cause; + bool assign_tmsi; }; static void _vlr_lu_compl_fsm_done(struct osmo_fsm_inst *fi, @@ -426,7 +427,7 @@ static void lu_compl_vlr_wait_subscr_pres(struct osmo_fsm_inst *fi, if (vlr->cfg.check_imei_rqd) { /* Check IMEI VLR */ osmo_fsm_inst_state_chg(fi, - vlr->cfg.assign_tmsi ? + lcvp->assign_tmsi ? LU_COMPL_VLR_S_WAIT_IMEI_TMSI : LU_COMPL_VLR_S_WAIT_IMEI, vlr_timer(vlr, 3270), 3270); @@ -435,7 +436,7 @@ static void lu_compl_vlr_wait_subscr_pres(struct osmo_fsm_inst *fi, } /* Do we need to allocate a TMSI? */ - if (vlr->cfg.assign_tmsi) { + if (lcvp->assign_tmsi) { lu_compl_vlr_new_tmsi(fi); return; } @@ -471,7 +472,7 @@ static void lu_compl_vlr_wait_imei(struct osmo_fsm_inst *fi, uint32_t event, } /* IMEI is available. Allocate TMSI if needed. */ - if (vlr->cfg.assign_tmsi) { + if (lcvp->assign_tmsi) { if (fi->state != LU_COMPL_VLR_S_WAIT_IMEI_TMSI) LOGPFSML(fi, LOGL_ERROR, "TMSI required, expected to be in state" @@ -574,7 +575,8 @@ lu_compl_vlr_proc_alloc(struct osmo_fsm_inst *parent, struct vlr_subscr *vsub, void *msc_conn_ref, uint32_t parent_event_success, - uint32_t parent_event_failure) + uint32_t parent_event_failure, + bool assign_tmsi) { struct osmo_fsm_inst *fi; struct lu_compl_vlr_priv *lcvp; @@ -589,6 +591,7 @@ lu_compl_vlr_proc_alloc(struct osmo_fsm_inst *parent, lcvp->msc_conn_ref = msc_conn_ref; lcvp->parent_event_success = parent_event_success; lcvp->parent_event_failure = parent_event_failure; + lcvp->assign_tmsi = assign_tmsi; fi->priv = lcvp; return fi; @@ -638,6 +641,7 @@ struct lu_fsm_priv { enum vlr_ciph ciphering_required; bool is_r99; bool is_utran; + bool assign_tmsi; }; @@ -715,7 +719,8 @@ static void vlr_loc_upd_start_lu_compl_fsm(struct osmo_fsm_inst *fi) lfp->lu_compl_vlr_fsm = lu_compl_vlr_proc_alloc(fi, lfp->vsub, lfp->msc_conn_ref, VLR_ULA_E_LU_COMPL_SUCCESS, - VLR_ULA_E_LU_COMPL_FAILURE); + VLR_ULA_E_LU_COMPL_FAILURE, + lfp->assign_tmsi); osmo_fsm_inst_dispatch(lfp->lu_compl_vlr_fsm, LU_COMPL_VLR_E_START, NULL); } @@ -1361,7 +1366,8 @@ vlr_loc_update(struct osmo_fsm_inst *parent, const struct osmo_location_area_id *new_lai, bool authentication_required, enum vlr_ciph ciphering_required, - bool is_r99, bool is_utran) + bool is_r99, bool is_utran, + bool assign_tmsi) { struct osmo_fsm_inst *fi; struct lu_fsm_priv *lfp; @@ -1385,6 +1391,7 @@ vlr_loc_update(struct osmo_fsm_inst *parent, lfp->ciphering_required = ciphering_required; lfp->is_r99 = is_r99; lfp->is_utran = is_utran; + lfp->assign_tmsi = assign_tmsi; if (imsi) { strncpy(lfp->imsi, imsi, sizeof(lfp->imsi)-1); lfp->imsi[sizeof(lfp->imsi)-1] = '\0'; diff --git a/openbsc/tests/vlr/vlr_test.c b/openbsc/tests/vlr/vlr_test.c index 055b0432f..19beb69c4 100644 --- a/openbsc/tests/vlr/vlr_test.c +++ b/openbsc/tests/vlr/vlr_test.c @@ -169,7 +169,8 @@ static void fsm_f_null(struct osmo_fsm_inst *fi, uint32_t event, void *data) true, true, false, - false); + false, + true); OSMO_ASSERT(priv->subscr); osmo_fsm_inst_state_chg(fi, ST_LU_SENT, 0, 0); break; -- cgit v1.2.3