fix vlr ops.subscr_assoc re-association

In rare cases, a conn is already associated with a subscriber. So far, we
abort()ed on that, bringing the entire osmo-msc down. Rather log an error and
keep the service running.

In vlr.ops.subscr_assoc, add success/failure return value, and abort the
LU/PARQ on error.

I haven't figured out in detail yet why/how a subscriber would re-launch a
LU/PARQ on a conn that is already associated, so far it is merely clear that we
do not want to crash the MSC if that happens. A log is in OS#3742.

Related: OS#3742, OS#3743
Change-Id: Ic0d54644bc735700220b1ef3a4384c217d57d20f
This commit is contained in:
Neels Hofmeyr 2018-12-28 21:22:32 +01:00 committed by Neels Hofmeyr
parent 3350bf9f78
commit 1035d90c17
4 changed files with 26 additions and 10 deletions

View File

@ -235,7 +235,7 @@ struct vlr_ops {
void (*subscr_update)(struct vlr_subscr *vsub);
/* notify MSC/SGSN that the given subscriber has been associated
* with this msc_conn_ref */
void (*subscr_assoc)(void *msc_conn_ref, struct vlr_subscr *vsub);
int (*subscr_assoc)(void *msc_conn_ref, struct vlr_subscr *vsub);
/* Forward a parsed GSUP message towards MSC message router */
int (*forward_gsup_msg)(struct vlr_subscr *vsub, struct osmo_gsup_message *gsup_msg);

View File

@ -1764,12 +1764,22 @@ static void update_classmark(const struct gsm_classmark *src, struct gsm_classma
}
/* VLR informs us that the subscriber has been associated with a conn */
static void msc_vlr_subscr_assoc(void *msc_conn_ref,
static int msc_vlr_subscr_assoc(void *msc_conn_ref,
struct vlr_subscr *vsub)
{
struct ran_conn *conn = msc_conn_ref;
OSMO_ASSERT(vsub);
OSMO_ASSERT(!conn->vsub);
if (conn->vsub) {
if (conn->vsub == vsub)
LOGPCONN(conn, LOGL_NOTICE, "msc_vlr_subscr_assoc(): conn already associated with %s\n",
vlr_subscr_name(vsub));
else {
LOGPCONN(conn, LOGL_ERROR, "msc_vlr_subscr_assoc(): conn already associated with a subscriber,"
" cannot associate with %s\n", vlr_subscr_name(vsub));
return -EINVAL;
}
}
conn->vsub = vlr_subscr_get(vsub);
OSMO_ASSERT(conn->vsub);
conn->vsub->cs.attached_via_ran = conn->via_ran;
@ -1778,6 +1788,7 @@ static void msc_vlr_subscr_assoc(void *msc_conn_ref,
* associated with the conn: merge the new Classmark into vsub->classmark. Don't overwrite valid
* vsub->classmark with unset classmark, though. */
update_classmark(&conn->temporary_classmark, &conn->vsub->classmark);
return 0;
}
static int msc_vlr_route_gsup_msg(struct vlr_subscr *vsub,

View File

@ -72,7 +72,7 @@ struct proc_arq_priv {
bool implicitly_accepted_parq_by_ciphering_cmd;
};
static void assoc_par_with_subscr(struct osmo_fsm_inst *fi, struct vlr_subscr *vsub)
static int assoc_par_with_subscr(struct osmo_fsm_inst *fi, struct vlr_subscr *vsub)
{
struct proc_arq_priv *par = fi->priv;
struct vlr_instance *vlr = par->vlr;
@ -81,7 +81,7 @@ static void assoc_par_with_subscr(struct osmo_fsm_inst *fi, struct vlr_subscr *v
par->vsub = vsub;
/* Tell MSC to associate this subscriber with the given
* connection */
vlr->ops.subscr_assoc(par->msc_conn_ref, par->vsub);
return vlr->ops.subscr_assoc(par->msc_conn_ref, par->vsub);
}
static const char *vlr_proc_arq_result_name(const struct osmo_fsm_inst *fi)
@ -371,8 +371,10 @@ static void proc_arq_vlr_fn_init(struct osmo_fsm_inst *fi,
GSM48_REJECT_NETWORK_FAILURE);
}
vsub->proc_arq_fsm = fi;
assoc_par_with_subscr(fi, vsub);
proc_arq_vlr_fn_post_imsi(fi);
if (assoc_par_with_subscr(fi, vsub) != 0)
proc_arq_fsm_done(fi, GSM48_REJECT_NETWORK_FAILURE);
else
proc_arq_vlr_fn_post_imsi(fi);
vlr_subscr_put(vsub);
return;
}
@ -414,8 +416,10 @@ static void proc_arq_vlr_fn_w_obt_imsi(struct osmo_fsm_inst *fi,
proc_arq_fsm_done(fi, GSM48_REJECT_IMSI_UNKNOWN_IN_VLR);
return;
}
assoc_par_with_subscr(fi, vsub);
proc_arq_vlr_fn_post_imsi(fi);
if (assoc_par_with_subscr(fi, vsub))
proc_arq_fsm_done(fi, GSM48_REJECT_NETWORK_FAILURE);
else
proc_arq_vlr_fn_post_imsi(fi);
vlr_subscr_put(vsub);
}

View File

@ -954,7 +954,8 @@ static int assoc_lfp_with_sub(struct osmo_fsm_inst *fi, struct vlr_subscr *vsub)
lfp->vsub = vsub;
/* Tell MSC to associate this subscriber with the given
* connection */
vlr->ops.subscr_assoc(lfp->msc_conn_ref, lfp->vsub);
if (vlr->ops.subscr_assoc(lfp->msc_conn_ref, lfp->vsub))
lu_fsm_failure(fi, GSM48_REJECT_NETWORK_FAILURE);
return 0;
}