aboutsummaryrefslogtreecommitdiffstats
path: root/src/libvlr
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2019-04-03 16:23:29 +0200
committerHarald Welte <laforge@gnumonks.org>2019-05-27 11:49:50 +0000
commit483cea889c776fb556184479d69431054d4e3ae6 (patch)
tree791096fa532cb8b5747d089286af744ac16966d3 /src/libvlr
parentb683dcfe6bda723413b19c3bf5789d1a3bc3f7c7 (diff)
sgs_iface: detect and react to VLR/HLR failure
The HLR (which is connected via the GSUP interface) may fail and disconnect. On the next location update the VLR will try to talk to the HLR and fail. This failure event is not communicated towards the SGs related code and the SGs-association will remain in the LA-PRESENT state forever. Lets add code to report the problem to the SGs code and trigger a RESET an the SGs interface. - Add a flag to report an HLR problem back to the SGs code - Fix the FSM that controls the reset - Make sure the all SGs associations are reset when the failure occurs. Change-Id: Icc7df92879728bc98c85fc1d5d8b4c6246501b12 Related: OS#3859
Diffstat (limited to 'src/libvlr')
-rw-r--r--src/libvlr/vlr.c4
-rw-r--r--src/libvlr/vlr_sgs_fsm.c49
2 files changed, 33 insertions, 20 deletions
diff --git a/src/libvlr/vlr.c b/src/libvlr/vlr.c
index b156b430b..2753096e9 100644
--- a/src/libvlr/vlr.c
+++ b/src/libvlr/vlr.c
@@ -854,7 +854,7 @@ static int vlr_subscr_handle_isd_req(struct vlr_subscr *vsub,
static int vlr_subscr_handle_lu_res(struct vlr_subscr *vsub,
const struct osmo_gsup_message *gsup)
{
- struct sgs_lu_response sgs_lu_response;
+ struct sgs_lu_response sgs_lu_response = {0};
bool sgs_lu_in_progress = false;
if (vsub->sgs_fsm->state == SGS_UE_ST_LA_UPD_PRES)
@@ -885,7 +885,7 @@ static int vlr_subscr_handle_lu_res(struct vlr_subscr *vsub,
static int vlr_subscr_handle_lu_err(struct vlr_subscr *vsub,
const struct osmo_gsup_message *gsup)
{
- struct sgs_lu_response sgs_lu_response;
+ struct sgs_lu_response sgs_lu_response = {0};
bool sgs_lu_in_progress = false;
if (vsub->sgs_fsm->state == SGS_UE_ST_LA_UPD_PRES)
diff --git a/src/libvlr/vlr_sgs_fsm.c b/src/libvlr/vlr_sgs_fsm.c
index 13639ca3c..49ad09a59 100644
--- a/src/libvlr/vlr_sgs_fsm.c
+++ b/src/libvlr/vlr_sgs_fsm.c
@@ -48,24 +48,6 @@ static const struct value_string sgs_ue_fsm_event_names[] = {
{0, NULL}
};
-/* Initiate location update and change to SGS_UE_ST_LA_UPD_PRES state */
-static void perform_lu(struct osmo_fsm_inst *fi)
-{
- struct vlr_subscr *vsub = fi->priv;
- int rc;
- osmo_fsm_inst_state_chg(fi, SGS_UE_ST_LA_UPD_PRES, 0, 0);
- vsub->ms_not_reachable_flag = false;
-
- /* Note: At the moment we allocate a new TMSI on each LU. */
- rc = vlr_subscr_alloc_tmsi(vsub);
- if (rc != 0)
- LOGPFSML(fi, LOGL_ERROR, "(sub %s) VLR LU tmsi allocation failed\n", vlr_subscr_name(vsub));
-
- rc = vlr_subscr_req_lu(vsub);
- if (rc != 0)
- LOGPFSML(fi, LOGL_ERROR, "(sub %s) HLR LU request failed\n", vlr_subscr_name(vsub));
-}
-
/* Send the SGs Association to NULL state immediately */
static void to_null(struct osmo_fsm_inst *fi)
{
@@ -86,6 +68,37 @@ static void to_null(struct osmo_fsm_inst *fi)
osmo_timer_del(&vsub->sgs.Ts5);
}
+/* Initiate location update and change to SGS_UE_ST_LA_UPD_PRES state */
+static void perform_lu(struct osmo_fsm_inst *fi)
+{
+ struct vlr_subscr *vsub = fi->priv;
+ struct sgs_lu_response sgs_lu_response = {0};
+ int rc;
+
+ /* Note: At the moment we allocate a new TMSI on each LU. */
+ rc = vlr_subscr_alloc_tmsi(vsub);
+ if (rc != 0) {
+ LOGPFSML(fi, LOGL_ERROR, "(sub %s) VLR LU tmsi allocation failed\n", vlr_subscr_name(vsub));
+ goto error;
+ }
+
+ rc = vlr_subscr_req_lu(vsub);
+ if (rc != 0) {
+ LOGPFSML(fi, LOGL_ERROR, "(sub %s) HLR LU request failed\n", vlr_subscr_name(vsub));
+ goto error;
+ }
+
+ osmo_fsm_inst_state_chg(fi, SGS_UE_ST_LA_UPD_PRES, 0, 0);
+ vsub->ms_not_reachable_flag = false;
+ return;
+
+error:
+ to_null(fi);
+ sgs_lu_response.error = true;
+ sgs_lu_response.vsub = vsub;
+ vsub->sgs.response_cb(&sgs_lu_response);
+}
+
/* Respawn a pending paging (Timer is reset and a new paging request is sent) */
static void respawn_paging(struct vlr_subscr *vsub)
{