-- decode past excess ip6 extensions and bad options
-- add iface to alert_csv.fields
-- add hyperscan fast pattern search engine - functional but not yet used
--- remote --enable-perf-profiling so it is always built
+-- remove --enable-perf-profiling so it is always built
-- perf profiling changes in preparation for memory profiling
-- remove obsolete LibDAQ preprocessor conditionals
-- fix arp inspection
SnortEventqAdd(GID_DECODE, sid);
}
-bool Codec::CheckIPV6HopOptions(const RawData& raw, const CodecData& codec)
+bool Codec::CheckIPV6HopOptions(const RawData& raw, CodecData& codec)
{
const ip::IP6Extension* const exthdr =
reinterpret_cast<const ip::IP6Extension*>(raw.data);
/* Skip to the options */
pkt += 2;
- bool my_bad = false;
/* Iterate through the options, check for bad ones */
while (pkt < hdr_end)
break;
default:
- if ( !my_bad )
+ if ( !(codec.codec_flags & CODEC_IP6_BAD_OPT) )
{
codec_event(codec, DECODE_IPV6_BAD_OPT_TYPE);
- my_bad = true;
+ codec.codec_flags |= CODEC_IP6_BAD_OPT;
}
// fall thru ...
1) A routing header was already seen, and
2) The second destination header is the last one before the upper layer.
*/
- if (!((codec.codec_flags & CODEC_ROUTING_SEEN) &&
- (proto == IPPROTO_ID_DSTOPTS) &&
- (next_order == ip::IPV6_ORDER_MAX)))
+ if ( !((codec.codec_flags & CODEC_ROUTING_SEEN) and
+ (proto == IPPROTO_ID_DSTOPTS) and
+ (next_order == ip::IPV6_ORDER_MAX)) )
{
- codec_event(codec, DECODE_IPV6_UNORDERED_EXTENSIONS);
+ if ( !(codec.codec_flags & CODEC_IP6_EXT_OOO) )
+ {
+ codec_event(codec, DECODE_IPV6_UNORDERED_EXTENSIONS);
+ codec.codec_flags |= CODEC_IP6_EXT_OOO;
+ }
}
}
else
constexpr uint16_t CODEC_STREAM_REBUILT = 0x0100;
constexpr uint16_t CODEC_NON_IP_TUNNEL = 0x0200;
+constexpr uint16_t CODEC_IP6_EXT_OOO = 0x0400;
+constexpr uint16_t CODEC_IP6_BAD_OPT = 0x0800;
+
constexpr uint16_t CODEC_IPOPT_FLAGS = (CODEC_IPOPT_RR_SEEN |
CODEC_IPOPT_RTRALT_SEEN | CODEC_IPOPT_LEN_THREE);
// Create an event with the Codec GID
void codec_event(const CodecData &, CodecSid);
// Check the Hop and DST IPv6 extension
- bool CheckIPV6HopOptions(const RawData&, const CodecData&);
+ bool CheckIPV6HopOptions(const RawData&, CodecData&);
// NOTE:: data.next_prot_id MUST be set before calling this!!
void CheckIPv6ExtensionOrder(CodecData&, const uint8_t proto);