fixed the payload_len for icmpv6 (bug 151)

remotes/origin/master-1.0.x
Gurvinder Singh 16 years ago committed by Victor Julien
parent 3721037de5
commit ad9ec4dbe9

@ -166,6 +166,7 @@ void DecodeICMPV6(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p,
p->proto = IPPROTO_ICMPV6;
p->type = p->icmpv6h->type;
p->code = p->icmpv6h->code;
p->payload_len = len - ICMPV6_HEADER_LEN;
SCLogDebug("ICMPV6 TYPE %" PRIu32 " CODE %" PRIu32 "", p->icmpv6h->type,
p->icmpv6h->code);

@ -98,10 +98,13 @@ error:
*/
int DetectDsizeMatch (ThreadVars *t, DetectEngineThreadCtx *det_ctx, Packet *p, Signature *s, SigMatch *m)
{
SCEnter();
int ret = 0;
DetectDsizeData *dd = (DetectDsizeData *)m->ctx;
SCLogDebug("p->payload_len %"PRIu16"", p->payload_len);
if (dd->mode == DETECTDSIZE_EQ && dd->dsize == p->payload_len)
ret = 1;
else if (dd->mode == DETECTDSIZE_LT && p->payload_len < dd->dsize)
@ -111,7 +114,7 @@ int DetectDsizeMatch (ThreadVars *t, DetectEngineThreadCtx *det_ctx, Packet *p,
else if (dd->mode == DETECTDSIZE_RA && p->payload_len > dd->dsize && p->payload_len < dd->dsize2)
ret = 1;
return ret;
SCReturnInt(ret);
}
/**
@ -270,6 +273,8 @@ static int DetectDsizeSetup (DetectEngineCtx *de_ctx, Signature *s, char *rawstr
SigMatchAppendPacket(s, sm);
SCLogDebug("dd->dsize %"PRIu16", dd->dsize2 %"PRIu16", dd->mode %"PRIu8"",
dd->dsize, dd->dsize2, dd->mode);
/* tell the sig it has a dsize to speed up engine init */
s->flags |= SIG_FLAG_DSIZE;
return 0;

Loading…
Cancel
Save