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
This commit is contained in:
Alexander Couzens
2024-10-21 19:41:59 +02:00
committed by lynxis lazus
parent ba9f30c5cc
commit 5611c75328
3 changed files with 11 additions and 4 deletions

View File

@@ -204,6 +204,13 @@ enum vlr_ciph {
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 @@ struct vlr_ops {
/* 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 */

View File

@@ -1572,7 +1572,7 @@ static int msc_vlr_subscr_assoc(void *msc_conn_ref,
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;

View File

@@ -629,7 +629,7 @@ static void dedup_vsub(struct vlr_subscr *exists, struct vlr_subscr *vsub)
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);
}