Update Bearer Request is added in PGW
This commit is contained in:
parent
f1e41050c3
commit
c12e76e32d
|
@ -698,6 +698,7 @@ status_t pcrf_gx_send_rar(
|
|||
goto out;
|
||||
}
|
||||
|
||||
/* Check WEBUI static dedicated bearer */
|
||||
if (pcc_rule->num_of_flow)
|
||||
{
|
||||
d_warn("STATIC dedicated bearer has already been activated");
|
||||
|
@ -718,6 +719,40 @@ status_t pcrf_gx_send_rar(
|
|||
pcc_rule->num_of_flow = 0;
|
||||
}
|
||||
|
||||
/* Update QoS parameter */
|
||||
if (media_component->mbr.uplink)
|
||||
{
|
||||
if (pcc_rule->qos.mbr.uplink)
|
||||
pcc_rule->qos.mbr.uplink =
|
||||
c_min(pcc_rule->qos.mbr.uplink, media_component->mbr.uplink);
|
||||
else
|
||||
pcc_rule->qos.mbr.uplink = media_component->mbr.uplink;
|
||||
}
|
||||
if (media_component->mbr.downlink)
|
||||
{
|
||||
if (pcc_rule->qos.mbr.downlink)
|
||||
pcc_rule->qos.mbr.downlink =
|
||||
c_min(pcc_rule->qos.mbr.downlink, media_component->mbr.downlink);
|
||||
else
|
||||
pcc_rule->qos.mbr.downlink = media_component->mbr.downlink;
|
||||
}
|
||||
if (media_component->gbr.uplink)
|
||||
{
|
||||
if (pcc_rule->qos.gbr.uplink)
|
||||
pcc_rule->qos.gbr.uplink =
|
||||
c_min(pcc_rule->qos.gbr.uplink, media_component->gbr.uplink);
|
||||
else
|
||||
pcc_rule->qos.gbr.uplink = media_component->gbr.uplink;
|
||||
}
|
||||
if (media_component->gbr.downlink)
|
||||
{
|
||||
if (pcc_rule->qos.gbr.downlink)
|
||||
pcc_rule->qos.gbr.downlink =
|
||||
c_min(pcc_rule->qos.gbr.downlink, media_component->gbr.downlink);
|
||||
else
|
||||
pcc_rule->qos.gbr.downlink = media_component->gbr.downlink;
|
||||
}
|
||||
|
||||
for (j = 0; j < media_component->num_of_sub; j++)
|
||||
{
|
||||
rx_media_sub_component_t *sub = &media_component->sub[j];
|
||||
|
|
|
@ -75,7 +75,6 @@ static int pcrf_rx_aar_cb( struct msg **msg, struct avp *avp,
|
|||
rx_message_t rx_message;
|
||||
|
||||
char buf[CORE_ADDRSTRLEN];
|
||||
os0_t rx_sid = NULL;
|
||||
os0_t gx_sid = NULL;
|
||||
c_uint32_t result_code = RX_DIAMETER_IP_CAN_SESSION_NOT_AVAILABLE;
|
||||
|
||||
|
@ -86,10 +85,11 @@ static int pcrf_rx_aar_cb( struct msg **msg, struct avp *avp,
|
|||
d_assert(ret == 0, return EINVAL,);
|
||||
if (!sess_data)
|
||||
{
|
||||
ret = fd_sess_getsid(sess, &rx_sid, &sidlen);
|
||||
os0_t sid = NULL;
|
||||
ret = fd_sess_getsid(sess, &sid, &sidlen);
|
||||
d_assert(ret == 0, return EINVAL,);
|
||||
|
||||
sess_data = new_state(rx_sid);
|
||||
sess_data = new_state(sid);
|
||||
d_assert(sess_data, return EINVAL,);
|
||||
}
|
||||
|
||||
|
@ -308,7 +308,7 @@ static int pcrf_rx_aar_cb( struct msg **msg, struct avp *avp,
|
|||
}
|
||||
|
||||
/* Send Re-Auth Request */
|
||||
rv = pcrf_gx_send_rar(gx_sid, rx_sid, &rx_message);
|
||||
rv = pcrf_gx_send_rar(gx_sid, sess_data->rx_sid, &rx_message);
|
||||
if (rv != CORE_OK)
|
||||
{
|
||||
result_code = rx_message.result_code;
|
||||
|
|
|
@ -103,6 +103,8 @@ static status_t bearer_binding(pgw_sess_t *sess, gx_message_t *gx_message)
|
|||
|
||||
pcc_rule_t *pcc_rule = &gx_message->pcc_rule[i];
|
||||
int bearer_created = 0;
|
||||
int qos_presence = 0;
|
||||
int tft_presence = 0;
|
||||
|
||||
d_assert(pcc_rule, return CORE_ERROR,);
|
||||
if (pcc_rule->name == NULL)
|
||||
|
@ -147,6 +149,21 @@ static status_t bearer_binding(pgw_sess_t *sess, gx_message_t *gx_message)
|
|||
{
|
||||
/* Remove all previous flow */
|
||||
pgw_pf_remove_all(bearer);
|
||||
|
||||
/* Update Bearer Request will encode updated TFT */
|
||||
tft_presence = 1;
|
||||
}
|
||||
|
||||
if (bearer->qos.mbr.downlink != pcc_rule->qos.mbr.downlink ||
|
||||
bearer->qos.mbr.uplink != pcc_rule->qos.mbr.uplink ||
|
||||
bearer->qos.gbr.downlink != pcc_rule->qos.gbr.downlink ||
|
||||
bearer->qos.gbr.uplink != pcc_rule->qos.gbr.uplink)
|
||||
{
|
||||
/* Update QoS parameter */
|
||||
memcpy(&bearer->qos, &pcc_rule->qos, sizeof(qos_t));
|
||||
|
||||
/* Update Bearer Request will encode updated QoS parameter */
|
||||
qos_presence = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -185,7 +202,8 @@ static status_t bearer_binding(pgw_sess_t *sess, gx_message_t *gx_message)
|
|||
h.type = GTP_UPDATE_BEARER_REQUEST_TYPE;
|
||||
h.teid = sess->sgw_s5c_teid;
|
||||
|
||||
rv = pgw_s5c_build_update_bearer_request(&pkbuf, h.type, bearer);
|
||||
rv = pgw_s5c_build_update_bearer_request(
|
||||
&pkbuf, h.type, bearer, qos_presence, tft_presence);
|
||||
d_assert(rv == CORE_OK, return CORE_ERROR, "S11 build error");
|
||||
}
|
||||
|
||||
|
|
|
@ -166,6 +166,121 @@ status_t pgw_s5c_build_delete_session_response(
|
|||
return CORE_OK;
|
||||
}
|
||||
|
||||
static void encode_traffic_flow_template(gtp_tft_t *tft, pgw_bearer_t *bearer)
|
||||
{
|
||||
int i, j, len;
|
||||
pgw_pf_t *pf = NULL;
|
||||
|
||||
d_assert(tft, return,);
|
||||
d_assert(bearer, return,);
|
||||
|
||||
memset(tft, 0, sizeof(*tft));
|
||||
tft->code = GTP_TFT_CODE_CREATE_NEW_TFT;
|
||||
|
||||
i = 0;
|
||||
pf = pgw_pf_first(bearer);
|
||||
while(pf)
|
||||
{
|
||||
tft->pf[i].direction = pf->direction;
|
||||
tft->pf[i].identifier = pf->identifier - 1;
|
||||
tft->pf[i].precedence = i+1;
|
||||
|
||||
j = 0, len = 0;
|
||||
if (pf->rule.proto)
|
||||
{
|
||||
tft->pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE;
|
||||
tft->pf[i].component[j].proto = pf->rule.proto;
|
||||
j++; len += 2;
|
||||
}
|
||||
|
||||
if (pf->rule.ipv4_local)
|
||||
{
|
||||
tft->pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE;
|
||||
tft->pf[i].component[j].ipv4.addr = pf->rule.ip.local.addr[0];
|
||||
tft->pf[i].component[j].ipv4.mask = pf->rule.ip.local.mask[0];
|
||||
j++; len += 9;
|
||||
}
|
||||
|
||||
if (pf->rule.ipv4_remote)
|
||||
{
|
||||
tft->pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE;
|
||||
tft->pf[i].component[j].ipv4.addr = pf->rule.ip.remote.addr[0];
|
||||
tft->pf[i].component[j].ipv4.mask = pf->rule.ip.remote.mask[0];
|
||||
j++; len += 9;
|
||||
}
|
||||
|
||||
if (pf->rule.ipv6_local)
|
||||
{
|
||||
tft->pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE;
|
||||
memcpy(tft->pf[i].component[j].ipv6.addr, pf->rule.ip.local.addr,
|
||||
sizeof pf->rule.ip.local.addr);
|
||||
tft->pf[i].component[j].ipv6.prefixlen =
|
||||
contigmask((c_uint8_t *)pf->rule.ip.local.mask, 128);
|
||||
j++; len += 18;
|
||||
}
|
||||
|
||||
if (pf->rule.ipv6_remote)
|
||||
{
|
||||
tft->pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE;
|
||||
memcpy(tft->pf[i].component[j].ipv6.addr, pf->rule.ip.remote.addr,
|
||||
sizeof pf->rule.ip.remote.addr);
|
||||
tft->pf[i].component[j].ipv6.prefixlen =
|
||||
contigmask((c_uint8_t *)pf->rule.ip.remote.mask, 128);
|
||||
j++; len += 18;
|
||||
}
|
||||
|
||||
if (pf->rule.port.local.low)
|
||||
{
|
||||
if (pf->rule.port.local.low == pf->rule.port.local.high)
|
||||
{
|
||||
tft->pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE;
|
||||
tft->pf[i].component[j].port.low = pf->rule.port.local.low;
|
||||
j++; len += 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
tft->pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE;
|
||||
tft->pf[i].component[j].port.low = pf->rule.port.local.low;
|
||||
tft->pf[i].component[j].port.high = pf->rule.port.local.high;
|
||||
j++; len += 5;
|
||||
}
|
||||
}
|
||||
|
||||
if (pf->rule.port.remote.low)
|
||||
{
|
||||
if (pf->rule.port.remote.low == pf->rule.port.remote.high)
|
||||
{
|
||||
tft->pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE;
|
||||
tft->pf[i].component[j].port.low = pf->rule.port.remote.low;
|
||||
j++; len += 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
tft->pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE;
|
||||
tft->pf[i].component[j].port.low = pf->rule.port.remote.low;
|
||||
tft->pf[i].component[j].port.high = pf->rule.port.remote.high;
|
||||
j++; len += 5;
|
||||
}
|
||||
}
|
||||
|
||||
tft->pf[i].num_of_component = j;
|
||||
tft->pf[i].length = len;
|
||||
i++;
|
||||
|
||||
pf = pgw_pf_next(pf);
|
||||
}
|
||||
tft->num_of_packet_filter = i;
|
||||
}
|
||||
|
||||
status_t pgw_s5c_build_create_bearer_request(
|
||||
pkbuf_t **pkbuf, c_uint8_t type, pgw_bearer_t *bearer)
|
||||
{
|
||||
|
@ -180,9 +295,8 @@ status_t pgw_s5c_build_create_bearer_request(
|
|||
gtp_bearer_qos_t bearer_qos;
|
||||
char bearer_qos_buf[GTP_BEARER_QOS_LEN];
|
||||
gtp_tft_t tft;
|
||||
int i, j, len;
|
||||
int len;
|
||||
char tft_buf[GTP_MAX_TRAFFIC_FLOW_TEMPLATE];
|
||||
pgw_pf_t *pf = NULL;
|
||||
|
||||
d_assert(bearer, return CORE_ERROR, "Null param");
|
||||
sess = bearer->sess;
|
||||
|
@ -231,112 +345,7 @@ status_t pgw_s5c_build_create_bearer_request(
|
|||
&bearer_qos, bearer_qos_buf, GTP_BEARER_QOS_LEN);
|
||||
|
||||
/* Bearer TFT */
|
||||
memset(&tft, 0, sizeof(tft));
|
||||
tft.code = GTP_TFT_CODE_CREATE_NEW_TFT;
|
||||
|
||||
i = 0;
|
||||
pf = pgw_pf_first(bearer);
|
||||
while(pf)
|
||||
{
|
||||
tft.pf[i].direction = pf->direction;
|
||||
tft.pf[i].identifier = pf->identifier - 1;
|
||||
tft.pf[i].precedence = i+1;
|
||||
|
||||
j = 0, len = 0;
|
||||
if (pf->rule.proto)
|
||||
{
|
||||
tft.pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE;
|
||||
tft.pf[i].component[j].proto = pf->rule.proto;
|
||||
j++; len += 2;
|
||||
}
|
||||
|
||||
if (pf->rule.ipv4_local)
|
||||
{
|
||||
tft.pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE;
|
||||
tft.pf[i].component[j].ipv4.addr = pf->rule.ip.local.addr[0];
|
||||
tft.pf[i].component[j].ipv4.mask = pf->rule.ip.local.mask[0];
|
||||
j++; len += 9;
|
||||
}
|
||||
|
||||
if (pf->rule.ipv4_remote)
|
||||
{
|
||||
tft.pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE;
|
||||
tft.pf[i].component[j].ipv4.addr = pf->rule.ip.remote.addr[0];
|
||||
tft.pf[i].component[j].ipv4.mask = pf->rule.ip.remote.mask[0];
|
||||
j++; len += 9;
|
||||
}
|
||||
|
||||
if (pf->rule.ipv6_local)
|
||||
{
|
||||
tft.pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE;
|
||||
memcpy(tft.pf[i].component[j].ipv6.addr, pf->rule.ip.local.addr,
|
||||
sizeof pf->rule.ip.local.addr);
|
||||
tft.pf[i].component[j].ipv6.prefixlen =
|
||||
contigmask((c_uint8_t *)pf->rule.ip.local.mask, 128);
|
||||
j++; len += 18;
|
||||
}
|
||||
|
||||
if (pf->rule.ipv6_remote)
|
||||
{
|
||||
tft.pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE;
|
||||
memcpy(tft.pf[i].component[j].ipv6.addr, pf->rule.ip.remote.addr,
|
||||
sizeof pf->rule.ip.remote.addr);
|
||||
tft.pf[i].component[j].ipv6.prefixlen =
|
||||
contigmask((c_uint8_t *)pf->rule.ip.remote.mask, 128);
|
||||
j++; len += 18;
|
||||
}
|
||||
|
||||
if (pf->rule.port.local.low)
|
||||
{
|
||||
if (pf->rule.port.local.low == pf->rule.port.local.high)
|
||||
{
|
||||
tft.pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE;
|
||||
tft.pf[i].component[j].port.low = pf->rule.port.local.low;
|
||||
j++; len += 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
tft.pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE;
|
||||
tft.pf[i].component[j].port.low = pf->rule.port.local.low;
|
||||
tft.pf[i].component[j].port.high = pf->rule.port.local.high;
|
||||
j++; len += 5;
|
||||
}
|
||||
}
|
||||
|
||||
if (pf->rule.port.remote.low)
|
||||
{
|
||||
if (pf->rule.port.remote.low == pf->rule.port.remote.high)
|
||||
{
|
||||
tft.pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE;
|
||||
tft.pf[i].component[j].port.low = pf->rule.port.remote.low;
|
||||
j++; len += 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
tft.pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE;
|
||||
tft.pf[i].component[j].port.low = pf->rule.port.remote.low;
|
||||
tft.pf[i].component[j].port.high = pf->rule.port.remote.high;
|
||||
j++; len += 5;
|
||||
}
|
||||
}
|
||||
|
||||
tft.pf[i].num_of_component = j;
|
||||
tft.pf[i].length = len;
|
||||
i++;
|
||||
|
||||
pf = pgw_pf_next(pf);
|
||||
}
|
||||
tft.num_of_packet_filter = i;
|
||||
|
||||
encode_traffic_flow_template(&tft, bearer);
|
||||
req->bearer_contexts.tft.presence = 1;
|
||||
gtp_build_tft(&req->bearer_contexts.tft,
|
||||
&tft, tft_buf, GTP_MAX_TRAFFIC_FLOW_TEMPLATE);
|
||||
|
@ -349,7 +358,8 @@ status_t pgw_s5c_build_create_bearer_request(
|
|||
}
|
||||
|
||||
status_t pgw_s5c_build_update_bearer_request(
|
||||
pkbuf_t **pkbuf, c_uint8_t type, pgw_bearer_t *bearer)
|
||||
pkbuf_t **pkbuf, c_uint8_t type, pgw_bearer_t *bearer,
|
||||
int qos_presence, int tft_presence)
|
||||
{
|
||||
status_t rv;
|
||||
pgw_sess_t *sess = NULL;
|
||||
|
@ -361,9 +371,7 @@ status_t pgw_s5c_build_update_bearer_request(
|
|||
gtp_bearer_qos_t bearer_qos;
|
||||
char bearer_qos_buf[GTP_BEARER_QOS_LEN];
|
||||
gtp_tft_t tft;
|
||||
int i, j, len;
|
||||
char tft_buf[GTP_MAX_TRAFFIC_FLOW_TEMPLATE];
|
||||
pgw_pf_t *pf = NULL;
|
||||
|
||||
d_assert(bearer, return CORE_ERROR, "Null param");
|
||||
sess = bearer->sess;
|
||||
|
@ -380,132 +388,33 @@ status_t pgw_s5c_build_update_bearer_request(
|
|||
req->bearer_contexts.eps_bearer_id.u8 = bearer->ebi;
|
||||
|
||||
/* Bearer QoS */
|
||||
memset(&bearer_qos, 0, sizeof(bearer_qos));
|
||||
bearer_qos.qci = bearer->qos.qci;
|
||||
bearer_qos.priority_level = bearer->qos.arp.priority_level;
|
||||
bearer_qos.pre_emption_capability =
|
||||
bearer->qos.arp.pre_emption_capability;
|
||||
bearer_qos.pre_emption_vulnerability =
|
||||
bearer->qos.arp.pre_emption_vulnerability;
|
||||
bearer_qos.dl_mbr = bearer->qos.mbr.downlink;
|
||||
bearer_qos.ul_mbr = bearer->qos.mbr.uplink;
|
||||
bearer_qos.dl_gbr = bearer->qos.gbr.downlink;
|
||||
bearer_qos.ul_gbr = bearer->qos.gbr.uplink;
|
||||
if (qos_presence == 1)
|
||||
{
|
||||
memset(&bearer_qos, 0, sizeof(bearer_qos));
|
||||
bearer_qos.qci = bearer->qos.qci;
|
||||
bearer_qos.priority_level = bearer->qos.arp.priority_level;
|
||||
bearer_qos.pre_emption_capability =
|
||||
bearer->qos.arp.pre_emption_capability;
|
||||
bearer_qos.pre_emption_vulnerability =
|
||||
bearer->qos.arp.pre_emption_vulnerability;
|
||||
bearer_qos.dl_mbr = bearer->qos.mbr.downlink;
|
||||
bearer_qos.ul_mbr = bearer->qos.mbr.uplink;
|
||||
bearer_qos.dl_gbr = bearer->qos.gbr.downlink;
|
||||
bearer_qos.ul_gbr = bearer->qos.gbr.uplink;
|
||||
|
||||
req->bearer_contexts.bearer_level_qos.presence = 1;
|
||||
gtp_build_bearer_qos(&req->bearer_contexts.bearer_level_qos,
|
||||
&bearer_qos, bearer_qos_buf, GTP_BEARER_QOS_LEN);
|
||||
req->bearer_contexts.bearer_level_qos.presence = 1;
|
||||
gtp_build_bearer_qos(&req->bearer_contexts.bearer_level_qos,
|
||||
&bearer_qos, bearer_qos_buf, GTP_BEARER_QOS_LEN);
|
||||
}
|
||||
|
||||
/* Bearer TFT */
|
||||
memset(&tft, 0, sizeof(tft));
|
||||
tft.code = GTP_TFT_CODE_CREATE_NEW_TFT;
|
||||
|
||||
i = 0;
|
||||
pf = pgw_pf_first(bearer);
|
||||
while(pf)
|
||||
if (tft_presence == 1)
|
||||
{
|
||||
tft.pf[i].direction = pf->direction;
|
||||
tft.pf[i].identifier = pf->identifier - 1;
|
||||
tft.pf[i].precedence = i+1;
|
||||
|
||||
j = 0, len = 0;
|
||||
if (pf->rule.proto)
|
||||
{
|
||||
tft.pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE;
|
||||
tft.pf[i].component[j].proto = pf->rule.proto;
|
||||
j++; len += 2;
|
||||
}
|
||||
|
||||
if (pf->rule.ipv4_local)
|
||||
{
|
||||
tft.pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE;
|
||||
tft.pf[i].component[j].ipv4.addr = pf->rule.ip.local.addr[0];
|
||||
tft.pf[i].component[j].ipv4.mask = pf->rule.ip.local.mask[0];
|
||||
j++; len += 9;
|
||||
}
|
||||
|
||||
if (pf->rule.ipv4_remote)
|
||||
{
|
||||
tft.pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE;
|
||||
tft.pf[i].component[j].ipv4.addr = pf->rule.ip.remote.addr[0];
|
||||
tft.pf[i].component[j].ipv4.mask = pf->rule.ip.remote.mask[0];
|
||||
j++; len += 9;
|
||||
}
|
||||
|
||||
if (pf->rule.ipv6_local)
|
||||
{
|
||||
tft.pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE;
|
||||
memcpy(tft.pf[i].component[j].ipv6.addr, pf->rule.ip.local.addr,
|
||||
sizeof pf->rule.ip.local.addr);
|
||||
tft.pf[i].component[j].ipv6.prefixlen =
|
||||
contigmask((c_uint8_t *)pf->rule.ip.local.mask, 128);
|
||||
j++; len += 18;
|
||||
}
|
||||
|
||||
if (pf->rule.ipv6_remote)
|
||||
{
|
||||
tft.pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE;
|
||||
memcpy(tft.pf[i].component[j].ipv6.addr, pf->rule.ip.remote.addr,
|
||||
sizeof pf->rule.ip.remote.addr);
|
||||
tft.pf[i].component[j].ipv6.prefixlen =
|
||||
contigmask((c_uint8_t *)pf->rule.ip.remote.mask, 128);
|
||||
j++; len += 18;
|
||||
}
|
||||
|
||||
if (pf->rule.port.local.low)
|
||||
{
|
||||
if (pf->rule.port.local.low == pf->rule.port.local.high)
|
||||
{
|
||||
tft.pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE;
|
||||
tft.pf[i].component[j].port.low = pf->rule.port.local.low;
|
||||
j++; len += 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
tft.pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE;
|
||||
tft.pf[i].component[j].port.low = pf->rule.port.local.low;
|
||||
tft.pf[i].component[j].port.high = pf->rule.port.local.high;
|
||||
j++; len += 5;
|
||||
}
|
||||
}
|
||||
|
||||
if (pf->rule.port.remote.low)
|
||||
{
|
||||
if (pf->rule.port.remote.low == pf->rule.port.remote.high)
|
||||
{
|
||||
tft.pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE;
|
||||
tft.pf[i].component[j].port.low = pf->rule.port.remote.low;
|
||||
j++; len += 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
tft.pf[i].component[j].type =
|
||||
GTP_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE;
|
||||
tft.pf[i].component[j].port.low = pf->rule.port.remote.low;
|
||||
tft.pf[i].component[j].port.high = pf->rule.port.remote.high;
|
||||
j++; len += 5;
|
||||
}
|
||||
}
|
||||
|
||||
tft.pf[i].num_of_component = j;
|
||||
tft.pf[i].length = len;
|
||||
i++;
|
||||
|
||||
pf = pgw_pf_next(pf);
|
||||
encode_traffic_flow_template(&tft, bearer);
|
||||
req->bearer_contexts.tft.presence = 1;
|
||||
gtp_build_tft(&req->bearer_contexts.tft,
|
||||
&tft, tft_buf, GTP_MAX_TRAFFIC_FLOW_TEMPLATE);
|
||||
}
|
||||
tft.num_of_packet_filter = i;
|
||||
|
||||
req->bearer_contexts.tft.presence = 1;
|
||||
gtp_build_tft(&req->bearer_contexts.tft,
|
||||
&tft, tft_buf, GTP_MAX_TRAFFIC_FLOW_TEMPLATE);
|
||||
|
||||
gtp_message.h.type = type;
|
||||
rv = gtp_build_msg(pkbuf, >p_message);
|
||||
|
|
|
@ -17,7 +17,8 @@ CORE_DECLARE(status_t) pgw_s5c_build_delete_session_response(
|
|||
CORE_DECLARE(status_t) pgw_s5c_build_create_bearer_request(
|
||||
pkbuf_t **pkbuf, c_uint8_t type, pgw_bearer_t *bearer);
|
||||
CORE_DECLARE(status_t) pgw_s5c_build_update_bearer_request(
|
||||
pkbuf_t **pkbuf, c_uint8_t type, pgw_bearer_t *bearer);
|
||||
pkbuf_t **pkbuf, c_uint8_t type, pgw_bearer_t *bearer,
|
||||
int qos_presence, int tft_presence);
|
||||
CORE_DECLARE(status_t) pgw_s5c_build_delete_bearer_request(
|
||||
pkbuf_t **pkbuf, c_uint8_t type, pgw_bearer_t *bearer);
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -52,7 +52,8 @@ static void state_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(c_int8_t **rx_sid, const char *ip)
|
||||
void pcscf_rx_send_aar(c_int8_t **rx_sid, const char *ip,
|
||||
int qos_presence, int flow_presence)
|
||||
{
|
||||
status_t rv;
|
||||
int ret;
|
||||
|
@ -227,101 +228,107 @@ void pcscf_rx_send_aar(c_int8_t **rx_sid, const char *ip)
|
|||
ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1);
|
||||
d_assert(ret == 0, return,);
|
||||
|
||||
ret = fd_msg_avp_new(rx_max_requested_bandwidth_dl, 0, &avpch1);
|
||||
d_assert(ret == 0, return,);
|
||||
val.i32 = 96000;
|
||||
ret = fd_msg_avp_setvalue (avpch1, &val);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1);
|
||||
d_assert(ret == 0, return,);
|
||||
if (qos_presence)
|
||||
{
|
||||
ret = fd_msg_avp_new(rx_max_requested_bandwidth_dl, 0, &avpch1);
|
||||
d_assert(ret == 0, return,);
|
||||
val.i32 = 96000;
|
||||
ret = fd_msg_avp_setvalue (avpch1, &val);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1);
|
||||
d_assert(ret == 0, return,);
|
||||
|
||||
ret = fd_msg_avp_new(rx_max_requested_bandwidth_ul, 0, &avpch1);
|
||||
d_assert(ret == 0, return,);
|
||||
val.i32 = 96000;
|
||||
ret = fd_msg_avp_setvalue (avpch1, &val);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_new(rx_max_requested_bandwidth_ul, 0, &avpch1);
|
||||
d_assert(ret == 0, return,);
|
||||
val.i32 = 32000;
|
||||
ret = fd_msg_avp_setvalue (avpch1, &val);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1);
|
||||
d_assert(ret == 0, return,);
|
||||
}
|
||||
|
||||
/* Set Media-Sub-Component #1 */
|
||||
ret = fd_msg_avp_new(rx_media_sub_component, 0, &avpch1);
|
||||
if (flow_presence)
|
||||
{
|
||||
/* Set Media-Sub-Component #1 */
|
||||
ret = fd_msg_avp_new(rx_media_sub_component, 0, &avpch1);
|
||||
|
||||
ret = fd_msg_avp_new(rx_flow_number, 0, &avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
val.i32 = 1;
|
||||
ret = fd_msg_avp_setvalue (avpch2, &val);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_new(rx_flow_number, 0, &avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
val.i32 = 1;
|
||||
ret = fd_msg_avp_setvalue (avpch2, &val);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
|
||||
ret = fd_msg_avp_new(rx_flow_description, 0, &avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
#define TEST_RX_FLOW_DESC1 \
|
||||
"permit out 17 from 172.20.166.84 to 172.18.128.20 20001"
|
||||
val.os.data = (c_uint8_t *)TEST_RX_FLOW_DESC1;
|
||||
val.os.len = strlen(TEST_RX_FLOW_DESC1);
|
||||
ret = fd_msg_avp_setvalue (avpch2, &val);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_new(rx_flow_description, 0, &avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
#define TEST_RX_FLOW_DESC1 \
|
||||
"permit out 17 from 172.20.166.84 to 172.18.128.20 20001"
|
||||
val.os.data = (c_uint8_t *)TEST_RX_FLOW_DESC1;
|
||||
val.os.len = strlen(TEST_RX_FLOW_DESC1);
|
||||
ret = fd_msg_avp_setvalue (avpch2, &val);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
|
||||
ret = fd_msg_avp_new(rx_flow_description, 0, &avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
#define TEST_RX_FLOW_DESC2 \
|
||||
"permit in 17 from 172.18.128.20 to 172.20.166.84 20360"
|
||||
val.os.data = (c_uint8_t *)TEST_RX_FLOW_DESC2;
|
||||
val.os.len = strlen(TEST_RX_FLOW_DESC2);
|
||||
ret = fd_msg_avp_setvalue (avpch2, &val);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_new(rx_flow_description, 0, &avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
#define TEST_RX_FLOW_DESC2 \
|
||||
"permit in 17 from 172.18.128.20 to 172.20.166.84 20360"
|
||||
val.os.data = (c_uint8_t *)TEST_RX_FLOW_DESC2;
|
||||
val.os.len = strlen(TEST_RX_FLOW_DESC2);
|
||||
ret = fd_msg_avp_setvalue (avpch2, &val);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
|
||||
ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1);
|
||||
d_assert(ret == 0, return,);
|
||||
|
||||
/* Set Media-Sub-Component #2 */
|
||||
ret = fd_msg_avp_new(rx_media_sub_component, 0, &avpch1);
|
||||
/* Set Media-Sub-Component #2 */
|
||||
ret = fd_msg_avp_new(rx_media_sub_component, 0, &avpch1);
|
||||
|
||||
ret = fd_msg_avp_new(rx_flow_number, 0, &avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
val.i32 = 2;
|
||||
ret = fd_msg_avp_setvalue (avpch2, &val);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_new(rx_flow_number, 0, &avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
val.i32 = 2;
|
||||
ret = fd_msg_avp_setvalue (avpch2, &val);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
|
||||
ret = fd_msg_avp_new(rx_flow_usage, 0, &avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
val.i32 = RX_FLOW_USAGE_RTCP;
|
||||
ret = fd_msg_avp_setvalue (avpch2, &val);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_new(rx_flow_usage, 0, &avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
val.i32 = RX_FLOW_USAGE_RTCP;
|
||||
ret = fd_msg_avp_setvalue (avpch2, &val);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
|
||||
ret = fd_msg_avp_new(rx_flow_description, 0, &avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
#define TEST_RX_FLOW_DESC3 \
|
||||
"permit out 17 from 172.20.166.84 to 172.18.128.20 20002"
|
||||
val.os.data = (c_uint8_t *)TEST_RX_FLOW_DESC3;
|
||||
val.os.len = strlen(TEST_RX_FLOW_DESC3);
|
||||
ret = fd_msg_avp_setvalue (avpch2, &val);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_new(rx_flow_description, 0, &avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
#define TEST_RX_FLOW_DESC3 \
|
||||
"permit out 17 from 172.20.166.84 to 172.18.128.20 20002"
|
||||
val.os.data = (c_uint8_t *)TEST_RX_FLOW_DESC3;
|
||||
val.os.len = strlen(TEST_RX_FLOW_DESC3);
|
||||
ret = fd_msg_avp_setvalue (avpch2, &val);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
|
||||
ret = fd_msg_avp_new(rx_flow_description, 0, &avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
#define TEST_RX_FLOW_DESC4 \
|
||||
"permit in 17 from 172.18.128.20 to 172.20.166.84 20361"
|
||||
val.os.data = (c_uint8_t *)TEST_RX_FLOW_DESC4;
|
||||
val.os.len = strlen(TEST_RX_FLOW_DESC4);
|
||||
ret = fd_msg_avp_setvalue (avpch2, &val);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_new(rx_flow_description, 0, &avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
#define TEST_RX_FLOW_DESC4 \
|
||||
"permit in 17 from 172.18.128.20 to 172.20.166.84 20361"
|
||||
val.os.data = (c_uint8_t *)TEST_RX_FLOW_DESC4;
|
||||
val.os.len = strlen(TEST_RX_FLOW_DESC4);
|
||||
ret = fd_msg_avp_setvalue (avpch2, &val);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_add (avpch1, MSG_BRW_LAST_CHILD, avpch2);
|
||||
d_assert(ret == 0, return,);
|
||||
|
||||
ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1);
|
||||
d_assert(ret == 0, return,);
|
||||
ret = fd_msg_avp_add (avp, MSG_BRW_LAST_CHILD, avpch1);
|
||||
d_assert(ret == 0, return,);
|
||||
}
|
||||
|
||||
ret = fd_msg_avp_add(req, MSG_BRW_LAST_CHILD, avp);
|
||||
d_assert(ret == 0, return,);
|
||||
|
|
|
@ -10,7 +10,8 @@ extern "C" {
|
|||
CORE_DECLARE(status_t) pcscf_fd_init(void);
|
||||
CORE_DECLARE(void) pcscf_fd_final(void);
|
||||
|
||||
CORE_DECLARE(void) pcscf_rx_send_aar(c_int8_t **rx_sid, const char *ip);
|
||||
CORE_DECLARE(void) pcscf_rx_send_aar(c_int8_t **rx_sid, const char *ip,
|
||||
int qos_presence, int flow_presence);
|
||||
CORE_DECLARE(void) pcscf_rx_send_str(c_int8_t *rx_sid);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -237,7 +237,7 @@ static void volte_test1(abts_case *tc, void *data)
|
|||
core_sleep(time_from_msec(300));
|
||||
|
||||
/* Send AA-Request */
|
||||
pcscf_rx_send_aar(&rx_sid, "45.45.0.3");
|
||||
pcscf_rx_send_aar(&rx_sid, "45.45.0.3", 1, 1);
|
||||
|
||||
/* Receive E-RAB Setup Request +
|
||||
* Activate dedicated EPS bearer context request */
|
||||
|
@ -262,6 +262,12 @@ static void volte_test1(abts_case *tc, void *data)
|
|||
|
||||
core_sleep(time_from_msec(300));
|
||||
|
||||
/* Send AA-Request without Flow */
|
||||
pcscf_rx_send_aar(&rx_sid, "45.45.0.3", 1, 0);
|
||||
|
||||
core_sleep(time_from_msec(1000));
|
||||
|
||||
#if 0
|
||||
/* Send Session-Termination-Request */
|
||||
pcscf_rx_send_str(rx_sid);
|
||||
|
||||
|
@ -278,15 +284,16 @@ static void volte_test1(abts_case *tc, void *data)
|
|||
rv = tests1ap_enb_send(sock, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
|
||||
core_sleep(time_from_msec(300));
|
||||
|
||||
/* Deactivate EPS bearer context accept */
|
||||
rv = tests1ap_build_deactivate_bearer_accept(&sendbuf, msgindex+1);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
rv = tests1ap_enb_send(sock, sendbuf);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
|
||||
core_sleep(time_from_msec(1000));
|
||||
core_sleep(time_from_msec(300));
|
||||
|
||||
#if 0
|
||||
/* Send PDN disconnectivity request */
|
||||
rv = tests1ap_build_pdn_disconnectivity_request(&sendbuf, msgindex);
|
||||
ABTS_INT_EQUAL(tc, CORE_OK, rv);
|
||||
|
|
Loading…
Reference in New Issue