diff --git a/src/decode-vlan.c b/src/decode-vlan.c index 371e2ad857..d929bae826 100644 --- a/src/decode-vlan.c +++ b/src/decode-vlan.c @@ -87,8 +87,11 @@ int DecodeVLAN(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, p->vlan_id[p->vlan_idx++] = (uint16_t)GET_VLAN_ID(vlan_hdr); - DecodeNetworkLayer(tv, dtv, proto, p, pkt + VLAN_HEADER_LEN, len - VLAN_HEADER_LEN); - + if (DecodeNetworkLayer(tv, dtv, proto, p, + pkt + VLAN_HEADER_LEN, len - VLAN_HEADER_LEN) == false) { + ENGINE_SET_INVALID_EVENT(p, VLAN_UNKNOWN_TYPE); + return TM_ECODE_FAILED; + } return TM_ECODE_OK; } diff --git a/src/decode.h b/src/decode.h index 2b5c41cc3b..aadaf373d7 100644 --- a/src/decode.h +++ b/src/decode.h @@ -1189,7 +1189,9 @@ static inline void DecodeLinkLayer(ThreadVars *tv, DecodeThreadVars *dtv, } } -static inline void DecodeNetworkLayer(ThreadVars *tv, DecodeThreadVars *dtv, +/** \brief decode network layer + * \retval bool true if successful, false if unknown */ +static inline bool DecodeNetworkLayer(ThreadVars *tv, DecodeThreadVars *dtv, const uint16_t proto, Packet *p, const uint8_t *data, const uint32_t len) { switch (proto) { @@ -1235,10 +1237,10 @@ static inline void DecodeNetworkLayer(ThreadVars *tv, DecodeThreadVars *dtv, } break; default: - SCLogDebug("unknown ether type: %" PRIx32 "", proto); - ENGINE_SET_INVALID_EVENT(p, VLAN_UNKNOWN_TYPE); // TODO - break; + SCLogDebug("unknown ether type: %" PRIx16 "", proto); + return false; } + return true; } #endif /* __DECODE_H__ */