Change in osmo-msc[master]: fix vlr ops.subscr_assoc re-association

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Jan 2 16:24:53 UTC 2019


Neels Hofmeyr has uploaded this change for review. ( https://gerrit.osmocom.org/12449


Change subject: fix vlr ops.subscr_assoc re-association
......................................................................

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
---
M include/osmocom/msc/vlr.h
M src/libmsc/gsm_04_08.c
M src/libvlr/vlr_access_req_fsm.c
M src/libvlr/vlr_lu_fsm.c
4 files changed, 26 insertions(+), 10 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/49/12449/1

diff --git a/include/osmocom/msc/vlr.h b/include/osmocom/msc/vlr.h
index 20a9c0f..3c778a9 100644
--- a/include/osmocom/msc/vlr.h
+++ b/include/osmocom/msc/vlr.h
@@ -235,7 +235,7 @@
 	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 dc0476b..2d34949 100644
--- a/src/libmsc/gsm_04_08.c
+++ b/src/libmsc/gsm_04_08.c
@@ -1764,12 +1764,22 @@
 }
 
 /* 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 @@
 	 * 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,
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 @@
 	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 @@
 	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 @@
 					  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 @@
 		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 @@
 	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;
 }
 

-- 
To view, visit https://gerrit.osmocom.org/12449
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic0d54644bc735700220b1ef3a4384c217d57d20f
Gerrit-Change-Number: 12449
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190102/1e4c773b/attachment.htm>


More information about the gerrit-log mailing list