From d77be669a9020c35bc66fedd1b916c1a9c649168 Mon Sep 17 00:00:00 2001 From: Sukchan Lee Date: Sun, 14 Jan 2018 22:02:37 +0900 Subject: [PATCH] update it --- src/pgw/pgw_gx_handler.c | 77 ++++++++++++++++++++++++++++++++++++++++ src/pgw/pgw_gx_handler.h | 2 ++ src/pgw/pgw_sm.c | 4 +-- 3 files changed, 80 insertions(+), 3 deletions(-) diff --git a/src/pgw/pgw_gx_handler.c b/src/pgw/pgw_gx_handler.c index 8f1a1285a..81945395e 100644 --- a/src/pgw/pgw_gx_handler.c +++ b/src/pgw/pgw_gx_handler.c @@ -8,6 +8,74 @@ #include "pgw_s5c_build.h" #include "pgw_ipfw.h" +static status_t bearer_binding(pgw_sess_t *sess, gx_message_t *gx_message) +{ + status_t rv; + int i, j; + + d_assert(sess, return CORE_ERROR,); + d_assert(gx_message, return CORE_ERROR,); + + for (i = 0; i < gx_message->num_of_pcc_rule; i++) + { + gtp_xact_t *xact = NULL; + gtp_header_t h; + pkbuf_t *pkbuf = NULL; + + pcc_rule_t *pcc_rule = &gx_message->pcc_rule[i]; + pgw_bearer_t *bearer = pgw_bearer_find_by_qci_arp(sess, + pcc_rule->qos.qci, + pcc_rule->qos.arp.priority_level, + pcc_rule->qos.arp.pre_emption_capability, + pcc_rule->qos.arp.pre_emption_vulnerability); + if (bearer) + { + d_error("CHECK WEBUI : PCC Rule Modification is NOT implemented"); + d_error("Please remove Flow in PCC Rule"); + return CORE_ERROR; + } + + bearer = pgw_bearer_add(sess); + d_assert(bearer, return CORE_ERROR, "Null param"); + + memcpy(&bearer->qos, &pcc_rule->qos, sizeof(qos_t)); + + for (j = 0; j < pcc_rule->num_of_flow; j++) + { + flow_t *flow = &pcc_rule->flow[j]; + pgw_rule_t rule; + pgw_pf_t *pf = NULL; + + d_assert(flow, return CORE_ERROR, "Null param"); + d_assert(flow->description, return CORE_ERROR, "Null param"); + + rv = pgw_compile_packet_filter(&rule, flow->description); + d_assert(rv == CORE_OK, return CORE_ERROR, "Failed to compile packet filter"); + + pf = pgw_pf_add(bearer, pcc_rule->precedence); + d_assert(pf, return CORE_ERROR, "Null param"); + + memcpy(&pf->rule, &rule, sizeof(pgw_rule_t)); + pf->direction = flow->direction; + } + + memset(&h, 0, sizeof(gtp_header_t)); + h.type = GTP_CREATE_BEARER_REQUEST_TYPE; + h.teid = sess->sgw_s5c_teid; + + rv = pgw_s5c_build_create_bearer_request(&pkbuf, h.type, bearer); + d_assert(rv == CORE_OK, return CORE_ERROR, "S11 build error"); + + xact = gtp_xact_local_create(sess->gnode, &h, pkbuf); + d_assert(xact, return CORE_ERROR, "Null param"); + + rv = gtp_xact_commit(xact); + d_assert(rv == CORE_OK, return CORE_ERROR, "xact_commit error"); + } + + return CORE_OK; +} + void pgw_gx_handle_cca_initial_request( pgw_sess_t *sess, gx_message_t *gx_message, gtp_xact_t *xact, gtp_create_session_request_t *req) @@ -136,3 +204,12 @@ void pgw_gx_handle_cca_termination_request( rv = gtp_xact_commit(xact); d_assert(rv == CORE_OK, return, "xact_commit error"); } + +void pgw_gx_handle_re_auth_request( + pgw_sess_t *sess, gx_message_t *gx_message) +{ + status_t rv; + + rv = bearer_binding(sess, gx_message); + d_assert(rv == CORE_OK, return,); +} diff --git a/src/pgw/pgw_gx_handler.h b/src/pgw/pgw_gx_handler.h index 5e1f158c7..2fea2e353 100644 --- a/src/pgw/pgw_gx_handler.h +++ b/src/pgw/pgw_gx_handler.h @@ -15,6 +15,8 @@ CORE_DECLARE(void) pgw_gx_handle_cca_initial_request( CORE_DECLARE(void) pgw_gx_handle_cca_termination_request( pgw_sess_t *sess, gx_message_t *gx_message, gtp_xact_t *xact, gtp_delete_session_request_t *req); +CORE_DECLARE(void) pgw_gx_handle_re_auth_request( + pgw_sess_t *sess, gx_message_t *gx_message); #ifdef __cplusplus } diff --git a/src/pgw/pgw_sm.c b/src/pgw/pgw_sm.c index 4919722a2..3424898f2 100644 --- a/src/pgw/pgw_sm.c +++ b/src/pgw/pgw_sm.c @@ -204,9 +204,7 @@ void pgw_state_operational(fsm_t *s, event_t *e) } case GX_CMD_RE_AUTH: { -#if 0 - pgw_gx_handle_re_auth_request( sess, gx_message); -#endif + pgw_gx_handle_re_auth_request(sess, gx_message); break; } default: