nas,tft: add support for TFT modification

master
Andre Puschmann 4 years ago
parent 483a216bd5
commit 60f8a8db1c

@ -1625,13 +1625,25 @@ void nas::parse_modify_eps_bearer_context_request(srsran::unique_byte_buffer_t p
ctxt.rx_count++;
// check if bearer exists
if (eps_bearer.find(request.eps_bearer_id) == eps_bearer.end()) {
const auto it = eps_bearer.find(request.eps_bearer_id);
if (it == eps_bearer.end()) {
logger.error("EPS bearer doesn't exist (eps_bearer_id=%d)", request.eps_bearer_id);
// fixme: send proper response
return;
}
// fixme: carry out modification
LIBLTE_MME_TRAFFIC_FLOW_TEMPLATE_STRUCT* tft = &request.tft;
logger.info("Traffic Flow Template: TFT OP code 0x%x, Filter list size %d, Parameter list size %d",
tft->tft_op_code,
tft->packet_filter_list_size,
tft->parameter_list_size);
// modify/apply packet filters to GW
if (gw->apply_traffic_flow_template(request.eps_bearer_id, tft) != SRSRAN_SUCCESS) {
logger.error("Couldn't modify TFT");
return;
}
logger.info("Modified EPS bearer context (eps_bearer_id=%d)", request.eps_bearer_id);
send_modify_eps_bearer_context_accept(request.proc_transaction_id, request.eps_bearer_id);

@ -415,6 +415,30 @@ int tft_pdu_matcher::apply_traffic_flow_template(const uint8_t&
}
}
break;
case LIBLTE_MME_TFT_OPERATION_CODE_REPLACE_PACKET_FILTERS_IN_EXISTING_TFT:
for (int i = 0; i < tft->packet_filter_list_size; i++) {
// erase old filter if it exists
auto old_filter = std::find_if(
tft_filter_map.begin(), tft_filter_map.end(), [&](const std::pair<uint16_t, tft_packet_filter_t>& filter) {
return filter.second.id == tft->packet_filter_list[i].id;
});
if (old_filter == tft_filter_map.end()) {
logger.error("Error couldn't find TFT with id %d", tft->packet_filter_list[i].id);
return SRSRAN_ERROR_CANT_START;
}
// release old filter
tft_filter_map.erase(old_filter);
// Add new filter
tft_packet_filter_t new_filter(erab_id, tft->packet_filter_list[i], logger);
auto it = tft_filter_map.insert(std::make_pair(new_filter.eval_precedence, new_filter));
if (it.second == false) {
logger.error("Error inserting TFT Packet Filter");
return SRSRAN_ERROR_CANT_START;
}
}
break;
default:
logger.error("Unhandled TFT OP code");
return SRSRAN_ERROR_CANT_START;

Loading…
Cancel
Save