From 2c8df73d24a143606565db12f3ab9bffb19b26ec Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Tue, 21 Jul 2009 13:18:29 +0200 Subject: [PATCH] Add decoder events to ethernet and sll decoding. --- src/decode-ethernet.c | 5 ++++- src/decode-events.h | 5 +++++ src/decode-sll.c | 5 ++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/decode-ethernet.c b/src/decode-ethernet.c index c7ad74b9bc..8d0bd22c57 100644 --- a/src/decode-ethernet.c +++ b/src/decode-ethernet.c @@ -2,11 +2,14 @@ #include "decode.h" #include "decode-ethernet.h" +#include "decode-events.h" void DecodeEthernet(ThreadVars *t, Packet *p, u_int8_t *pkt, u_int16_t len, PacketQueue *pq) { - if (len < ETHERNET_HEADER_LEN) + if (len < ETHERNET_HEADER_LEN) { + DECODER_SET_EVENT(p,ETHERNET_PKT_TOO_SMALL); return; + } EthernetHdr *ethh = (EthernetHdr *)pkt; if (ethh == NULL) diff --git a/src/decode-events.h b/src/decode-events.h index 4e400b022e..8ece584dda 100644 --- a/src/decode-events.h +++ b/src/decode-events.h @@ -35,6 +35,11 @@ enum { UDP_HLEN_TOO_SMALL, UDP_HLEN_INVALID, + /* SLL EVENTS */ + SLL_PKT_TOO_SMALL, + + /* ETHERNET EVENTS */ + ETHERNET_PKT_TOO_SMALL, }; #endif /* __DECODE_EVENTS_H__ */ diff --git a/src/decode-sll.c b/src/decode-sll.c index 6b02211e59..b92c4e2c3d 100644 --- a/src/decode-sll.c +++ b/src/decode-sll.c @@ -2,11 +2,14 @@ #include "decode.h" #include "decode-sll.h" +#include "decode-events.h" void DecodeSll(ThreadVars *t, Packet *p, u_int8_t *pkt, u_int16_t len, PacketQueue *pq) { - if (len < SLL_HEADER_LEN) + if (len < SLL_HEADER_LEN) { + DECODER_SET_EVENT(p,SLL_PKT_TOO_SMALL); return; + } SllHdr *sllh = (SllHdr *)pkt; if (sllh == NULL)