mirror of https://github.com/PentHertz/srsLTE.git
Fix issue packing TEID in Error indication.
This commit is contained in:
parent
235f373af7
commit
49bcffcdf8
|
@ -97,7 +97,8 @@ inline bool gtpu_supported_msg_type_check(gtpu_header_t* header, srslte::log_ref
|
||||||
{
|
{
|
||||||
// msg_tpye
|
// msg_tpye
|
||||||
if (header->message_type != GTPU_MSG_DATA_PDU && header->message_type != GTPU_MSG_ECHO_REQUEST &&
|
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);
|
gtpu_log->error("gtpu_header - Unhandled message type: 0x%x\n", header->message_type);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,7 @@ bool gtpu_write_header(gtpu_header_t* header, srslte::byte_buffer_t* pdu, srslte
|
||||||
uint16_to_uint8(header->length, ptr);
|
uint16_to_uint8(header->length, ptr);
|
||||||
ptr += 2;
|
ptr += 2;
|
||||||
uint32_to_uint8(header->teid, ptr);
|
uint32_to_uint8(header->teid, ptr);
|
||||||
|
ptr += 4;
|
||||||
// write optional fields, if E, S or PN are set.
|
// write optional fields, if E, S or PN are set.
|
||||||
if (header->flags & (GTPU_FLAGS_EXTENDED_HDR | GTPU_FLAGS_SEQUENCE | GTPU_FLAGS_PACKET_NUM)) {
|
if (header->flags & (GTPU_FLAGS_EXTENDED_HDR | GTPU_FLAGS_SEQUENCE | GTPU_FLAGS_PACKET_NUM)) {
|
||||||
// S
|
// S
|
||||||
|
|
|
@ -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) {
|
if (ip_pkt->version != 4 && ip_pkt->version != 6) {
|
||||||
gtpu_log->error("Invalid IP version to SPGW\n");
|
gtpu_log->error("Invalid IP version to SPGW\n");
|
||||||
return;
|
return;
|
||||||
} else if (ip_pkt->version == 4) {
|
}
|
||||||
|
if (ip_pkt->version == 4) {
|
||||||
if (ntohs(ip_pkt->tot_len) != pdu->N_bytes) {
|
if (ntohs(ip_pkt->tot_len) != pdu->N_bytes) {
|
||||||
gtpu_log->error("IP Len and PDU N_bytes mismatch\n");
|
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.
|
// Received G-PDU for non-existing and non-zero TEID.
|
||||||
// Sending GTP-U error indication
|
// Sending GTP-U error indication
|
||||||
error_indication(addr.sin_addr.s_addr, addr.sin_port, header.teid);
|
error_indication(addr.sin_addr.s_addr, addr.sin_port, header.teid);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (header.message_type) {
|
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) {
|
if (ip_pkt->version != 4 && ip_pkt->version != 6) {
|
||||||
gtpu_log->error("Invalid IP version to SPGW\n");
|
gtpu_log->error("Invalid IP version to SPGW\n");
|
||||||
return;
|
return;
|
||||||
} else if (ip_pkt->version == 4) {
|
}
|
||||||
|
|
||||||
|
if (ip_pkt->version == 4) {
|
||||||
if (ntohs(ip_pkt->tot_len) != pdu->N_bytes) {
|
if (ntohs(ip_pkt->tot_len) != pdu->N_bytes) {
|
||||||
gtpu_log->error("IP Len and PDU N_bytes mismatch\n");
|
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)
|
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;
|
gtpu_header_t header = {};
|
||||||
unique_byte_buffer_t pdu = allocate_unique_buffer(*pool);
|
unique_byte_buffer_t pdu = allocate_unique_buffer(*pool);
|
||||||
|
|
||||||
// header
|
// header
|
||||||
header.flags = GTPU_FLAGS_VERSION_V1 | GTPU_FLAGS_GTP_PROTOCOL | GTPU_FLAGS_SEQUENCE;
|
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_log->info("TX GTPU Echo Response, Seq: %d\n", seq);
|
||||||
|
|
||||||
gtpu_header_t header;
|
gtpu_header_t header = {};
|
||||||
unique_byte_buffer_t pdu = allocate_unique_buffer(*pool);
|
unique_byte_buffer_t pdu = allocate_unique_buffer(*pool);
|
||||||
|
|
||||||
// header
|
// header
|
||||||
header.flags = GTPU_FLAGS_VERSION_V1 | GTPU_FLAGS_GTP_PROTOCOL | GTPU_FLAGS_SEQUENCE;
|
header.flags = GTPU_FLAGS_VERSION_V1 | GTPU_FLAGS_GTP_PROTOCOL | GTPU_FLAGS_SEQUENCE;
|
||||||
|
|
Loading…
Reference in New Issue