From: Victor Julien Date: Wed, 26 Feb 2014 11:21:24 +0000 (+0100) Subject: icmpv6: Fix Coverity warnings on ND_* types X-Git-Tag: suricata-2.0rc2~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f2ce16ef369805f7ce03c4e33b2eb234220b681;p=thirdparty%2Fsuricata.git icmpv6: Fix Coverity warnings on ND_* types This patch fixes: ** CID 1187544: Missing break in switch (MISSING_BREAK) /src/decode-icmpv6.c: 268 in DecodeICMPV6() ** CID 1187545: Missing break in switch (MISSING_BREAK) /src/decode-icmpv6.c: 270 in DecodeICMPV6() ** CID 1187546: Missing break in switch (MISSING_BREAK) /src/decode-icmpv6.c: 272 in DecodeICMPV6() ** CID 1187547: Missing break in switch (MISSING_BREAK) /src/decode-icmpv6.c: 274 in DecodeICMPV6() It duplicates the logic instead of adding 'fall through' statements as the debug statements were wrong and confusing. For ND_REDIRECT all 5 ND_* types would have been printed. --- diff --git a/src/decode-icmpv6.c b/src/decode-icmpv6.c index 660ad989ce..89de9989bf 100644 --- a/src/decode-icmpv6.c +++ b/src/decode-icmpv6.c @@ -265,19 +265,33 @@ int DecodeICMPV6(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, break; case ND_ROUTER_SOLICIT: SCLogDebug("ND_ROUTER_SOLICIT"); + if (p->icmpv6h->code != 0) { + ENGINE_SET_EVENT(p, ICMPV6_UNKNOWN_CODE); + } + break; case ND_ROUTER_ADVERT: SCLogDebug("ND_ROUTER_ADVERT"); + if (p->icmpv6h->code != 0) { + ENGINE_SET_EVENT(p, ICMPV6_UNKNOWN_CODE); + } + break; case ND_NEIGHBOR_SOLICIT: SCLogDebug("ND_NEIGHBOR_SOLICIT"); + if (p->icmpv6h->code != 0) { + ENGINE_SET_EVENT(p, ICMPV6_UNKNOWN_CODE); + } + break; case ND_NEIGHBOR_ADVERT: SCLogDebug("ND_NEIGHBOR_ADVERT"); + if (p->icmpv6h->code != 0) { + ENGINE_SET_EVENT(p, ICMPV6_UNKNOWN_CODE); + } + break; case ND_REDIRECT: SCLogDebug("ND_REDIRECT"); - if (p->icmpv6h->code != 0) { ENGINE_SET_EVENT(p, ICMPV6_UNKNOWN_CODE); } - break; default: SCLogDebug("ICMPV6 Message type %" PRIu8 " not "