Skip to content

Commit c5ff970

Browse files
Lukas Sismislukashino
Lukas Sismis
authored andcommitted
decode-udp: Allow shorter UDP packets than the remaining payload length
If the packet is shorter than IP payload length we no longer flag it as an invalid UDP packet. UDP packet can be therefore shorter than IP payload. Redmine ticket: OISF#5693
1 parent a4239d4 commit c5ff970

File tree

4 files changed

+1
-10
lines changed

4 files changed

+1
-10
lines changed

src/decode-ethernet.h

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#define __DECODE_ETHERNET_H__
2626

2727
#define ETHERNET_HEADER_LEN 14
28+
#define ETHERNET_PKT_MIN_LEN 60 // Min. transmission unit on Ethernet is 64B (4B for FCS)
2829

2930
/* Cisco Fabric Path / DCE header length. */
3031
#define ETHERNET_DCE_HEADER_LEN (ETHERNET_HEADER_LEN + 2)

src/decode-events.c

-4
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,6 @@ const struct DecodeEvents_ DEvents[] = {
266266
"decoder.udp.hlen_too_small",
267267
UDP_HLEN_TOO_SMALL,
268268
},
269-
{
270-
"decoder.udp.hlen_invalid",
271-
UDP_HLEN_INVALID,
272-
},
273269

274270
/* SLL EVENTS */
275271
{

src/decode-events.h

-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ enum {
102102
/* UDP EVENTS */
103103
UDP_PKT_TOO_SMALL, /**< udp packet smaller than minimum size */
104104
UDP_HLEN_TOO_SMALL, /**< udp header smaller than minimum size */
105-
UDP_HLEN_INVALID, /**< invalid len of upd header */
106105

107106
/* SLL EVENTS */
108107
SLL_PKT_TOO_SMALL, /**< sll packet smaller than minimum size */

src/decode-udp.c

-5
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ static int DecodeUDPPacket(ThreadVars *t, Packet *p, const uint8_t *pkt, uint16_
5656
return -1;
5757
}
5858

59-
if (unlikely(len != UDP_GET_LEN(p))) {
60-
ENGINE_SET_INVALID_EVENT(p, UDP_HLEN_INVALID);
61-
return -1;
62-
}
63-
6459
SET_UDP_SRC_PORT(p,&p->sp);
6560
SET_UDP_DST_PORT(p,&p->dp);
6661

0 commit comments

Comments
 (0)