Started to add a lookup in the gw to see if there is a match in the packet filter.

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

@ -103,6 +103,11 @@ private:
struct sockaddr_in mbsfn_sock_addr; // Target address struct sockaddr_in mbsfn_sock_addr; // Target address
uint32_t mbsfn_ports[SRSLTE_N_MCH_LCIDS]; // Target ports for MBSFN data uint32_t mbsfn_ports[SRSLTE_N_MCH_LCIDS]; // Target ports for MBSFN data
// TFT
typedef std::map<uint16_t, tft_packet_filter_t> tft_filter_map_t;
tft_filter_map_t tft_filter_map;
uint8_t check_tft_filter_match(const srslte::unique_byte_buffer_t& pdu);
}; };
} // namespace srsue } // namespace srsue

@ -223,10 +223,22 @@ int gw::setup_if_addr(uint32_t lcid, uint8_t pdn_type, uint32_t ip_addr, uint8_t
int gw::apply_traffic_flow_template(const LIBLTE_MME_TRAFFIC_FLOW_TEMPLATE_STRUCT* tft) int gw::apply_traffic_flow_template(const LIBLTE_MME_TRAFFIC_FLOW_TEMPLATE_STRUCT* tft)
{ {
int err; int err;
printf("Wazaaa\n");
switch (tft->tft_op_code) { switch (tft->tft_op_code) {
case LIBLTE_MME_TFT_OPERATION_CODE_CREATE_NEW_TFT:
gw_log->console("Adding new TFT\n");
for (int i = 0; i < tft->packet_filter_list_size; i++) {
gw_log->console("New packet filter for TFT\n");
tft_packet_filter_t filter(tft->packet_filter_list[i]);
auto it = tft_filter_map.insert(std::make_pair(filter.eval_precedence, filter));
if(it.second == false){
gw_log->error("Error inserting TFT Packet Filter\n");
return SRSLTE_ERROR_CANT_START;
}
}
break;
default: default:
gw_log->error("Unhandled TFT OP code\n"); gw_log->error("Unhandled TFT OP code\n");
return SRSLTE_ERROR_CANT_START;
} }
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
} }
@ -318,6 +330,9 @@ void gw::run_thread()
break; break;
} }
// Check to which LCID to send the packet
uint8_t lcid = check_tft_filter_match(pdu);
// Send PDU directly to PDCP // Send PDU directly to PDCP
if (pdcp->is_lcid_enabled(default_lcid)) { if (pdcp->is_lcid_enabled(default_lcid)) {
pdu->set_timestamp(); pdu->set_timestamp();
@ -342,6 +357,18 @@ void gw::run_thread()
} }
} }
uint8_t gw::check_tft_filter_match(const srslte::unique_byte_buffer_t& pdu) {
uint8_t lcid = DRB1_LCID;
if(!tft_filter_map.empty()){
for (std::pair<const uint16_t, tft_packet_filter_t>& filter_pair : tft_filter_map) {
bool match = filter_pair.second.match(pdu);
gw_log->console("Found filter match\n");
}
}
return lcid;
}
/**************************/ /**************************/
/* TUN Interface Helpers */ /* TUN Interface Helpers */
/**************************/ /**************************/

Loading…
Cancel
Save