Ignore PDCP status PDUs, instead of passing them to the GW. Check on the GW if the packet is large enough to hold an IPv4 header.

This commit is contained in:
Pedro Alvarez 2019-07-11 12:47:39 +01:00 committed by Ismael Gomez
parent 11d42acb3a
commit 9b6aaac1b5
2 changed files with 12 additions and 1 deletions

View File

@ -199,9 +199,17 @@ void pdcp_entity::write_pdu(unique_byte_buffer_t pdu)
return;
}
pthread_mutex_lock(&mutex);
if (cfg.is_data) {
// Check PDCP control messages
if ((pdu->msg[0] & 0x80) == 0) {
log->debug("Unhandled PDCP Control PDU\n");
goto exit; // TODO handle PDCP control PDUs
}
// Handle DRB messages
if (rlc->rb_is_um(lcid)) {
handle_um_drb_pdu(pdu);

View File

@ -41,7 +41,7 @@ gw::gw() : if_up(false), default_lcid(0), thread("GW")
int gw::init(const gw_args_t& args_, srslte::logger* logger_, stack_interface_gw* stack_)
{
pool = srslte::byte_buffer_pool::get_instance();
pool = srslte::byte_buffer_pool::get_instance();
stack = stack_;
logger = logger_;
args = args_;
@ -127,6 +127,9 @@ void gw::write_pdu(uint32_t lcid, srslte::unique_byte_buffer_t pdu)
dl_tput_bytes += pdu->N_bytes;
if (!if_up) {
log.warning("TUN/TAP not up - dropping gw RX message\n");
} else if (pdu->N_bytes < 20) {
// Packet not large enough to hold IPv4 Header
log.warning("Packet to small to hold IPv4 header. Dropping packet with %d B\n", pdu->N_bytes);
} else {
// Only handle IPv4 and IPv6 packets
struct iphdr* ip_pkt = (struct iphdr*)pdu->msg;