~ubuntu-branches/ubuntu/raring/suricata/raring

« back to all changes in this revision

Viewing changes to src/detect-dsize.c

  • Committer: Package Import Robot
  • Author(s): Pierre Chifflier
  • Date: 2012-12-14 00:02:51 UTC
  • mfrom: (1.1.18)
  • Revision ID: package-import@ubuntu.com-20121214000251-3326bvmr1x6ofsy5
Tags: 1.4-1
* Imported Upstream version 1.4
* Enable Jansson and LuaJIT support, and add libjansson-dev libluajit-5.1-dev
  to build-deps
* Add python to recommends, for the suricatasc script
* Create /var/run/suricata directory when starting daemon

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
 */
55
55
void DetectDsizeRegister (void) {
56
56
    sigmatch_table[DETECT_DSIZE].name = "dsize";
 
57
    sigmatch_table[DETECT_DSIZE].desc = "match on the size of the packet payload";
 
58
    sigmatch_table[DETECT_DSIZE].url = "https://redmine.openinfosecfoundation.org/projects/suricata/wiki/Payload_keywords#Dsize";
57
59
    sigmatch_table[DETECT_DSIZE].Match = DetectDsizeMatch;
58
60
    sigmatch_table[DETECT_DSIZE].Setup = DetectDsizeSetup;
59
61
    sigmatch_table[DETECT_DSIZE].Free  = DetectDsizeFree;
184
186
    }
185
187
 
186
188
    dd = SCMalloc(sizeof(DetectDsizeData));
187
 
    if (dd == NULL)
 
189
    if (unlikely(dd == NULL))
188
190
        goto error;
189
191
    dd->dsize = 0;
190
192
    dd->dsize2 = 0;
231
233
        }
232
234
    }
233
235
 
234
 
    SCLogDebug("dsize parsed succesfully dsize: %"PRIu16" dsize2: %"PRIu16"",dd->dsize,dd->dsize2);
 
236
    SCLogDebug("dsize parsed successfully dsize: %"PRIu16" dsize2: %"PRIu16"",dd->dsize,dd->dsize2);
235
237
 
236
238
    SCFree(value1);
237
239
    SCFree(mode);
306
308
            dd->dsize, dd->dsize2, dd->mode);
307
309
    /* tell the sig it has a dsize to speed up engine init */
308
310
    s->flags |= SIG_FLAG_REQUIRE_PACKET;
 
311
    s->flags |= SIG_FLAG_DSIZE;
 
312
 
 
313
    if (s->dsize_sm == NULL) {
 
314
        s->dsize_sm = sm;
 
315
    }
309
316
 
310
317
    return 0;
311
318
 
720
727
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 };
721
728
 
722
729
    Packet *p = SCMalloc(SIZE_OF_PACKET);
723
 
    if (p == NULL)
 
730
    if (unlikely(p == NULL))
724
731
        return 0;
725
732
    IPV6Hdr ip6h;
726
733
    ThreadVars tv;