forked from acouzens/open5gs
[METRICS] Fixed a core dump in SMF/UPF/PCF (#1985)
This commit is contained in:
parent
2ec1f484b4
commit
8553c77733
|
@ -320,11 +320,6 @@ void pcf_sess_remove(pcf_sess_t *sess)
|
|||
OpenAPI_subscribed_default_qos_free(sess->subscribed_default_qos);
|
||||
|
||||
ogs_pool_free(&pcf_sess_pool, sess);
|
||||
|
||||
if (sess->s_nssai.sst != 0) {
|
||||
pcf_metrics_inst_by_slice_add(&sess->pcf_ue->guami.plmn_id,
|
||||
&sess->s_nssai, PCF_METR_GAUGE_PA_SESSIONNBR, -1);
|
||||
}
|
||||
}
|
||||
|
||||
void pcf_sess_remove_all(pcf_ue_t *pcf_ue)
|
||||
|
|
|
@ -52,12 +52,12 @@ pcf_metrics_spec_def_t pcf_metrics_spec_def_global[_PCF_METR_GLOB_MAX] = {
|
|||
/* Global Counters: */
|
||||
/* Global Gauges: */
|
||||
};
|
||||
static int pcf_metrics_init_inst_global(void)
|
||||
int pcf_metrics_init_inst_global(void)
|
||||
{
|
||||
return pcf_metrics_init_inst(pcf_metrics_inst_global,
|
||||
pcf_metrics_spec_global, _PCF_METR_GLOB_MAX, 0, NULL);
|
||||
}
|
||||
static int pcf_metrics_free_inst_global(void)
|
||||
int pcf_metrics_free_inst_global(void)
|
||||
{
|
||||
return pcf_metrics_free_inst(pcf_metrics_inst_global, _PCF_METR_GLOB_MAX);
|
||||
}
|
||||
|
@ -282,8 +282,6 @@ int pcf_metrics_close(void)
|
|||
ogs_hash_index_t *hi;
|
||||
ogs_metrics_context_t *ctx = ogs_metrics_self();
|
||||
|
||||
pcf_metrics_free_inst_global();
|
||||
|
||||
if (metrics_hash_by_slice) {
|
||||
for (hi = ogs_hash_first(metrics_hash_by_slice); hi; hi = ogs_hash_next(hi)) {
|
||||
pcf_metric_key_by_slice_t *key =
|
||||
|
|
|
@ -12,6 +12,9 @@ typedef enum pcf_metric_type_global_s {
|
|||
} pcf_metric_type_global_t;
|
||||
extern ogs_metrics_inst_t *pcf_metrics_inst_global[_PCF_METR_GLOB_MAX];
|
||||
|
||||
int pcf_metrics_init_inst_global(void);
|
||||
int pcf_metrics_free_inst_global(void);
|
||||
|
||||
static inline void pcf_metrics_inst_global_set(pcf_metric_type_global_t t, int val)
|
||||
{ ogs_metrics_inst_set(pcf_metrics_inst_global[t], val); }
|
||||
static inline void pcf_metrics_inst_global_add(pcf_metric_type_global_t t, int val)
|
||||
|
|
|
@ -296,6 +296,9 @@ void pcf_sm_state_deleted(ogs_fsm_t *s, pcf_event_t *e)
|
|||
|
||||
switch (e->h.id) {
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
ogs_assert(sess->pcf_ue);
|
||||
pcf_metrics_inst_by_slice_add(&sess->pcf_ue->guami.plmn_id,
|
||||
&sess->s_nssai, PCF_METR_GAUGE_PA_SESSIONNBR, -1);
|
||||
break;
|
||||
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
|
@ -325,6 +328,9 @@ void pcf_sm_state_exception(ogs_fsm_t *s, pcf_event_t *e)
|
|||
|
||||
switch (e->h.id) {
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
ogs_assert(sess->pcf_ue);
|
||||
pcf_metrics_inst_by_slice_add(&sess->pcf_ue->guami.plmn_id,
|
||||
&sess->s_nssai, PCF_METR_GAUGE_PA_SESSIONNBR, -1);
|
||||
break;
|
||||
|
||||
case OGS_FSM_EXIT_SIG:
|
||||
|
|
|
@ -2441,11 +2441,6 @@ int smf_bearer_remove(smf_bearer_t *bearer)
|
|||
ogs_assert(bearer);
|
||||
ogs_assert(bearer->sess);
|
||||
|
||||
if (SMF_IS_QOF_FLOW(bearer))
|
||||
smf_metrics_inst_by_5qi_add(&bearer->sess->plmn_id,
|
||||
&bearer->sess->s_nssai, bearer->sess->session.qos.index,
|
||||
SMF_METR_GAUGE_SM_QOSFLOWNBR, -1);
|
||||
|
||||
ogs_list_remove(&bearer->sess->bearer_list, bearer);
|
||||
|
||||
ogs_assert(bearer->dl_pdr);
|
||||
|
@ -3097,10 +3092,6 @@ static void stats_remove_smf_session(smf_sess_t *sess)
|
|||
{
|
||||
ogs_assert(sess);
|
||||
|
||||
if (sess->s_nssai.sst != 0) {
|
||||
smf_metrics_inst_by_slice_add(&sess->plmn_id, &sess->s_nssai,
|
||||
SMF_METR_GAUGE_SM_SESSIONNBR, -1);
|
||||
}
|
||||
num_of_smf_sess = num_of_smf_sess - 1;
|
||||
ogs_info("[Removed] Number of SMF-Sessions is now %d", num_of_smf_sess);
|
||||
}
|
||||
|
|
|
@ -1585,6 +1585,8 @@ void smf_gsm_state_session_will_release(ogs_fsm_t *s, smf_event_t *e)
|
|||
|
||||
switch (e->h.id) {
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
smf_metrics_inst_by_slice_add(&sess->plmn_id, &sess->s_nssai,
|
||||
SMF_METR_GAUGE_SM_SESSIONNBR, -1);
|
||||
SMF_SESS_CLEAR(sess);
|
||||
break;
|
||||
|
||||
|
@ -1615,6 +1617,8 @@ void smf_gsm_state_exception(ogs_fsm_t *s, smf_event_t *e)
|
|||
switch (e->h.id) {
|
||||
case OGS_FSM_ENTRY_SIG:
|
||||
ogs_error("[%s:%d] State machine exception", smf_ue->supi, sess->psi);
|
||||
smf_metrics_inst_by_slice_add(&sess->plmn_id, &sess->s_nssai,
|
||||
SMF_METR_GAUGE_SM_SESSIONNBR, -1);
|
||||
SMF_SESS_CLEAR(sess);
|
||||
break;
|
||||
|
||||
|
|
|
@ -495,8 +495,14 @@ void smf_5gc_n4_handle_session_modification_response(
|
|||
smf_namf_comm_send_n1_n2_message_transfer(sess, ¶m);
|
||||
|
||||
ogs_list_for_each_entry_safe(&sess->qos_flow_to_modify_list,
|
||||
next, qos_flow, to_modify_node)
|
||||
next, qos_flow, to_modify_node) {
|
||||
smf_metrics_inst_by_5qi_add(
|
||||
&qos_flow->sess->plmn_id,
|
||||
&qos_flow->sess->s_nssai,
|
||||
qos_flow->sess->session.qos.index,
|
||||
SMF_METR_GAUGE_SM_QOSFLOWNBR, -1);
|
||||
smf_bearer_remove(qos_flow);
|
||||
}
|
||||
|
||||
} else if (flags & OGS_PFCP_MODIFY_UE_REQUESTED) {
|
||||
ogs_pkbuf_t *n1smbuf = NULL, *n2smbuf = NULL;
|
||||
|
@ -521,8 +527,14 @@ void smf_5gc_n4_handle_session_modification_response(
|
|||
OpenAPI_n2_sm_info_type_PDU_RES_MOD_REQ, n2smbuf);
|
||||
|
||||
ogs_list_for_each_entry_safe(&sess->qos_flow_to_modify_list,
|
||||
next, qos_flow, to_modify_node)
|
||||
next, qos_flow, to_modify_node) {
|
||||
smf_metrics_inst_by_5qi_add(
|
||||
&qos_flow->sess->plmn_id,
|
||||
&qos_flow->sess->s_nssai,
|
||||
qos_flow->sess->session.qos.index,
|
||||
SMF_METR_GAUGE_SM_QOSFLOWNBR, -1);
|
||||
smf_bearer_remove(qos_flow);
|
||||
}
|
||||
|
||||
} else {
|
||||
ogs_fatal("Unknown flags [0x%llx]", (long long)flags);
|
||||
|
|
|
@ -82,12 +82,12 @@ upf_metrics_spec_def_t upf_metrics_spec_def_global[_UPF_METR_GLOB_MAX] = {
|
|||
.description = "Active Sessions",
|
||||
},
|
||||
};
|
||||
static int upf_metrics_init_inst_global(void)
|
||||
int upf_metrics_init_inst_global(void)
|
||||
{
|
||||
return upf_metrics_init_inst(upf_metrics_inst_global, upf_metrics_spec_global,
|
||||
_UPF_METR_GLOB_MAX, 0, NULL);
|
||||
}
|
||||
static int upf_metrics_free_inst_global(void)
|
||||
int upf_metrics_free_inst_global(void)
|
||||
{
|
||||
return upf_metrics_free_inst(upf_metrics_inst_global, _UPF_METR_GLOB_MAX);
|
||||
}
|
||||
|
@ -341,7 +341,6 @@ int upf_metrics_close(void)
|
|||
{
|
||||
ogs_hash_index_t *hi;
|
||||
ogs_metrics_context_t *ctx = ogs_metrics_self();
|
||||
upf_metrics_free_inst_global();
|
||||
|
||||
if (metrics_hash_by_qfi) {
|
||||
for (hi = ogs_hash_first(metrics_hash_by_qfi); hi; hi = ogs_hash_next(hi)) {
|
||||
|
|
|
@ -19,6 +19,9 @@ typedef enum upf_metric_type_global_s {
|
|||
} upf_metric_type_global_t;
|
||||
extern ogs_metrics_inst_t *upf_metrics_inst_global[_UPF_METR_GLOB_MAX];
|
||||
|
||||
int upf_metrics_init_inst_global(void);
|
||||
int upf_metrics_free_inst_global(void);
|
||||
|
||||
static inline void upf_metrics_inst_global_set(upf_metric_type_global_t t, int val)
|
||||
{ ogs_metrics_inst_set(upf_metrics_inst_global[t], val); }
|
||||
static inline void upf_metrics_inst_global_add(upf_metric_type_global_t t, int val)
|
||||
|
|
Loading…
Reference in New Issue