diff --git a/lib/include/srslte/upper/gtpu.h b/lib/include/srslte/upper/gtpu.h index 9f38dc1ef..c283da44a 100644 --- a/lib/include/srslte/upper/gtpu.h +++ b/lib/include/srslte/upper/gtpu.h @@ -97,7 +97,8 @@ inline bool gtpu_supported_msg_type_check(gtpu_header_t* header, srslte::log_ref { // msg_tpye if (header->message_type != GTPU_MSG_DATA_PDU && header->message_type != GTPU_MSG_ECHO_REQUEST && - header->message_type != GTPU_MSG_ECHO_RESPONSE && header->message_type != GTPU_MSG_END_MARKER) { + header->message_type != GTPU_MSG_ECHO_RESPONSE && header->message_type != GTPU_MSG_ERROR_INDICATION && + header->message_type != GTPU_MSG_END_MARKER) { gtpu_log->error("gtpu_header - Unhandled message type: 0x%x\n", header->message_type); return false; } diff --git a/lib/src/upper/gtpu.cc b/lib/src/upper/gtpu.cc index dc93204ab..8b22cbcd0 100644 --- a/lib/src/upper/gtpu.cc +++ b/lib/src/upper/gtpu.cc @@ -59,6 +59,7 @@ bool gtpu_write_header(gtpu_header_t* header, srslte::byte_buffer_t* pdu, srslte uint16_to_uint8(header->length, ptr); ptr += 2; uint32_to_uint8(header->teid, ptr); + ptr += 4; // write optional fields, if E, S or PN are set. if (header->flags & (GTPU_FLAGS_EXTENDED_HDR | GTPU_FLAGS_SEQUENCE | GTPU_FLAGS_PACKET_NUM)) { // S diff --git a/srsenb/src/stack/upper/gtpu.cc b/srsenb/src/stack/upper/gtpu.cc index e1d5f8e48..7a561874f 100644 --- a/srsenb/src/stack/upper/gtpu.cc +++ b/srsenb/src/stack/upper/gtpu.cc @@ -98,7 +98,8 @@ void gtpu::write_pdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t if (ip_pkt->version != 4 && ip_pkt->version != 6) { gtpu_log->error("Invalid IP version to SPGW\n"); return; - } else if (ip_pkt->version == 4) { + } + if (ip_pkt->version == 4) { if (ntohs(ip_pkt->tot_len) != pdu->N_bytes) { gtpu_log->error("IP Len and PDU N_bytes mismatch\n"); } @@ -236,6 +237,7 @@ void gtpu::handle_gtpu_s1u_rx_packet(srslte::unique_byte_buffer_t pdu, const soc // Received G-PDU for non-existing and non-zero TEID. // Sending GTP-U error indication error_indication(addr.sin_addr.s_addr, addr.sin_port, header.teid); + return; } switch (header.message_type) { @@ -267,7 +269,9 @@ void gtpu::handle_gtpu_s1u_rx_packet(srslte::unique_byte_buffer_t pdu, const soc if (ip_pkt->version != 4 && ip_pkt->version != 6) { gtpu_log->error("Invalid IP version to SPGW\n"); return; - } else if (ip_pkt->version == 4) { + } + + if (ip_pkt->version == 4) { if (ntohs(ip_pkt->tot_len) != pdu->N_bytes) { gtpu_log->error("IP Len and PDU N_bytes mismatch\n"); } @@ -298,10 +302,10 @@ void gtpu::handle_gtpu_m1u_rx_packet(srslte::unique_byte_buffer_t pdu, const soc ***************************************************************************/ void gtpu::error_indication(in_addr_t addr, in_port_t port, uint32_t err_teid) { - gtpu_log->info("TX GTPU Error Indication, Seq: %d\n", tx_seq); + gtpu_log->info("TX GTPU Error Indication. Seq: %d, Error TEID: %d\n", tx_seq, err_teid); - gtpu_header_t header; - unique_byte_buffer_t pdu = allocate_unique_buffer(*pool); + gtpu_header_t header = {}; + unique_byte_buffer_t pdu = allocate_unique_buffer(*pool); // header header.flags = GTPU_FLAGS_VERSION_V1 | GTPU_FLAGS_GTP_PROTOCOL | GTPU_FLAGS_SEQUENCE; @@ -330,8 +334,8 @@ void gtpu::echo_response(in_addr_t addr, in_port_t port, uint16_t seq) { gtpu_log->info("TX GTPU Echo Response, Seq: %d\n", seq); - gtpu_header_t header; - unique_byte_buffer_t pdu = allocate_unique_buffer(*pool); + gtpu_header_t header = {}; + unique_byte_buffer_t pdu = allocate_unique_buffer(*pool); // header header.flags = GTPU_FLAGS_VERSION_V1 | GTPU_FLAGS_GTP_PROTOCOL | GTPU_FLAGS_SEQUENCE;