[HSS/PCF] Store IMEISV instead of IMEI (#1464)
This commit is contained in:
parent
8f603e2049
commit
3121d183f0
|
@ -148,7 +148,7 @@ int ogs_dbi_update_sqn(char *supi, uint64_t sqn)
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ogs_dbi_update_imei(char *supi, char *imei)
|
int ogs_dbi_update_imeisv(char *supi, char *imeisv)
|
||||||
{
|
{
|
||||||
int rv = OGS_OK;
|
int rv = OGS_OK;
|
||||||
bson_t *query = NULL;
|
bson_t *query = NULL;
|
||||||
|
@ -165,12 +165,13 @@ int ogs_dbi_update_imei(char *supi, char *imei)
|
||||||
supi_id = ogs_id_get_value(supi);
|
supi_id = ogs_id_get_value(supi);
|
||||||
ogs_assert(supi_id);
|
ogs_assert(supi_id);
|
||||||
|
|
||||||
ogs_debug("SUPI type: %s, SUPI id: %s, imei: %s", supi_type, supi_id, imei);
|
ogs_debug("SUPI type: %s, SUPI id: %s, imeisv: %s",
|
||||||
|
supi_type, supi_id, imeisv);
|
||||||
|
|
||||||
query = BCON_NEW(supi_type, BCON_UTF8(supi_id));
|
query = BCON_NEW(supi_type, BCON_UTF8(supi_id));
|
||||||
update = BCON_NEW("$set",
|
update = BCON_NEW("$set",
|
||||||
"{",
|
"{",
|
||||||
"imei", BCON_UTF8(imei),
|
"imeisv", BCON_UTF8(imeisv),
|
||||||
"}");
|
"}");
|
||||||
if (!mongoc_collection_update(ogs_mongoc()->collection.subscriber,
|
if (!mongoc_collection_update(ogs_mongoc()->collection.subscriber,
|
||||||
MONGOC_UPDATE_UPSERT, query, update, NULL, &error)) {
|
MONGOC_UPDATE_UPSERT, query, update, NULL, &error)) {
|
||||||
|
|
|
@ -41,7 +41,7 @@ typedef struct ogs_dbi_auth_info_s {
|
||||||
int ogs_dbi_auth_info(char *supi, ogs_dbi_auth_info_t *auth_info);
|
int ogs_dbi_auth_info(char *supi, ogs_dbi_auth_info_t *auth_info);
|
||||||
int ogs_dbi_update_sqn(char *supi, uint64_t sqn);
|
int ogs_dbi_update_sqn(char *supi, uint64_t sqn);
|
||||||
int ogs_dbi_increment_sqn(char *supi);
|
int ogs_dbi_increment_sqn(char *supi);
|
||||||
int ogs_dbi_update_imei(char *supi, char *imei);
|
int ogs_dbi_update_imeisv(char *supi, char *imeisv);
|
||||||
|
|
||||||
int ogs_dbi_subscription_data(char *supi,
|
int ogs_dbi_subscription_data(char *supi,
|
||||||
ogs_subscription_data_t *subscription_data);
|
ogs_subscription_data_t *subscription_data);
|
||||||
|
|
|
@ -374,7 +374,7 @@ int hss_db_update_sqn(char *imsi_bcd, uint8_t *rand, uint64_t sqn)
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
int hss_db_update_imei(char *imsi_bcd, char *imei)
|
int hss_db_update_imeisv(char *imsi_bcd, char *imeisv)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
char *supi = NULL;
|
char *supi = NULL;
|
||||||
|
@ -385,7 +385,7 @@ int hss_db_update_imei(char *imsi_bcd, char *imei)
|
||||||
supi = ogs_msprintf("%s-%s", OGS_ID_SUPI_TYPE_IMSI, imsi_bcd);
|
supi = ogs_msprintf("%s-%s", OGS_ID_SUPI_TYPE_IMSI, imsi_bcd);
|
||||||
ogs_assert(supi);
|
ogs_assert(supi);
|
||||||
|
|
||||||
rv = ogs_dbi_update_imei(supi, imei);
|
rv = ogs_dbi_update_imeisv(supi, imeisv);
|
||||||
|
|
||||||
ogs_free(supi);
|
ogs_free(supi);
|
||||||
ogs_thread_mutex_unlock(&self.db_lock);
|
ogs_thread_mutex_unlock(&self.db_lock);
|
||||||
|
|
|
@ -61,7 +61,7 @@ int hss_context_parse_config(void);
|
||||||
int hss_db_auth_info(char *imsi_bcd, ogs_dbi_auth_info_t *auth_info);
|
int hss_db_auth_info(char *imsi_bcd, ogs_dbi_auth_info_t *auth_info);
|
||||||
int hss_db_update_sqn(char *imsi_bcd, uint8_t *rand, uint64_t sqn);
|
int hss_db_update_sqn(char *imsi_bcd, uint8_t *rand, uint64_t sqn);
|
||||||
int hss_db_increment_sqn(char *imsi_bcd);
|
int hss_db_increment_sqn(char *imsi_bcd);
|
||||||
int hss_db_update_imei(char *imsi_bcd, char *imei);
|
int hss_db_update_imeisv(char *imsi_bcd, char *imeisv);
|
||||||
|
|
||||||
int hss_db_subscription_data(
|
int hss_db_subscription_data(
|
||||||
char *imsi_bcd, ogs_subscription_data_t *subscription_data);
|
char *imsi_bcd, ogs_subscription_data_t *subscription_data);
|
||||||
|
|
|
@ -318,17 +318,50 @@ static int hss_ogs_diam_s6a_ulr_cb( struct msg **msg, struct avp *avp,
|
||||||
ret = fd_msg_search_avp(qry, ogs_diam_s6a_terminal_information, &avp);
|
ret = fd_msg_search_avp(qry, ogs_diam_s6a_terminal_information, &avp);
|
||||||
ogs_assert(ret == 0);
|
ogs_assert(ret == 0);
|
||||||
if (avp) {
|
if (avp) {
|
||||||
|
char *p, *last;
|
||||||
|
|
||||||
|
p = imeisv_bcd;
|
||||||
|
last = imeisv_bcd + OGS_MAX_IMEISV_BCD_LEN + 1;
|
||||||
|
|
||||||
ret = fd_avp_search_avp(avp, ogs_diam_s6a_imei, &avpch1);
|
ret = fd_avp_search_avp(avp, ogs_diam_s6a_imei, &avpch1);
|
||||||
ogs_assert(ret == 0);
|
ogs_assert(ret == 0);
|
||||||
if (avpch1) {
|
if (avpch1) {
|
||||||
ret = fd_msg_avp_hdr(avpch1, &hdr);
|
ret = fd_msg_avp_hdr(avpch1, &hdr);
|
||||||
ogs_assert(ret == 0);
|
ogs_assert(ret == 0);
|
||||||
if (hdr->avp_value->os.len) {
|
if (hdr->avp_value->os.len) {
|
||||||
ogs_cpystrn(imeisv_bcd, (char*)hdr->avp_value->os.data,
|
char *s = NULL;
|
||||||
ogs_min(hdr->avp_value->os.len, OGS_MAX_IMEISV_BCD_LEN)+1);
|
|
||||||
hss_db_update_imei(imsi_bcd, imeisv_bcd);
|
ogs_assert(hdr->avp_value->os.data);
|
||||||
|
s = ogs_strndup(
|
||||||
|
(const char *)hdr->avp_value->os.data,
|
||||||
|
hdr->avp_value->os.len);
|
||||||
|
ogs_assert(s);
|
||||||
|
p = ogs_slprintf(p, last, "%s", s);
|
||||||
|
|
||||||
|
ogs_free(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = fd_avp_search_avp(avp, ogs_diam_s6a_software_version, &avpch1);
|
||||||
|
ogs_assert(ret == 0);
|
||||||
|
if (avpch1) {
|
||||||
|
ret = fd_msg_avp_hdr(avpch1, &hdr);
|
||||||
|
ogs_assert(ret == 0);
|
||||||
|
if (hdr->avp_value->os.len) {
|
||||||
|
char *s = NULL;
|
||||||
|
|
||||||
|
ogs_assert(hdr->avp_value->os.data);
|
||||||
|
s = ogs_strndup(
|
||||||
|
(const char *)hdr->avp_value->os.data,
|
||||||
|
hdr->avp_value->os.len);
|
||||||
|
ogs_assert(s);
|
||||||
|
p = ogs_slprintf(p, last, "%s", s);
|
||||||
|
|
||||||
|
ogs_free(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ogs_assert(OGS_OK == hss_db_update_imeisv(imsi_bcd, imeisv_bcd));
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = fd_msg_search_avp(qry, ogs_diam_visited_plmn_id, &avp);
|
ret = fd_msg_search_avp(qry, ogs_diam_visited_plmn_id, &avp);
|
||||||
|
|
|
@ -106,9 +106,28 @@ bool pcf_npcf_am_policy_contrtol_handle_create(pcf_ue_t *pcf_ue,
|
||||||
|
|
||||||
pcf_ue->access_type = PolicyAssociationRequest->access_type;
|
pcf_ue->access_type = PolicyAssociationRequest->access_type;
|
||||||
|
|
||||||
if (pcf_ue->pei)
|
if (PolicyAssociationRequest->pei) {
|
||||||
ogs_free(pcf_ue->pei);
|
char *type = NULL, *value = NULL;
|
||||||
pcf_ue->pei = ogs_strdup(PolicyAssociationRequest->pei);
|
if (pcf_ue->pei)
|
||||||
|
ogs_free(pcf_ue->pei);
|
||||||
|
pcf_ue->pei = ogs_strdup(PolicyAssociationRequest->pei);
|
||||||
|
|
||||||
|
type = ogs_id_get_type(pcf_ue->pei);
|
||||||
|
ogs_assert(type);
|
||||||
|
value = ogs_id_get_value(pcf_ue->pei);
|
||||||
|
ogs_assert(value);
|
||||||
|
|
||||||
|
if (strcmp(type, "imeisv") == 0) {
|
||||||
|
ogs_assert(OGS_OK == ogs_dbi_update_imeisv(pcf_ue->supi, value));
|
||||||
|
} else {
|
||||||
|
ogs_fatal("Unknown Type = %s", type);
|
||||||
|
ogs_assert_if_reached();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ogs_free(type);
|
||||||
|
ogs_free(value);
|
||||||
|
}
|
||||||
|
|
||||||
Guami = PolicyAssociationRequest->guami;
|
Guami = PolicyAssociationRequest->guami;
|
||||||
if (Guami && Guami->amf_id &&
|
if (Guami && Guami->amf_id &&
|
||||||
|
|
|
@ -12,7 +12,7 @@ const Profile = new Schema({
|
||||||
title: { $type: String, required: true },
|
title: { $type: String, required: true },
|
||||||
|
|
||||||
msisdn: [ String ],
|
msisdn: [ String ],
|
||||||
imei: [ String ],
|
imeisv: [ String ],
|
||||||
|
|
||||||
security: {
|
security: {
|
||||||
k: String,
|
k: String,
|
||||||
|
|
|
@ -12,7 +12,7 @@ const Subscriber = new Schema({
|
||||||
imsi: { $type: String, unique: true, required: true },
|
imsi: { $type: String, unique: true, required: true },
|
||||||
|
|
||||||
msisdn: [ String ],
|
msisdn: [ String ],
|
||||||
imei: [ String ],
|
imeisv: [ String ],
|
||||||
|
|
||||||
security: {
|
security: {
|
||||||
k: String,
|
k: String,
|
||||||
|
|
|
@ -163,7 +163,7 @@ const View = ({ visible, disableOnClickOutside, profile, onEdit, onDelete, onHid
|
||||||
const _id = (profile || {})._id;
|
const _id = (profile || {})._id;
|
||||||
const title = (profile || {}).title;
|
const title = (profile || {}).title;
|
||||||
const msisdn_list = ((profile || {}).msisdn || []);
|
const msisdn_list = ((profile || {}).msisdn || []);
|
||||||
const imei = (profile || {}).imei;
|
const imeisv = (profile || {}).imeisv;
|
||||||
const security = ((profile || {}).security || {});
|
const security = ((profile || {}).security || {});
|
||||||
const ambr = ((profile || {}).ambr || {});
|
const ambr = ((profile || {}).ambr || {});
|
||||||
const slice_list = ((profile || {}).slice || []);
|
const slice_list = ((profile || {}).slice || []);
|
||||||
|
@ -194,7 +194,7 @@ const View = ({ visible, disableOnClickOutside, profile, onEdit, onDelete, onHid
|
||||||
<div className="header">
|
<div className="header">
|
||||||
Profile Configuration
|
Profile Configuration
|
||||||
</div>
|
</div>
|
||||||
{(msisdn_list.length !== 0 || (imei && imei.length !== 0)) &&
|
{(msisdn_list.length !== 0 || (imeisv && imeisv.length !== 0)) &&
|
||||||
<div className="body">
|
<div className="body">
|
||||||
<div className="left">
|
<div className="left">
|
||||||
<PhoneIcon/>
|
<PhoneIcon/>
|
||||||
|
@ -206,10 +206,10 @@ const View = ({ visible, disableOnClickOutside, profile, onEdit, onDelete, onHid
|
||||||
<span style={{color:oc.gray[5]}}><KeyboardControlIcon/>MSISDN</span>
|
<span style={{color:oc.gray[5]}}><KeyboardControlIcon/>MSISDN</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{imei && imei.length !== 0 &&
|
{imeisv && imeisv.length !== 0 &&
|
||||||
<div className="data">
|
<div className="data">
|
||||||
{imei}
|
{imeisv}
|
||||||
<span style={{color:oc.gray[5]}}><KeyboardControlIcon/>IMEI</span>
|
<span style={{color:oc.gray[5]}}><KeyboardControlIcon/>IMEISV</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -162,7 +162,7 @@ const Pdn = styled.div`
|
||||||
const View = ({ visible, disableOnClickOutside, subscriber, onEdit, onDelete, onHide }) => {
|
const View = ({ visible, disableOnClickOutside, subscriber, onEdit, onDelete, onHide }) => {
|
||||||
const imsi = (subscriber || {}).imsi;
|
const imsi = (subscriber || {}).imsi;
|
||||||
const msisdn_list = ((subscriber || {}).msisdn || []);
|
const msisdn_list = ((subscriber || {}).msisdn || []);
|
||||||
const imei = (subscriber || {}).imei;
|
const imeisv = (subscriber || {}).imeisv;
|
||||||
const security = ((subscriber || {}).security || {});
|
const security = ((subscriber || {}).security || {});
|
||||||
const ambr = ((subscriber || {}).ambr || {});
|
const ambr = ((subscriber || {}).ambr || {});
|
||||||
const slice_list = ((subscriber || {}).slice || []);
|
const slice_list = ((subscriber || {}).slice || []);
|
||||||
|
@ -193,7 +193,7 @@ const View = ({ visible, disableOnClickOutside, subscriber, onEdit, onDelete, on
|
||||||
<div className="header">
|
<div className="header">
|
||||||
Subscriber Configuration
|
Subscriber Configuration
|
||||||
</div>
|
</div>
|
||||||
{(msisdn_list.length !== 0 || (imei && imei.length !== 0)) &&
|
{(msisdn_list.length !== 0 || (imeisv && imeisv.length !== 0)) &&
|
||||||
<div className="body">
|
<div className="body">
|
||||||
<div className="left">
|
<div className="left">
|
||||||
<PhoneIcon/>
|
<PhoneIcon/>
|
||||||
|
@ -205,10 +205,10 @@ const View = ({ visible, disableOnClickOutside, subscriber, onEdit, onDelete, on
|
||||||
<span style={{color:oc.gray[5]}}><KeyboardControlIcon/>MSISDN</span>
|
<span style={{color:oc.gray[5]}}><KeyboardControlIcon/>MSISDN</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{imei && imei.length !== 0 &&
|
{imeisv && imeisv.length !== 0 &&
|
||||||
<div className="data">
|
<div className="data">
|
||||||
{imei}
|
{imeisv}
|
||||||
<span style={{color:oc.gray[5]}}><KeyboardControlIcon/>IMEI</span>
|
<span style={{color:oc.gray[5]}}><KeyboardControlIcon/>IMEISV</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue