hss: Don't send IDR for Operator-Determined-Barring changes if Subscriber-Status=SERVICE_GRANTED

This commit is contained in:
Pau Espin 2023-10-12 15:33:56 +02:00 committed by Sukchan Lee
parent e108d6297c
commit 79d3c7078f
3 changed files with 14 additions and 2 deletions

View File

@ -85,6 +85,7 @@ extern "C" {
#define OGS_DIAM_S6A_SUBDATA_UEAMBR (1 << 7)
#define OGS_DIAM_S6A_SUBDATA_APN_CONFIG (1 << 8)
#define OGS_DIAM_S6A_SUBDATA_RAU_TAU_TIMER (1 << 9)
#define OGS_DIAM_S6A_SUBDATA_OP_DET_BARRING (1 << 10)
#define OGS_DIAM_S6A_SUBDATA_ALL 0xFFFFFFFF
extern struct dict_object *ogs_diam_s6a_application;

View File

@ -1259,7 +1259,7 @@ int hss_handle_change_event(const bson_t *document)
strlen("operator_determined_barring"))) {
send_idr_flag = true;
subdatamask = (subdatamask |
OGS_DIAM_S6A_SUBDATA_SUB_STATUS);
OGS_DIAM_S6A_SUBDATA_OP_DET_BARRING);
} else if (!strncmp(child2_key,
"network_access_mode",
strlen("network_access_mode"))) {

View File

@ -364,7 +364,7 @@ static int hss_s6a_avp_add_subscription_data(
}
}
if (subdatamask & OGS_DIAM_S6A_SUBDATA_SUB_STATUS) {
if (subdatamask & (OGS_DIAM_S6A_SUBDATA_SUB_STATUS | OGS_DIAM_S6A_SUBDATA_OP_DET_BARRING)) {
ret = fd_msg_avp_new(
ogs_diam_s6a_subscriber_status, 0, &avp_subscriber_status);
ogs_assert(ret == 0);
@ -1356,6 +1356,17 @@ int hss_s6a_send_idr(char *imsi_bcd, uint32_t idr_flags, uint32_t subdatamask)
return OGS_ERROR;
}
/* Avoid sending IDR if only Operator-Determined-Barring field changed and
* Subscriber-Status is SERVICE_GRANTED, since then the field has no
* meaning and won't be sent through the wire, so nothing really changes
* from the PoV of the peer. */
if (subdatamask == OGS_DIAM_S6A_SUBDATA_OP_DET_BARRING &&
subscription_data.subscriber_status == OGS_SUBSCRIBER_STATUS_SERVICE_GRANTED) {
ogs_debug(" [%s] Skip sending IDR: Only Operator-Determined-Barring changed while"
" Subscriber-Status is SERVICE_GRANTED.", imsi_bcd);
return OGS_OK;
}
/* Create the random value to store with the session */
sess_data = ogs_calloc(1, sizeof(*sess_data));
ogs_assert(sess_data);