aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-12-28 21:22:32 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2018-12-29 02:10:12 +0100
commitbc6b8fbd0839f89ce55672e19b0581dabad7853e (patch)
tree6051f32beb6299598dd1d9779556d6d8e279895b
parente5eb6d4ffd862b14858b28cc2b705c7c64836924 (diff)
fix vlr ops.subscr_assoc re-associationneels/35c335c3
In rare cases, a conn is already associated with a subscriber. So far, we abort()ed on that. Rather log an error and keep the service running. Related: OS#3743 Change-Id: Ic0d54644bc735700220b1ef3a4384c217d57d20f
-rw-r--r--include/osmocom/msc/vlr.h2
-rw-r--r--src/libmsc/gsm_04_08.c15
-rw-r--r--src/libvlr/vlr_access_req_fsm.c16
-rw-r--r--src/libvlr/vlr_lu_fsm.c3
4 files changed, 26 insertions, 10 deletions
diff --git a/include/osmocom/msc/vlr.h b/include/osmocom/msc/vlr.h
index 27c72ef..029ef31 100644
--- a/include/osmocom/msc/vlr.h
+++ b/include/osmocom/msc/vlr.h
@@ -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);
diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c
index 7fdd3f4..2955632 100644
--- a/src/libmsc/gsm_04_08.c
+++ b/src/libmsc/gsm_04_08.c
@@ -1804,12 +1804,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;
+ }
+ }
+ OSMO_ASSERT(!conn->vsub || conn->vsub );
conn->vsub = vlr_subscr_get(vsub);
OSMO_ASSERT(conn->vsub);
conn->vsub->cs.attached_via_ran = conn->via_ran;
@@ -1820,6 +1830,7 @@ static void msc_vlr_subscr_assoc(void *msc_conn_ref,
update_classmark(&conn->temporary_classmark, &conn->vsub->classmark);
ran_conn_update_id(conn);
+ return 0;
}
static int msc_vlr_route_gsup_msg(struct vlr_subscr *vsub,
diff --git a/src/libvlr/vlr_access_req_fsm.c b/src/libvlr/vlr_access_req_fsm.c
index 3a0760d..3b40285 100644
--- a/src/libvlr/vlr_access_req_fsm.c
+++ b/src/libvlr/vlr_access_req_fsm.c
@@ -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);
}
diff --git a/src/libvlr/vlr_lu_fsm.c b/src/libvlr/vlr_lu_fsm.c
index e635305..b00f8ce 100644
--- a/src/libvlr/vlr_lu_fsm.c
+++ b/src/libvlr/vlr_lu_fsm.c
@@ -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;
}