fix the bug for diameter session memory management
This commit is contained in:
parent
7e63ab488d
commit
5ca708deab
|
@ -25,6 +25,12 @@ pool_declare(mme_s6a_sess_pool, struct sess_state, MAX_NUM_SESSION_STATE);
|
|||
static void mme_s6a_aia_cb(void *data, struct msg **msg);
|
||||
static void mme_s6a_ula_cb(void *data, struct msg **msg);
|
||||
|
||||
void mme_s6a_sess_cleanup(
|
||||
struct sess_state *sess_data, os0_t sid, void * opaque)
|
||||
{
|
||||
pool_free_node(&mme_s6a_sess_pool, sess_data);
|
||||
}
|
||||
|
||||
/* MME Sends Authentication Information Request to HSS */
|
||||
void mme_s6a_send_air(mme_ue_t *mme_ue,
|
||||
nas_authentication_failure_parameter_t *authentication_failure_parameter)
|
||||
|
@ -143,7 +149,6 @@ void mme_s6a_send_air(mme_ue_t *mme_ue,
|
|||
mme_ue->imsi_bcd);
|
||||
|
||||
out:
|
||||
pool_free_node(&mme_s6a_sess_pool, mi);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -376,8 +381,7 @@ out:
|
|||
CHECK_FCT_DO( fd_msg_free(*msg), return );
|
||||
*msg = NULL;
|
||||
|
||||
pool_free_node(&mme_s6a_sess_pool, mi);
|
||||
|
||||
mme_s6a_sess_cleanup(mi, NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -481,7 +485,6 @@ void mme_s6a_send_ulr(mme_ue_t *mme_ue)
|
|||
mme_ue->imsi_bcd);
|
||||
|
||||
out:
|
||||
pool_free_node(&mme_s6a_sess_pool, mi);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -908,8 +911,7 @@ static void mme_s6a_ula_cb(void *data, struct msg **msg)
|
|||
CHECK_FCT_DO( fd_msg_free(*msg), return );
|
||||
*msg = NULL;
|
||||
|
||||
pool_free_node(&mme_s6a_sess_pool, mi);
|
||||
|
||||
mme_s6a_sess_cleanup(mi, NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -924,7 +926,8 @@ int mme_fd_init(void)
|
|||
/* Install objects definitions for this application */
|
||||
CHECK_FCT( s6a_dict_init() );
|
||||
|
||||
CHECK_FCT( fd_sess_handler_create(&mme_s6a_reg, (void *)free, NULL, NULL) );
|
||||
CHECK_FCT( fd_sess_handler_create(&mme_s6a_reg, &mme_s6a_sess_cleanup,
|
||||
NULL, NULL) );
|
||||
|
||||
/* Advertise the support for the application in the peer */
|
||||
CHECK_FCT( fd_disp_app_support(s6a_application, fd_vendor, 1, 0) );
|
||||
|
|
|
@ -28,6 +28,12 @@ pool_declare(pgw_gx_sess_pool, struct sess_state, MAX_NUM_SESSION_STATE);
|
|||
|
||||
static void pgw_gx_cca_cb(void *data, struct msg **msg);
|
||||
|
||||
void pgw_gx_sess_cleanup(
|
||||
struct sess_state *sess_data, os0_t sid, void * opaque)
|
||||
{
|
||||
pool_free_node(&pgw_gx_sess_pool, sess_data);
|
||||
}
|
||||
|
||||
void pgw_gx_send_ccr(gtp_xact_t *xact, pgw_sess_t *sess,
|
||||
pkbuf_t *gtpbuf, c_uint32_t cc_request_type)
|
||||
{
|
||||
|
@ -314,7 +320,6 @@ void pgw_gx_send_ccr(gtp_xact_t *xact, pgw_sess_t *sess,
|
|||
sess->pgw_s5c_teid);
|
||||
|
||||
out:
|
||||
pool_free_node(&pgw_gx_sess_pool, mi);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -755,8 +760,7 @@ out:
|
|||
CHECK_FCT_DO( fd_msg_free(*msg), return );
|
||||
*msg = NULL;
|
||||
|
||||
pool_free_node(&pgw_gx_sess_pool, mi);
|
||||
|
||||
pgw_gx_sess_cleanup(mi, NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -770,7 +774,8 @@ int pgw_fd_init(void)
|
|||
/* Install objects definitions for this application */
|
||||
CHECK_FCT( gx_dict_init() );
|
||||
|
||||
CHECK_FCT( fd_sess_handler_create(&pgw_gx_reg, (void *)free, NULL, NULL) );
|
||||
CHECK_FCT( fd_sess_handler_create(&pgw_gx_reg, pgw_gx_sess_cleanup,
|
||||
NULL, NULL) );
|
||||
|
||||
/* Advertise the support for the application in the peer */
|
||||
CHECK_FCT( fd_disp_app_support(gx_application, fd_vendor, 1, 0) );
|
||||
|
|
|
@ -13,18 +13,24 @@
|
|||
|
||||
#define MAX_NUM_SESSION_STATE 32
|
||||
|
||||
static struct session_handler *pgw_rx_reg = NULL;
|
||||
static struct session_handler *pcscf_rx_reg = NULL;
|
||||
static fd_config_t fd_config;
|
||||
|
||||
struct sess_state {
|
||||
struct timespec ts; /* Time of sending the message */
|
||||
};
|
||||
|
||||
pool_declare(pgw_rx_sess_pool, struct sess_state, MAX_NUM_SESSION_STATE);
|
||||
pool_declare(pcscf_rx_sess_pool, struct sess_state, MAX_NUM_SESSION_STATE);
|
||||
|
||||
static void pgw_rx_aaa_cb(void *data, struct msg **msg);
|
||||
static void pcscf_rx_aaa_cb(void *data, struct msg **msg);
|
||||
|
||||
void pgw_rx_send_aar()
|
||||
void pcscf_rx_sess_cleanup(
|
||||
struct sess_state *sess_data, os0_t sid, void * opaque)
|
||||
{
|
||||
pool_free_node(&pcscf_rx_sess_pool, sess_data);
|
||||
}
|
||||
|
||||
void pcscf_rx_send_aar()
|
||||
{
|
||||
struct msg *req = NULL;
|
||||
struct avp *avp;
|
||||
|
@ -40,7 +46,7 @@ void pgw_rx_send_aar()
|
|||
c_uint32_t addr = 0x0100007f;
|
||||
|
||||
/* Create the random value to store with the session */
|
||||
pool_alloc_node(&pgw_rx_sess_pool, &mi);
|
||||
pool_alloc_node(&pcscf_rx_sess_pool, &mi);
|
||||
d_assert(mi, return, "malloc failed: %s", strerror(errno));
|
||||
|
||||
/* Create the request */
|
||||
|
@ -110,10 +116,10 @@ void pgw_rx_send_aar()
|
|||
svg = mi;
|
||||
|
||||
/* Store this value in the session */
|
||||
CHECK_FCT_DO( fd_sess_state_store(pgw_rx_reg, session, &mi), goto out );
|
||||
CHECK_FCT_DO( fd_sess_state_store(pcscf_rx_reg, session, &mi), goto out );
|
||||
|
||||
/* Send the request */
|
||||
CHECK_FCT_DO( fd_msg_send(&req, pgw_rx_aaa_cb, svg), goto out );
|
||||
CHECK_FCT_DO( fd_msg_send(&req, pcscf_rx_aaa_cb, svg), goto out );
|
||||
|
||||
/* Increment the counter */
|
||||
CHECK_POSIX_DO( pthread_mutex_lock(&fd_logger_self()->stats_lock), );
|
||||
|
@ -121,11 +127,10 @@ void pgw_rx_send_aar()
|
|||
CHECK_POSIX_DO( pthread_mutex_unlock(&fd_logger_self()->stats_lock), );
|
||||
|
||||
out:
|
||||
pool_free_node(&pgw_rx_sess_pool, mi);
|
||||
return;
|
||||
}
|
||||
|
||||
static void pgw_rx_aaa_cb(void *data, struct msg **msg)
|
||||
static void pcscf_rx_aaa_cb(void *data, struct msg **msg)
|
||||
{
|
||||
struct sess_state *mi = NULL;
|
||||
struct timespec ts;
|
||||
|
@ -148,7 +153,7 @@ static void pgw_rx_aaa_cb(void *data, struct msg **msg)
|
|||
return );
|
||||
d_assert(new == 0, return, );
|
||||
|
||||
CHECK_FCT_DO( fd_sess_state_retrieve(pgw_rx_reg, session, &mi), return );
|
||||
CHECK_FCT_DO( fd_sess_state_retrieve(pcscf_rx_reg, session, &mi), return );
|
||||
d_assert(mi && (void *)mi == data, return, );
|
||||
|
||||
/* Value of Result Code */
|
||||
|
@ -260,8 +265,7 @@ out:
|
|||
CHECK_FCT_DO( fd_msg_free(*msg), return );
|
||||
*msg = NULL;
|
||||
|
||||
pool_free_node(&pgw_rx_sess_pool, mi);
|
||||
|
||||
pcscf_rx_sess_cleanup(mi, NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -299,7 +303,7 @@ void pcscf_fd_config()
|
|||
|
||||
int pcscf_fd_init(void)
|
||||
{
|
||||
pool_init(&pgw_rx_sess_pool, MAX_NUM_SESSION_STATE);
|
||||
pool_init(&pcscf_rx_sess_pool, MAX_NUM_SESSION_STATE);
|
||||
|
||||
pcscf_fd_config();
|
||||
|
||||
|
@ -307,7 +311,8 @@ int pcscf_fd_init(void)
|
|||
|
||||
CHECK_FCT( rx_dict_init() );
|
||||
|
||||
CHECK_FCT( fd_sess_handler_create(&pgw_rx_reg, (void *)free, NULL, NULL) );
|
||||
CHECK_FCT( fd_sess_handler_create(&pcscf_rx_reg, pcscf_rx_sess_cleanup,
|
||||
NULL, NULL) );
|
||||
|
||||
/* Advertise the support for the application in the peer */
|
||||
CHECK_FCT( fd_disp_app_support(rx_application, fd_vendor, 1, 0) );
|
||||
|
@ -317,15 +322,15 @@ int pcscf_fd_init(void)
|
|||
|
||||
void pcscf_fd_final(void)
|
||||
{
|
||||
CHECK_FCT_DO( fd_sess_handler_destroy(&pgw_rx_reg, NULL), );
|
||||
CHECK_FCT_DO( fd_sess_handler_destroy(&pcscf_rx_reg, NULL), );
|
||||
|
||||
fd_final();
|
||||
|
||||
if (pool_used(&pgw_rx_sess_pool))
|
||||
d_error("%d not freed in pgw_rx_sess_pool[%d] of S6A-SM",
|
||||
pool_used(&pgw_rx_sess_pool), pool_size(&pgw_rx_sess_pool));
|
||||
d_trace(3, "%d not freed in pgw_rx_sess_pool[%d] of S6A-SM\n",
|
||||
pool_used(&pgw_rx_sess_pool), pool_size(&pgw_rx_sess_pool));
|
||||
if (pool_used(&pcscf_rx_sess_pool))
|
||||
d_error("%d not freed in pcscf_rx_sess_pool[%d] of S6A-SM",
|
||||
pool_used(&pcscf_rx_sess_pool), pool_size(&pcscf_rx_sess_pool));
|
||||
d_trace(3, "%d not freed in pcscf_rx_sess_pool[%d] of S6A-SM\n",
|
||||
pool_used(&pcscf_rx_sess_pool), pool_size(&pcscf_rx_sess_pool));
|
||||
|
||||
pool_final(&pgw_rx_sess_pool);
|
||||
pool_final(&pcscf_rx_sess_pool);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ extern "C" {
|
|||
CORE_DECLARE(int) pcscf_fd_init(void);
|
||||
CORE_DECLARE(void) pcscf_fd_final(void);
|
||||
|
||||
CORE_DECLARE(void) pgw_rx_send_aar();
|
||||
CORE_DECLARE(void) pcscf_rx_send_aar();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -271,7 +271,7 @@ static void volte_test1(abts_case *tc, void *data)
|
|||
core_sleep(time_from_msec(300));
|
||||
|
||||
/* Send AA-Request */
|
||||
pgw_rx_send_aar();
|
||||
pcscf_rx_send_aar();
|
||||
|
||||
/* Send PDN disconnectivity request */
|
||||
rv = tests1ap_build_pdn_disconnectivity_request(&sendbuf, msgindex);
|
||||
|
|
Loading…
Reference in New Issue