mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-msc.git
synced 2025-10-23 00:02:06 +00:00
vlr: vlr_set_ciph_mode(): use vlr_subscr_security_context instead of umts_aka
Simplifies code when re-transmitting Ciphering Mode Command when using it also for PS. Change-Id: Ia556bc33d1cf30ef17fed2828908aa0b6b6dc8be
This commit is contained in:
@@ -488,7 +488,7 @@ void vlr_parq_cancel(struct osmo_fsm_inst *fi,
|
||||
int vlr_set_ciph_mode(struct vlr_instance *vlr,
|
||||
struct osmo_fsm_inst *fi,
|
||||
void *msc_conn_ref,
|
||||
bool umts_aka,
|
||||
enum vlr_subscr_security_context sec_ctx,
|
||||
bool retrieve_imeisv);
|
||||
|
||||
bool vlr_use_umts_aka(struct osmo_auth_vector *vec, bool is_r99);
|
||||
|
@@ -1664,19 +1664,35 @@ void vlr_subscr_rx_ciph_res(struct vlr_subscr *vsub, enum vlr_ciph_result_cause
|
||||
|
||||
/* Internal evaluation of requested ciphering mode.
|
||||
* Send set_ciph_mode() to MSC depending on the ciph_mode argument.
|
||||
* \param[in] vlr VLR instance.
|
||||
* \param[in] fi Calling FSM instance, for logging.
|
||||
* \param[in] msc_conn_ref MSC conn to send to.
|
||||
* \param[in] ciph_mode Ciphering config, to decide whether to do ciphering.
|
||||
* \param[in] vlr VLR instance.
|
||||
* \param[in] fi Calling FSM instance, for logging.
|
||||
* \param[in] msc_conn_ref MSC conn to send to.
|
||||
* \param[in] sec_ctx the security context to be established.
|
||||
* \param[in] retrieve_imeisv request the IMEI in the ciphering mode command.
|
||||
* \returns 0 if no ciphering is needed or message was sent successfully,
|
||||
* or a negative value if ciph_mode is invalid or sending failed.
|
||||
*/
|
||||
int vlr_set_ciph_mode(struct vlr_instance *vlr,
|
||||
struct osmo_fsm_inst *fi,
|
||||
void *msc_conn_ref,
|
||||
bool umts_aka,
|
||||
enum vlr_subscr_security_context sec_ctx,
|
||||
bool retrieve_imeisv)
|
||||
{
|
||||
bool umts_aka;
|
||||
|
||||
switch (sec_ctx) {
|
||||
case VLR_SEC_CTX_GSM:
|
||||
umts_aka = false;
|
||||
break;
|
||||
case VLR_SEC_CTX_UMTS:
|
||||
umts_aka = true;
|
||||
break;
|
||||
case VLR_SEC_CTX_NONE:
|
||||
return 0;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
LOGPFSML(fi, LOGL_DEBUG, "Set Ciphering Mode\n");
|
||||
return vlr->ops.set_ciph_mode(msc_conn_ref, umts_aka, retrieve_imeisv);
|
||||
}
|
||||
|
@@ -297,7 +297,6 @@ static void _proc_arq_vlr_node2(struct osmo_fsm_inst *fi)
|
||||
{
|
||||
struct proc_arq_priv *par = fi->priv;
|
||||
struct vlr_subscr *vsub = par->vsub;
|
||||
bool umts_aka;
|
||||
|
||||
LOGPFSM(fi, "%s()\n", __func__);
|
||||
|
||||
@@ -311,10 +310,7 @@ static void _proc_arq_vlr_node2(struct osmo_fsm_inst *fi)
|
||||
|
||||
switch (vsub->sec_ctx) {
|
||||
case VLR_SEC_CTX_GSM:
|
||||
umts_aka = false;
|
||||
break;
|
||||
case VLR_SEC_CTX_UMTS:
|
||||
umts_aka = true;
|
||||
break;
|
||||
default:
|
||||
LOGPFSML(fi, LOGL_ERROR, "Cannot start ciphering, security context is not established\n");
|
||||
@@ -323,7 +319,7 @@ static void _proc_arq_vlr_node2(struct osmo_fsm_inst *fi)
|
||||
}
|
||||
|
||||
if (vlr_set_ciph_mode(vsub->vlr, fi, par->msc_conn_ref,
|
||||
umts_aka,
|
||||
vsub->sec_ctx,
|
||||
vsub->vlr->cfg.retrieve_imeisv_ciphered)) {
|
||||
LOGPFSML(fi, LOGL_ERROR,
|
||||
"Failed to send Ciphering Mode Command\n");
|
||||
|
@@ -892,7 +892,6 @@ static void vlr_loc_upd_post_auth(struct osmo_fsm_inst *fi)
|
||||
{
|
||||
struct lu_fsm_priv *lfp = lu_fsm_fi_priv(fi);
|
||||
struct vlr_subscr *vsub = lfp->vsub;
|
||||
bool umts_aka;
|
||||
|
||||
LOGPFSM(fi, "%s()\n", __func__);
|
||||
|
||||
@@ -914,10 +913,7 @@ static void vlr_loc_upd_post_auth(struct osmo_fsm_inst *fi)
|
||||
|
||||
switch (vsub->sec_ctx) {
|
||||
case VLR_SEC_CTX_GSM:
|
||||
umts_aka = false;
|
||||
break;
|
||||
case VLR_SEC_CTX_UMTS:
|
||||
umts_aka = true;
|
||||
break;
|
||||
default:
|
||||
LOGPFSML(fi, LOGL_ERROR, "Cannot start ciphering, security context is not established\n");
|
||||
@@ -926,7 +922,7 @@ static void vlr_loc_upd_post_auth(struct osmo_fsm_inst *fi)
|
||||
}
|
||||
|
||||
if (vlr_set_ciph_mode(vsub->vlr, fi, lfp->msc_conn_ref,
|
||||
umts_aka,
|
||||
vsub->sec_ctx,
|
||||
vsub->vlr->cfg.retrieve_imeisv_ciphered)) {
|
||||
LOGPFSML(fi, LOGL_ERROR,
|
||||
"Failed to send Ciphering Mode Command\n");
|
||||
|
Reference in New Issue
Block a user