From: Victor Roemer Date: Tue, 22 Sep 2015 17:08:28 +0000 (-0400) Subject: Invert logic, test for valid next IPv6 headers. X-Git-Tag: 3.0.0-233~823^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39818a51f33ecff40e6b0038affbf349f00a0bf2;p=thirdparty%2Fsnort3.git Invert logic, test for valid next IPv6 headers. --- diff --git a/src/codecs/ip/cd_ipv6.cc b/src/codecs/ip/cd_ipv6.cc index 47db9e803..1d4507783 100644 --- a/src/codecs/ip/cd_ipv6.cc +++ b/src/codecs/ip/cd_ipv6.cc @@ -195,7 +195,7 @@ bool Ipv6Codec::decode(const RawData& raw, CodecData& codec, DecodeData& snort) IPV6MiscTests(snort, codec); CheckIPV6Multicast(ip6h, codec); - if (ip6h->is_bad_next_header()) + if (ip6h->is_valid_next_header() == false) codec_event(codec, DECODE_IPV6_BAD_NEXT_HEADER); const_cast(raw.len) = ip6h->len() + ip::IP6_HEADER_LEN; diff --git a/src/protocols/ipv6.h b/src/protocols/ipv6.h index 5cdab9943..1781dbf79 100644 --- a/src/protocols/ipv6.h +++ b/src/protocols/ipv6.h @@ -143,7 +143,7 @@ struct IP6Hdr inline bool is_dst_multicast_scope_global() const { return (static_cast(ip6_dst.u6_addr8[1]) == MulticastScope::GLOBAL); } - inline bool is_bad_next_header() const + inline bool is_valid_next_header() const { switch (ip6_next) { @@ -155,11 +155,11 @@ struct IP6Hdr case IPPROTO_DSTOPTS: case IPPROTO_ROUTING: case IPPROTO_FRAGMENT: - return false; + return true; default: break; } - return true; + return false; } /* setters */