From f35aa2178fcde8cf731e554bfc32a659348cefd6 Mon Sep 17 00:00:00 2001 From: Sukchan Lee Date: Fri, 19 Jan 2018 01:32:01 +0900 Subject: [PATCH] fix the abort-cause value --- lib/fd/rx/rx_dict.h | 10 +++++----- src/pcrf/pcrf_rx_path.c | 18 ++++++++++++------ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/lib/fd/rx/rx_dict.h b/lib/fd/rx/rx_dict.h index bdfdae93f..520f67379 100644 --- a/lib/fd/rx/rx_dict.h +++ b/lib/fd/rx/rx_dict.h @@ -87,11 +87,11 @@ extern struct dict_object *rx_ip_can_type; #define RX_RAT_TYPE_UMB 2002 #define RX_RAT_TYPE_EHRPD 2003 extern struct dict_object *rx_rat_type; -#define RX_ABORT_CAUSE_BEARER_RELEASED 1 -#define RX_ABORT_CAUSE_INSUFFICIENT_SERVER_RESOURCES 2 -#define RX_ABORT_CAUSE_INSUFFICIENT_BEARER_RESOURCES 3 -#define RX_ABORT_CAUSE_PS_TO_CS_HANDOVER 4 -#define RX_ABORT_CAUSE_SPONSORED_DATA_CONNECTIVITY_ DISALLOWED 5 +#define RX_ABORT_CAUSE_BEARER_RELEASED 0 +#define RX_ABORT_CAUSE_INSUFFICIENT_SERVER_RESOURCES 1 +#define RX_ABORT_CAUSE_INSUFFICIENT_BEARER_RESOURCES 2 +#define RX_ABORT_CAUSE_PS_TO_CS_HANDOVER 3 +#define RX_ABORT_CAUSE_SPONSORED_DATA_CONNECTIVITY_ DISALLOWED 4 extern struct dict_object *rx_abort_cause; #define RX_TERMINATION_CAUSE_DIAMETER_LOGOUT 1 #define RX_TERMINATION_CAUSE_DIAMETER_SERVICE_NOT_PROVIDED 2 diff --git a/src/pcrf/pcrf_rx_path.c b/src/pcrf/pcrf_rx_path.c index 66429787f..01c9c8654 100644 --- a/src/pcrf/pcrf_rx_path.c +++ b/src/pcrf/pcrf_rx_path.c @@ -18,7 +18,12 @@ struct sess_state { os0_t gx_sid; /* Gx Session-Id */ os0_t peer_host; /* Peer Host */ + +#define SESSION_ABORTED 1 + int state; + int abort_cause; + int termination_cause; struct timespec ts; /* Time of sending the message */ }; @@ -475,6 +480,8 @@ status_t pcrf_rx_send_asr(c_uint8_t *rx_sid, c_uint32_t abort_cause) ret = fd_sess_state_retrieve(pcrf_rx_reg, session, &sess_data); d_assert(sess_data, return CORE_ERROR,); + /* Update State */ + sess_data->state = SESSION_ABORTED; sess_data->abort_cause = abort_cause; /* Set Origin-Host & Origin-Realm */ @@ -691,17 +698,16 @@ static int pcrf_rx_str_cb( struct msg **msg, struct avp *avp, d_assert(ret == 0, return EINVAL,); if (avp) { - c_uint32_t termination_cause = 0; - ret = fd_msg_avp_hdr(avp, &hdr); d_assert(ret == 0, return EINVAL,); - termination_cause = hdr->avp_value->i32; - switch(termination_cause) + sess_data->termination_cause = hdr->avp_value->i32; + switch(sess_data->termination_cause) { case RX_TERMINATION_CAUSE_DIAMETER_LOGOUT: break; default: - d_error("Termination-Cause Error : [%d]", termination_cause); + d_error("Termination-Cause Error : [%d]", + sess_data->termination_cause); break; } } @@ -710,7 +716,7 @@ static int pcrf_rx_str_cb( struct msg **msg, struct avp *avp, d_error("no_Termination-Cause"); } - if (!sess_data->abort_cause) + if (sess_data->state != SESSION_ABORTED) { /* Send Re-Auth Request if Abort-Session-Request is not initaited */ rv = pcrf_gx_send_rar(sess_data->gx_sid, sess_data->rx_sid, &rx_message);