lynxis lazus has submitted this change. ( https://gerrit.osmocom.org/c/osmo-msc/+/38488?usp=email )
Change subject: vlr: extend the subscriber invalidate callback with reasons ......................................................................
vlr: extend the subscriber invalidate callback with reasons
The VLR must be allowed to notify the MSC if a subscriber becomes invalid. There are multiple cases when this happens: a) if the subscriber didn't do a Location Update Procedure within the given periodic timer. b) if the HLR does a Cancel Location Procedure with reason withdraw c) if the HLR does a Cancel Location Procedure with reason update location. d) duplicate entries (unsure if this is valid, but keeping the code as is)
Change-Id: Ie5b687318b106a230fcee52deba86649641004b3 --- M include/osmocom/vlr/vlr.h M src/libmsc/gsm_04_08.c M src/libvlr/vlr.c 3 files changed, 11 insertions(+), 4 deletions(-)
Approvals: neels: Looks good to me, approved Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve
diff --git a/include/osmocom/vlr/vlr.h b/include/osmocom/vlr/vlr.h index ed6438b..b1994d0 100644 --- a/include/osmocom/vlr/vlr.h +++ b/include/osmocom/vlr/vlr.h @@ -204,6 +204,13 @@ VLR_CIPH_A5_3 = 3, /*< A5/3, 'new secure' encryption */ };
+enum vlr_inval_reason { + VLR_INVAL_REASON_WITHDRAWN, /*< HLR cancel location, reason subscription withdrawn */ + VLR_INVAL_REASON_UPDATE_LOCATION, /*< HLR cancel location, reason update location */ + VLR_INVAL_REASON_LOCATION_EXPIRED, /*< Location Update timer ran out */ + VLR_INVAL_REASON_DUPLICATE_SUBSCR, /*< A newer record of the same subscriber exists. This is the old entry. */ +}; + static inline uint8_t vlr_ciph_to_gsm0808_alg_id(enum vlr_ciph ciph) { switch (ciph) { @@ -250,8 +257,8 @@ /* notify MSC/SGSN that the given subscriber has been associated * with this msc_conn_ref */ int (*subscr_assoc)(void *msc_conn_ref, struct vlr_subscr *vsub); - /* notify MSC that the given subscriber is no longer valid */ - void (*subscr_inval)(void *msc_conn_ref, struct vlr_subscr *vsub); + /* notify MSC that the given subscriber is no longer valid. */ + void (*subscr_inval)(void *msc_conn_ref, struct vlr_subscr *vsub, enum vlr_inval_reason reason); };
/* An instance of the VLR codebase */ diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c index d9e0b5f..de0a693 100644 --- a/src/libmsc/gsm_04_08.c +++ b/src/libmsc/gsm_04_08.c @@ -1572,7 +1572,7 @@ return 0; }
-static void msc_vlr_subscr_inval(void *msc_conn_ref, struct vlr_subscr *vsub) +static void msc_vlr_subscr_inval(void *msc_conn_ref, struct vlr_subscr *vsub, enum vlr_inval_reason reason) { /* Search vsub backwards to make sure msc_conn_ref is a valid msc_a instance. */ struct msub *msub; diff --git a/src/libvlr/vlr.c b/src/libvlr/vlr.c index 95b081a..8e053ae 100644 --- a/src/libvlr/vlr.c +++ b/src/libvlr/vlr.c @@ -629,7 +629,7 @@ exists->imsi);
if (vlr->ops.subscr_inval) - vlr->ops.subscr_inval(exists->msc_conn_ref, exists); + vlr->ops.subscr_inval(exists->msc_conn_ref, exists, VLR_INVAL_REASON_DUPLICATE_SUBSCR); vlr_subscr_free(exists); }