Fix in getting filter information for local port.

master
Pedro Alvarez 6 years ago committed by Andre Puschmann
parent ede5f3318b
commit ccf404f12b

@ -30,18 +30,21 @@ tft_packet_filter_t::tft_packet_filter_t(const LIBLTE_MME_PACKET_FILTER_STRUCT&
{
int idx = 0;
while (idx < tft.filter_size) {
switch (tft.filter[idx] & 0x0F) {
switch (tft.filter[idx]) {
case IPV4_REMOTE_ADDR_TYPE:
idx++;
active_filters = IPV4_REMOTE_ADDR_FLAG;
memcpy(&ipv4_remote_addr, &tft.filter[idx], 4);
idx += 4;
break;
case IPV4_LOCAL_ADDR_TYPE:
idx++;
active_filters = IPV4_LOCAL_ADDR_FLAG;
memcpy(&ipv4_local_addr, &tft.filter[idx], 4);
idx += 4;
break;
case IPV6_REMOTE_ADDR_TYPE:
idx++;
active_filters = IPV6_REMOTE_ADDR_FLAG;
memcpy(&ipv4_local_addr, &tft.filter[idx], 16);
idx += 16;
@ -53,6 +56,7 @@ tft_packet_filter_t::tft_packet_filter_t(const LIBLTE_MME_PACKET_FILTER_STRUCT&
case PROTOCOL_ID_TYPE:
break;
case SINGLE_LOCAL_PORT_TYPE:
idx++;
active_filters = SINGLE_LOCAL_PORT_FLAG;
memcpy(&single_local_port, &tft.filter[idx], 2);
idx += 2;

@ -61,6 +61,15 @@ int tft_filter_test()
memcpy(tst_msg->msg, nas_message, nas_message_len);
log1.info_hex(tst_msg->msg, tst_msg->N_bytes, "NAS Activate Dedicated EPS Bearer Context Request original message\n");
// Test message type and protocol discriminator
uint8_t pd, msg_type;
liblte_mme_parse_msg_header((LIBLTE_BYTE_MSG_STRUCT*)tst_msg.get(), &pd, &msg_type);
TESTASSERT(msg_type == LIBLTE_MME_MSG_TYPE_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST);
// Unpack message
err = liblte_mme_unpack_activate_dedicated_eps_bearer_context_request_msg((LIBLTE_BYTE_MSG_STRUCT*)tst_msg.get(),
&ded_bearer_req);
TESTASSERT(err == LIBLTE_SUCCESS);
// Traffic flow template
TESTASSERT(ded_bearer_req.tft.tft_op_code == LIBLTE_MME_TFT_OPERATION_CODE_CREATE_NEW_TFT);
TESTASSERT(ded_bearer_req.tft.parameter_list_size == 0);
@ -74,6 +83,10 @@ int tft_filter_test()
srsue::tft_packet_filter_t filter(ded_bearer_req.tft.packet_filter_list[0]);
// Check filter
TESTASSERT(filter.active_filters == SINGLE_LOCAL_PORT_FLAG);
TESTASSERT(filter.single_local_port == ntohs(2222));
printf("Test NAS Activate Dedicated EPS Bearer Context Request successfull\n");
return 0;
}

Loading…
Cancel
Save