-/* Copyright (C) 2007-2011 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
0x05, 0xb4, 0x04, 0x02, 0x08, 0x0a, 0x00, 0x1c,
0x28, 0x81, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03,
0x03, 0x06};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int ret;
memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&tv, 0, sizeof(ThreadVars));
memset(&pq, 0, sizeof(PacketQueue));
- memset(p, 0, SIZE_OF_PACKET);
p->pkt = (uint8_t *)(p + 1);
memset(&s, 0, sizeof(Signature));
- PACKET_INITIALIZE(p);
-
p->alerts.cnt++;
p->alerts.alerts[p->alerts.cnt-1].s = &s;
p->alerts.alerts[p->alerts.cnt-1].s->id = 1;
0x00, 0x00, 0x02, 0x04, 0x05, 0xa0, 0x04, 0x02,
0x08, 0x0a, 0x00, 0x0a, 0x22, 0xa8, 0x00, 0x00,
0x00, 0x00, 0x01, 0x03, 0x03, 0x05 };
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int ret;
memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&tv, 0, sizeof(ThreadVars));
memset(&pq, 0, sizeof(PacketQueue));
- memset(p, 0, SIZE_OF_PACKET);
p->pkt = (uint8_t *)(p + 1);
memset(&s, 0, sizeof(Signature));
- PACKET_INITIALIZE(p);
-
p->alerts.cnt++;
p->alerts.alerts[p->alerts.cnt-1].s = &s;
p->alerts.alerts[p->alerts.cnt-1].s->id = 1;
0x69, 0x6e, 0x67, 0x2e, 0x66, 0x72, 0x65, 0x65,
0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x6e, 0x65, 0x74,
0x0d, 0x0a};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int ret;
memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&tv, 0, sizeof(ThreadVars));
memset(&pq, 0, sizeof(PacketQueue));
- memset(p, 0, SIZE_OF_PACKET);
p->pkt = (uint8_t *)(p + 1);
memset(&s, 0, sizeof(Signature));
- PACKET_INITIALIZE(p);
-
p->alerts.cnt++;
p->alerts.alerts[p->alerts.cnt-1].s = &s;
p->alerts.alerts[p->alerts.cnt-1].s->id = 1;
0xea, 0x37, 0x00, 0x17, 0x6d, 0x0b, 0xba, 0xc3,
0x00, 0x00, 0x00, 0x00, 0x60, 0x02, 0x10, 0x20,
0xdd, 0xe1, 0x00, 0x00, 0x02, 0x04, 0x05, 0xb4};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int ret;
memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&tv, 0, sizeof(ThreadVars));
memset(&pq, 0, sizeof(PacketQueue));
- memset(p, 0, SIZE_OF_PACKET);
p->pkt = (uint8_t *)(p + 1);
memset(&s, 0, sizeof(Signature));
- PACKET_INITIALIZE(p);
-
p->alerts.cnt++;
p->alerts.alerts[p->alerts.cnt-1].s = &s;
p->alerts.alerts[p->alerts.cnt-1].s->id = 1;
0x05, 0xb4, 0x04, 0x02, 0x08, 0x0a, 0x00, 0x1c,
0x28, 0x81, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03,
0x03, 0x06};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int ret;
memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&tv, 0, sizeof(ThreadVars));
memset(&pq, 0, sizeof(PacketQueue));
- memset(p, 0, SIZE_OF_PACKET);
p->pkt = (uint8_t *)(p + 1);
memset(&s, 0, sizeof(Signature));
- PACKET_INITIALIZE(p);
-
p->alerts.cnt++;
p->alerts.alerts[p->alerts.cnt-1].s = &s;
p->alerts.alerts[p->alerts.cnt-1].s->id = 1;
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
static int DecodeGREtest01 (void) {
uint8_t raw_gre[] = { 0x00 ,0x6e ,0x62 };
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
- return 0;
+ return 0;
ThreadVars tv;
DecodeThreadVars dtv;
memset(&tv, 0, sizeof(ThreadVars));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&dtv, 0, sizeof(DecodeThreadVars));
DecodeGRE(&tv, &dtv, p, raw_gre, sizeof(raw_gre), NULL);
0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00, 0x01,
0x00, 0x00, 0x29, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00 };
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
ThreadVars tv;
DecodeThreadVars dtv;
memset(&tv, 0, sizeof(ThreadVars));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&dtv, 0, sizeof(DecodeThreadVars));
DecodeGRE(&tv, &dtv, p, raw_gre, sizeof(raw_gre), NULL);
0x03, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00,
0x01, 0x00, 0x00, 0x29, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 };
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
ThreadVars tv;
DecodeThreadVars dtv;
memset(&tv, 0, sizeof(ThreadVars));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&dtv, 0, sizeof(DecodeThreadVars));
DecodeGRE(&tv, &dtv, p, raw_gre, sizeof(raw_gre), NULL);
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
/** \test IPV4 with no options. */
int DecodeIPV4OptionsNONETest01(void) {
uint8_t raw_opts[] = { };
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
uint8_t *data = (uint8_t *)p;
uint16_t i;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
if (rc != 0) {
DecodeIPV4OptionsPrint(p);
uint8_t raw_opts[] = {
IPV4_OPT_EOL, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
uint8_t *data = (uint8_t *)p;
uint16_t i;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
if (rc != 0) {
DecodeIPV4OptionsPrint(p);
uint8_t raw_opts[] = {
IPV4_OPT_NOP, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
uint8_t *data = (uint8_t *)p;
uint16_t i;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
if (rc != 0) {
DecodeIPV4OptionsPrint(p);
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",rr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_rr, (uintmax_t)&p.IPV4_OPTS[0]);
if ( (rc == 0)
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",rr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_rr, (uintmax_t)&p.IPV4_OPTS[0]);
if (rc != 0) {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",rr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_rr, (uintmax_t)&p.IPV4_OPTS[0]);
if (rc != 0) {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",rr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_rr, (uintmax_t)&p.IPV4_OPTS[0]);
if (rc != 0) {
uint8_t raw_opts[] = {
IPV4_OPT_QS, 0x08, 0x0d, 0x00, 0xbe, 0xef, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",qs=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_qs, (uintmax_t)&p.IPV4_OPTS[0]);
if ( (rc == 0)
uint8_t raw_opts[] = {
IPV4_OPT_QS, 0x07, 0x0d, 0x00, 0xbe, 0xef, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",qs=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_qs, (uintmax_t)&p.IPV4_OPTS[0]);
if (rc != 0) {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",ts=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_ts, (uintmax_t)&p.IPV4_OPTS[0]);
if ( (rc == 0)
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",ts=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_ts, (uintmax_t)&p.IPV4_OPTS[0]);
if (rc != 0) {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",ts=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_ts, (uintmax_t)&p.IPV4_OPTS[0]);
if (rc != 0) {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",ts=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_ts, (uintmax_t)&p.IPV4_OPTS[0]);
if (rc != 0) {
IPV4_OPT_SEC, 0x0b, 0xf1, 0x35, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",sec=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_sec, (uintmax_t)&p.IPV4_OPTS[0]);
if ( (rc == 0)
IPV4_OPT_SEC, 0x0a, 0xf1, 0x35, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",sec=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_sec, (uintmax_t)&p.IPV4_OPTS[0]);
if (rc != 0) {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",lsrr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_lsrr, (uintmax_t)&p.IPV4_OPTS[0]);
if ( (rc == 0)
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",lsrr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_lsrr, (uintmax_t)&p.IPV4_OPTS[0]);
if (rc != 0) {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",lsrr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_lsrr, (uintmax_t)&p.IPV4_OPTS[0]);
if (rc != 0) {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",lsrr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_lsrr, (uintmax_t)&p.IPV4_OPTS[0]);
if (rc != 0) {
0x00, 0x03, 0x00, 0xef, 0x00, 0xef, 0x00, 0x06,
0x00, 0x04, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",rr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_cipso, (uintmax_t)&p.IPV4_OPTS[0]);
if ( (rc == 0)
uint8_t raw_opts[] = {
IPV4_OPT_SID, 0x04, 0xbe, 0xef, 0x00, 0x00, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",sid=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_sid, (uintmax_t)&p.IPV4_OPTS[0]);
if ( (rc == 0)
uint8_t raw_opts[] = {
IPV4_OPT_SID, 0x05, 0xbe, 0xef, 0x00, 0x00, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",sid=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_sid, (uintmax_t)&p.IPV4_OPTS[0]);
if (rc != 0) {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",ssrr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_ssrr, (uintmax_t)&p.IPV4_OPTS[0]);
if ( (rc == 0)
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",ssrr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_ssrr, (uintmax_t)&p.IPV4_OPTS[0]);
if (rc != 0) {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",ssrr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_ssrr, (uintmax_t)&p.IPV4_OPTS[0]);
if (rc != 0) {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",ssrr=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_ssrr, (uintmax_t)&p.IPV4_OPTS[0]);
if (rc != 0) {
uint8_t raw_opts[] = {
IPV4_OPT_RTRALT, 0x04, 0xbe, 0xef, 0x00, 0x00, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",rtralt=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_rtralt, (uintmax_t)&p.IPV4_OPTS[0]);
if ( (rc == 0)
uint8_t raw_opts[] = {
IPV4_OPT_RTRALT, 0x05, 0xbe, 0xef, 0x00, 0x00, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
int rc;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
rc = DecodeIPV4Options(p, raw_opts, sizeof(raw_opts));
//printf("rc=%d,cnt=%" PRIu16 ",type=%" PRIu8 ",len=%" PRIu8 ",rtralt=%" PRIuMAX "/%" PRIuMAX "\n", rc, p.IPV4_OPTS_CNT, p.IPV4_OPTS[0].type, p.IPV4_OPTS[0].len, (uintmax_t)p.ip4vars.o_rtralt, (uintmax_t)&p.IPV4_OPTS[0]);
if (rc != 0) {
0x80, 0x00, 0xb1, 0xa3, 0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
ThreadVars tv;
memset(&tv, 0, sizeof(ThreadVars));
memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&pq, 0, sizeof(PacketQueue));
- memset(p, 0, SIZE_OF_PACKET);
- PACKET_INITIALIZE(p);
FlowInitConfig(FLOW_QUIET);
DefragInit();
0xb1, 0xa3,
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
ThreadVars tv;
memset(&tv, 0, sizeof(ThreadVars));
memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&pq, 0, sizeof(PacketQueue));
- memset(p, 0, SIZE_OF_PACKET);
- PACKET_INITIALIZE(p);
FlowInitConfig(FLOW_QUIET);
DefragInit();
};
Flow *f = NULL;
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
ThreadVars tv;
memset(&tv, 0, sizeof(ThreadVars));
memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&pq, 0, sizeof(PacketQueue));
- memset(p, 0, SIZE_OF_PACKET);
- PACKET_INITIALIZE(p);
FlowInitConfig(FLOW_QUIET);
DefragInit();
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20,
};
- Packet *p1 = SCMalloc(SIZE_OF_PACKET);
+ Packet *p1 = PacketGetFromAlloc();
if (unlikely(p1 == NULL))
- return 0;
- Packet *p2 = SCMalloc(SIZE_OF_PACKET);
+ return 0;
+ Packet *p2 = PacketGetFromAlloc();
if (unlikely(p2 == NULL)) {
- SCFree(p1);
- return 0;
+ SCFree(p1);
+ return 0;
}
ThreadVars tv;
DecodeThreadVars dtv;
memset(&pq, 0, sizeof(PacketQueue));
memset(&tv, 0, sizeof(ThreadVars));
- memset(p1, 0, SIZE_OF_PACKET);
- p1->pkt = (uint8_t *)(p1 + 1);
- memset(p2, 0, SIZE_OF_PACKET);
- p2->pkt = (uint8_t *)(p2 + 1);
memset(&dtv, 0, sizeof(DecodeThreadVars));
- PACKET_INITIALIZE(p1);
- PACKET_INITIALIZE(p2);
-
PacketCopyData(p1, raw_frag1, sizeof(raw_frag1));
PacketCopyData(p2, raw_frag2, sizeof(raw_frag2));
0x00, 0x00, 0x00, 0x00, 0x50, 0x02, 0x20, 0x00,
0xfa, 0x87, 0x00, 0x00,
};
- Packet *p1 = SCMalloc(SIZE_OF_PACKET);
+ Packet *p1 = PacketGetFromAlloc();
if (unlikely(p1 == NULL))
- return 0;
+ return 0;
ThreadVars tv;
DecodeThreadVars dtv;
int result = 0;
memset(&pq, 0, sizeof(PacketQueue));
memset(&tv, 0, sizeof(ThreadVars));
- memset(p1, 0, SIZE_OF_PACKET);
- p1->pkt = (uint8_t *)(p1 + 1);
memset(&dtv, 0, sizeof(DecodeThreadVars));
- PACKET_INITIALIZE(p1);
-
PacketCopyData(p1, raw_pkt1, sizeof(raw_pkt1));
DecodeIPV6(&tv, &dtv, p1, GET_PKT_DATA(p1), GET_PKT_LEN(p1), &pq);
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
*/
static int DecodePPPtest01 (void) {
uint8_t raw_ppp[] = { 0xff, 0x03, 0x00, 0x21, 0x45, 0xc0, 0x00 };
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
ThreadVars tv;
DecodeThreadVars dtv;
memset(&tv, 0, sizeof(ThreadVars));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&dtv, 0, sizeof(DecodeThreadVars));
DecodePPP(&tv, &dtv, p, raw_ppp, sizeof(raw_ppp), NULL);
0x0d, 0x01, 0xbf, 0x01, 0x0d, 0x03, 0xea, 0x37, 0x00,
0x17, 0x6d, 0x0b, 0xba, 0xc3, 0x00, 0x00, 0x00, 0x00,
0x60, 0x02, 0x10, 0x20, 0xdd, 0xe1, 0x00, 0x00 };
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
ThreadVars tv;
DecodeThreadVars dtv;
memset(&tv, 0, sizeof(ThreadVars));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&dtv, 0, sizeof(DecodeThreadVars));
DecodePPP(&tv, &dtv, p, raw_ppp, sizeof(raw_ppp), NULL);
0x0d, 0x01, 0xbf, 0x01, 0x0d, 0x03, 0xea, 0x37, 0x00,
0x17, 0x6d, 0x0b, 0xba, 0xc3, 0x00, 0x00, 0x00, 0x00,
0x60, 0x02, 0x10, 0x20, 0xdd, 0xe1, 0x00, 0x00 };
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
ThreadVars tv;
DecodeThreadVars dtv;
memset(&tv, 0, sizeof(ThreadVars));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&dtv, 0, sizeof(DecodeThreadVars));
FlowInitConfig(FLOW_QUIET);
0x0d, 0x01, 0xbf, 0x01, 0x0d, 0x03, 0xea, 0x37, 0x00,
0x17, 0x6d, 0x0b, 0xba, 0xc3, 0x00, 0x00, 0x00, 0x00,
0x60, 0x02, 0x10, 0x20, 0xdd, 0xe1, 0x00, 0x00 };
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
ThreadVars tv;
DecodeThreadVars dtv;
memset(&tv, 0, sizeof(ThreadVars));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&dtv, 0, sizeof(DecodeThreadVars));
FlowInitConfig(FLOW_QUIET);
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
static int DecodePPPOEtest01 (void) {
uint8_t raw_pppoe[] = { 0x11, 0x00, 0x00, 0x00, 0x00 };
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
- return 0;
+ return 0;
ThreadVars tv;
DecodeThreadVars dtv;
memset(&tv, 0, sizeof(ThreadVars));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&dtv, 0, sizeof(DecodeThreadVars));
DecodePPPOESession(&tv, &dtv, p, raw_pppoe, sizeof(raw_pppoe), NULL);
0x55, 0x56, 0x57, 0x41, 0x42, 0x43, 0x44, 0x45,
0x46, 0x47, 0x48, 0x49 };
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
- return 0;
+ return 0;
ThreadVars tv;
DecodeThreadVars dtv;
int ret = 0;
memset(&tv, 0, sizeof(ThreadVars));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&dtv, 0, sizeof(DecodeThreadVars));
FlowInitConfig(FLOW_QUIET);
0x65, 0x73, 0x68, 0x6f, 0x6f, 0x74
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
- return 0;
+ return 0;
ThreadVars tv;
DecodeThreadVars dtv;
memset(&tv, 0, sizeof(ThreadVars));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&dtv, 0, sizeof(DecodeThreadVars));
DecodePPPOEDiscovery(&tv, &dtv, p, raw_pppoe, sizeof(raw_pppoe), NULL);
0x00, 0x00
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
- return 0;
+ return 0;
ThreadVars tv;
DecodeThreadVars dtv;
memset(&tv, 0, sizeof(ThreadVars));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&dtv, 0, sizeof(DecodeThreadVars));
DecodePPPOEDiscovery(&tv, &dtv, p, raw_pppoe, sizeof(raw_pppoe), NULL);
0x20, 0x2d, 0x20, 0x65, 0x73, 0x68, 0x73, 0x68
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
- return 0;
+ return 0;
ThreadVars tv;
DecodeThreadVars dtv;
memset(&tv, 0, sizeof(ThreadVars));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&dtv, 0, sizeof(DecodeThreadVars));
DecodePPPOEDiscovery(&tv, &dtv, p, raw_pppoe, sizeof(raw_pppoe), NULL);
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
0x29, 0x9c, 0x00, 0x00, 0x02, 0x04, 0x05, 0x8c,
0x04, 0x02, 0x08, 0x0a, 0x00, 0xdd, 0x1a, 0x39,
0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x02 };
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
- return 0;
+ return 0;
ThreadVars tv;
DecodeThreadVars dtv;
memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&tv, 0, sizeof(ThreadVars));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
if (PacketCopyData(p, raw_ip, sizeof(raw_ip)) == -1) {
SCFree(p);
0x70, 0x02, 0x40, 0x00, 0xb8, 0xc8, 0x00, 0x00,
0x02, 0x04, 0x05, 0xb4, 0x01, 0x01, 0x04, 0x02 };
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
- return 0;
+ return 0;
ThreadVars tv;
DecodeThreadVars dtv;
memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&tv, 0, sizeof(ThreadVars));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
if (PacketCopyData(p, raw_ip, sizeof(raw_ip)) == -1) {
SCFree(p);
0x34, 0x40, 0x67, 0x31, 0x3b, 0x63, 0x61, 0x74,
0x20, 0x6b, 0x65, 0x79, 0x3b };
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
- return 0;
+ return 0;
ThreadVars tv;
DecodeThreadVars dtv;
memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&tv, 0, sizeof(ThreadVars));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
if (PacketCopyData(p, raw_ip, sizeof(raw_ip)) == -1) {
- SCFree(p);
- return 1;
+ SCFree(p);
+ return 1;
}
FlowInitConfig(FLOW_QUIET);
-/* Copyright (C) 2007-2011 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
0x8a, 0xaf, 0x00, 0x00, 0x02, 0x04, 0x05, 0xb4,
0x04, 0x02, 0x08, 0x0a, 0x00, 0x62, 0x88, 0x28,
0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x02};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
IPV4Hdr ip4h;
DecodeThreadVars dtv;
memset(&tv, 0, sizeof(ThreadVars));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&ip4h, 0, sizeof(IPV4Hdr));
0x8a, 0xaf, 0x00, 0x00, 0x02, 0x04, 0x05, 0xb4,
0x04, 0x02, 0x08, 0x0a, 0x00, 0x62, 0x88, 0x28,
0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x0f};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
IPV4Hdr ip4h;
DecodeThreadVars dtv;
memset(&tv, 0, sizeof(ThreadVars));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&ip4h, 0, sizeof(IPV4Hdr));
0xdd, 0xa3, 0x6f, 0xf8, 0x80, 0x10, 0x05, 0xb4,
0x7c, 0x70, 0x00, 0x00, 0x01, 0x01, 0x08, 0x0a,
0x00, 0x62, 0x88, 0x9e, 0x00, 0x00, 0x00, 0x00};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
IPV4Hdr ip4h;
DecodeThreadVars dtv;
memset(&tv, 0, sizeof(ThreadVars));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&ip4h, 0, sizeof(IPV4Hdr));
static uint8_t raw_tcp_sack[] = {
0xf1, 0x59, 0x13, 0xfc, 0xf1, 0x59, 0x1f, 0x64,
0xf1, 0x59, 0x08, 0x94, 0xf1, 0x59, 0x0e, 0x48 };
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
IPV4Hdr ip4h;
DecodeThreadVars dtv;
memset(&tv, 0, sizeof(ThreadVars));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&ip4h, 0, sizeof(IPV4Hdr));
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
*/
static int DecodeVLANtest01 (void) {
uint8_t raw_vlan[] = { 0x00, 0x20, 0x08 };
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
ThreadVars tv;
DecodeThreadVars dtv;
memset(&tv, 0, sizeof(ThreadVars));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&dtv, 0, sizeof(DecodeThreadVars));
DecodeVLAN(&tv, &dtv, p, raw_vlan, sizeof(raw_vlan), NULL);
0x4d, 0x3d, 0x5a, 0x61, 0x80, 0x10, 0x6b, 0x50,
0x3c, 0x4c, 0x00, 0x00, 0x01, 0x01, 0x08, 0x0a,
0x00, 0x04, 0xf0, 0xc8, 0x01, 0x99, 0xa3, 0xf3};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
ThreadVars tv;
DecodeThreadVars dtv;
memset(&tv, 0, sizeof(ThreadVars));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&dtv, 0, sizeof(DecodeThreadVars));
DecodeVLAN(&tv, &dtv, p, raw_vlan, sizeof(raw_vlan), NULL);
0x4d, 0x3d, 0x5a, 0x61, 0x80, 0x10, 0x6b, 0x50,
0x3c, 0x4c, 0x00, 0x00, 0x01, 0x01, 0x08, 0x0a,
0x00, 0x04, 0xf0, 0xc8, 0x01, 0x99, 0xa3, 0xf3};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
ThreadVars tv;
DecodeThreadVars dtv;
memset(&tv, 0, sizeof(ThreadVars));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&dtv, 0, sizeof(DecodeThreadVars));
FlowInitConfig(FLOW_QUIET);
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
sizeof(pkt11)
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
DecodeThreadVars dtv;
int i;
for (i = 0;i < 11;i++) {
memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
+ PACKET_INITIALIZE(p);
DecodeEthernet(&th_v, &dtv, p, pkts[i], pktssizes[i], NULL);
SigMatchSignatures(&th_v, de_ctx, det_ctx, p);
sizeof(pkt11)
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
DecodeThreadVars dtv;
/* Decode the packets, and test the matches*/
for (i = 0;i < 11;i++) {
memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
+ PACKET_INITIALIZE(p);
DecodeEthernet(&th_v, &dtv, p, pkts[i], pktssizes[i], NULL);
SigMatchSignatures(&th_v, de_ctx, det_ctx, p);
sizeof(pkt11)
};
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
DecodeThreadVars dtv;
/* Decode the packets, and test the matches*/
for (i = 0;i < 11;i++) {
memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
+ PACKET_INITIALIZE(p);
DecodeEthernet(&th_v, &dtv, p, pkts[i], pktssizes[i], NULL);
SigMatchSignatures(&th_v, de_ctx, det_ctx, p);
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
0x51, 0xa6, 0xbb, 0x35, 0x59, 0x8a, 0x5a, 0xe2,
0x00, 0x14, 0x00, 0x00 };
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
Signature *s = NULL;
DetectEngineThreadCtx *det_ctx = NULL;
IPV4Hdr ip4h;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&ip4h, 0, sizeof(IPV4Hdr));
memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&th_v, 0, sizeof(ThreadVars));
-/* Copyright (C) 2012 Open Information Security Foundation
+/* Copyright (C) 2012-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
static int DetectL3protoTestSig1(void) {
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
- return 0;
+ return 0;
Signature *s = NULL;
ThreadVars th_v;
DetectEngineThreadCtx *det_ctx;
IPV4Hdr ip4h;
memset(&th_v, 0, sizeof(th_v));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
p->src.family = AF_INET;
p->dst.family = AF_INET;
static int DetectL3protoTestSig2(void) {
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
- return 0;
+ return 0;
Signature *s = NULL;
ThreadVars th_v;
DetectEngineThreadCtx *det_ctx;
IPV6Hdr ip6h;
memset(&th_v, 0, sizeof(th_v));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
p->src.family = AF_INET6;
p->dst.family = AF_INET6;
static int DetectL3protoTestSig3(void) {
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
- return 0;
+ return 0;
Signature *s = NULL;
ThreadVars th_v;
DetectEngineThreadCtx *det_ctx;
IPV6Hdr ip6h;
memset(&th_v, 0, sizeof(th_v));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
p->src.family = AF_INET6;
p->dst.family = AF_INET6;
-/* Copyright (C) 2011 Open Information Security Foundation
+/* Copyright (C) 2011-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
int result = 0;
Packet *p = NULL;
- p = SCMalloc(SIZE_OF_PACKET);
+ p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
SCLogDebug("replace: looks like a second run");
}
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
PacketCopyData(p, raw_eth_pkt, pktsize);
memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&th_v, 0, sizeof(th_v));
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
TcpSession ssn;
ThreadVars tv;
DetectEngineThreadCtx dtx;
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
- return 0;
+ return 0;
Signature s;
SigMatch sm;
TcpStream client;
memset(&ssn, 0, sizeof(TcpSession));
memset(&tv, 0, sizeof(ThreadVars));
memset(&dtx, 0, sizeof(DetectEngineThreadCtx));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&s, 0, sizeof(Signature));
memset(&sm, 0, sizeof(SigMatch));
memset(&client, 0, sizeof(TcpStream));
TcpSession ssn;
ThreadVars tv;
DetectEngineThreadCtx dtx;
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
- return 0;
+ return 0;
Signature s;
SigMatch sm;
TcpStream client;
memset(&ssn, 0, sizeof(TcpSession));
memset(&tv, 0, sizeof(ThreadVars));
memset(&dtx, 0, sizeof(DetectEngineThreadCtx));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&s, 0, sizeof(Signature));
memset(&sm, 0, sizeof(SigMatch));
memset(&client, 0, sizeof(TcpStream));
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
static int DetectTtlTestSig1(void) {
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
- return 0;
+ return 0;
Signature *s = NULL;
ThreadVars th_v;
DetectEngineThreadCtx *det_ctx;
IPV4Hdr ip4h;
memset(&th_v, 0, sizeof(th_v));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&ip4h, 0, sizeof(ip4h));
p->src.family = AF_INET;
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
static int StreamTcpReassembleStreamTest(TcpStream *stream) {
TcpSession ssn;
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
- return 0;
+ return 0;
Flow f;
uint8_t payload[4];
TCPHdr tcph;
memset(&pq,0,sizeof(PacketQueue));
memset(&ssn, 0, sizeof (TcpSession));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&f, 0, sizeof (Flow));
memset(&tcph, 0, sizeof (TCPHdr));
ThreadVars tv;
static int StreamTcpTestStartsBeforeListSegment(TcpStream *stream) {
TcpSession ssn;
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
Flow f;
memset(&pq,0,sizeof(PacketQueue));
memset(&ssn, 0, sizeof (TcpSession));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&f, 0, sizeof (Flow));
memset(&tcph, 0, sizeof (TCPHdr));
static int StreamTcpTestStartsAtSameListSegment(TcpStream *stream) {
TcpSession ssn;
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
Flow f;
StreamMsgQueueSetMinChunkLen(FLOW_PKT_TOCLIENT, 4096);
memset(&ssn, 0, sizeof (TcpSession));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&f, 0, sizeof (Flow));
memset(&tcph, 0, sizeof (TCPHdr));
ThreadVars tv;
static int StreamTcpTestStartsAfterListSegment(TcpStream *stream) {
TcpSession ssn;
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
Flow f;
StreamMsgQueueSetMinChunkLen(FLOW_PKT_TOCLIENT, 4096);
memset(&ssn, 0, sizeof (TcpSession));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&f, 0, sizeof (Flow));
memset(&tcph, 0, sizeof (TCPHdr));
ThreadVars tv;
TcpSession *ssn, uint32_t seq, uint32_t ack, uint8_t *payload,
uint16_t len, uint8_t th_flags, uint8_t flowflags, uint8_t state)
{
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return -1;
Flow f;
PacketQueue pq;
memset(&pq,0,sizeof(PacketQueue));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&f, 0, sizeof (Flow));
memset(&tcph, 0, sizeof (TCPHdr));
memset(&tv, 0, sizeof (ThreadVars));
static int StreamTcpReassembleTest32(void) {
TcpSession ssn;
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
Flow f;
PacketQueue pq;
memset(&pq,0,sizeof(PacketQueue));
memset(&ssn, 0, sizeof (TcpSession));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&f, 0, sizeof (Flow));
memset(&tcph, 0, sizeof (TCPHdr));
ThreadVars tv;
static int StreamTcpReassembleTest33(void) {
TcpSession ssn;
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
Flow f;
PacketQueue pq;
memset(&pq,0,sizeof(PacketQueue));
memset(&ssn, 0, sizeof (TcpSession));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&f, 0, sizeof (Flow));
memset(&tcph, 0, sizeof (TCPHdr));
ThreadVars tv;
static int StreamTcpReassembleTest34(void) {
TcpSession ssn;
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
Flow f;
PacketQueue pq;
memset(&pq,0,sizeof(PacketQueue));
memset(&ssn, 0, sizeof (TcpSession));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&f, 0, sizeof (Flow));
memset(&tcph, 0, sizeof (TCPHdr));
ThreadVars tv;
/** \test Test the bug 56 condition */
static int StreamTcpReassembleTest35(void) {
TcpSession ssn;
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
Flow f;
PacketQueue pq;
memset(&pq,0,sizeof(PacketQueue));
memset(&ssn, 0, sizeof (TcpSession));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&f, 0, sizeof (Flow));
memset(&tcph, 0, sizeof (TCPHdr));
ThreadVars tv;
/** \test Test the bug 57 condition */
static int StreamTcpReassembleTest36(void) {
TcpSession ssn;
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
Flow f;
PacketQueue pq;
memset(&pq,0,sizeof(PacketQueue));
memset(&ssn, 0, sizeof (TcpSession));
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&f, 0, sizeof (Flow));
memset(&tcph, 0, sizeof (TCPHdr));
ThreadVars tv;
PacketQueue pq;
ThreadVars tv;
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
StreamMsgQueueSetMinChunkLen(FLOW_PKT_TOSERVER, 10);
StreamMsgQueueSetMinChunkLen(FLOW_PKT_TOCLIENT, 10);
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
-
memset(&stream, 0, sizeof (TcpStream));
memset(&pq,0,sizeof(PacketQueue));
memset(&ssn, 0, sizeof (TcpSession));
static int StreamTcpReassembleTest38 (void) {
int ret = 0;
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
Flow f;
Port dp;
struct in_addr in;
TcpSession ssn;
-
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
PacketQueue pq;
memset(&pq,0,sizeof(PacketQueue));
memset(&f, 0, sizeof (Flow));
SCEnter();
int ret = 0;
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
Flow *f = NULL;
TCPHdr tcph;
TcpSession ssn;
-
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
PacketQueue pq;
memset(&pq,0,sizeof(PacketQueue));
memset(&tcph, 0, sizeof (TCPHdr));
static int StreamTcpReassembleTest40 (void) {
int ret = 0;
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
Flow *f = NULL;
TCPHdr tcph;
TcpSession ssn;
-
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
PacketQueue pq;
memset(&pq,0,sizeof(PacketQueue));
memset(&tcph, 0, sizeof (TCPHdr));
static int StreamTcpReassembleTest41 (void) {
int ret = 0;
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
Flow *f = NULL;
TCPHdr tcph;
TcpSession ssn;
-
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
PacketQueue pq;
memset(&pq,0,sizeof(PacketQueue));
memset(&tcph, 0, sizeof (TCPHdr));
static int StreamTcpReassembleTest43 (void) {
int ret = 0;
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
Flow *f = NULL;
TCPHdr tcph;
TcpSession ssn;
-
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
PacketQueue pq;
memset(&pq,0,sizeof(PacketQueue));
memset(&tcph, 0, sizeof (TCPHdr));
static int StreamTcpReassembleTest45 (void) {
int ret = 0;
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
Flow *f = NULL;
TCPHdr tcph;
TcpSession ssn;
-
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
PacketQueue pq;
memset(&pq,0,sizeof(PacketQueue));
memset(&tcph, 0, sizeof (TCPHdr));
static int StreamTcpReassembleTest46 (void) {
int ret = 0;
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
Flow *f = NULL;
TCPHdr tcph;
TcpSession ssn;
ThreadVars tv;
-
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
PacketQueue pq;
memset(&pq,0,sizeof(PacketQueue));
memset(&tcph, 0, sizeof (TCPHdr));
static int StreamTcpReassembleTest47 (void) {
int ret = 0;
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
Flow *f = NULL;
TCPHdr tcph;
TcpSession ssn;
ThreadVars tv;
-
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
PacketQueue pq;
memset(&pq,0,sizeof(PacketQueue));
memset(&tcph, 0, sizeof (TCPHdr));
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
SCLogDebug("preallocating packets... packet size %" PRIuMAX "", (uintmax_t)SIZE_OF_PACKET);
int i = 0;
for (i = 0; i < max_pending_packets; i++) {
- /* XXX pkt alloc function */
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL)) {
SCLogError(SC_ERR_FATAL, "Fatal error encountered while allocating a packet. Exiting...");
exit(EXIT_FAILURE);
}
- memset(p, 0, SIZE_OF_PACKET);
- PACKET_INITIALIZE(p);
-
PacketPoolStorePacket(p);
}
SCLogInfo("preallocated %"PRIiMAX" packets. Total memory %"PRIuMAX"",
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
pb->packets_offset_buffer[0] = 0;
pb->packets_payload_offset_buffer[0] = 0;
- p = SCMalloc(SIZE_OF_PACKET);
+ p = PacketGetFromAlloc();
if (unlikely(p == NULL))
goto end;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
pb->packets_address_buffer[0] = p;
p->payload_len = strlen(string);
memset(p, 0, sizeof(p));
for (i = 0; i < no_of_pkts; i++) {
- p[i] = SCMalloc(SIZE_OF_PACKET);
+ p[i] = PacketGetFromAlloc();
if (p[i] == NULL) {
printf("error allocating memory\n");
exit(EXIT_FAILURE);
}
- memset(p[i], 0, SIZE_OF_PACKET);
- p[i]->pkt = (uint8_t *)(p[i] + 1);
DecodeEthernet(&tv, &dtv, p[i], raw_eth, sizeof(raw_eth), NULL);
}
FlowInitConfig(FLOW_QUIET);
for (i = 0; i < no_of_pkts; i++) {
- p[i] = SCMalloc(SIZE_OF_PACKET);
+ p[i] = PacketGetFromAlloc();
if (p[i] == NULL) {
printf("error allocating memory\n");
exit(EXIT_FAILURE);
}
- memset(p[i], 0, SIZE_OF_PACKET);
- p[i]->pkt = (uint8_t *)(p[i] + 1);
DecodeEthernet(&tv, &dtv, p[i], raw_eth, sizeof(raw_eth), NULL);
}
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
uint16_t sport, uint16_t dport) {
uint32_t in[4];
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return NULL;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
TimeSet(&p->ts);
uint16_t sport, uint16_t dport) {
struct in_addr in;
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return NULL;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = ((uint8_t *)p) + sizeof(*p);
struct timeval tv;
TimeGet(&tv);
int i = 0;
for (; i < numpkts; i++) {
- p[i] = SCMalloc(SIZE_OF_PACKET);
+ p[i] = PacketGetFromAlloc();
if (p[i] == NULL) {
SCFree(p);
return NULL;
}
- memset(p[i], 0, SIZE_OF_PACKET);
- p[i]->pkt = (uint8_t *)(p[i] + 1);
DecodeEthernet(&th_v, &dtv, p[i], raw_eth[i], pktsize[i], NULL);
}
return p;
Packet *UTHBuildPacketFromEth(uint8_t *raw_eth, uint16_t pktsize) {
DecodeThreadVars dtv;
ThreadVars th_v;
- Packet *p = SCMalloc(SIZE_OF_PACKET);
+ Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return NULL;
- memset(p, 0, SIZE_OF_PACKET);
- p->pkt = (uint8_t *)(p + 1);
memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&th_v, 0, sizeof(th_v));