From 9f2ce16ef369805f7ce03c4e33b2eb234220b681 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Wed, 26 Feb 2014 12:21:24 +0100 Subject: [PATCH] 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. --- src/decode-icmpv6.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) 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 "