Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packet alerts/v3 #6896

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/decode-chdlc.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,13 @@ static int DecodeCHDLCTest01 (void)
0x00,0x00,0x70,0x02,0x40,0x00,0x11,0x47,0x00,0x00,
0x02,0x04,0x05,0xb4,0x01,0x01,0x04,0x02 };

Packet *p = SCMalloc(SIZE_OF_PACKET);
Packet *p = PacketGetFromAlloc();
FAIL_IF_NULL(p);
ThreadVars tv;
DecodeThreadVars dtv;

memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&tv, 0, sizeof(ThreadVars));
memset(p, 0, SIZE_OF_PACKET);

DecodeCHDLC(&tv, &dtv, p, raw, sizeof(raw));

Expand Down
9 changes: 3 additions & 6 deletions src/decode-ethernet.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,14 @@ static int DecodeEthernetTest01 (void)
0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd, 0xab, 0xcd,
0xab, 0xcd };

Packet *p = SCMalloc(SIZE_OF_PACKET);
Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
ThreadVars tv;
DecodeThreadVars dtv;

memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&tv, 0, sizeof(ThreadVars));
memset(p, 0, SIZE_OF_PACKET);

DecodeEthernet(&tv, &dtv, p, raw_eth, sizeof(raw_eth));

Expand All @@ -116,14 +115,13 @@ static int DecodeEthernetTestDceTooSmall(void)
0x94, 0x56, 0x00, 0x01, 0x89, 0x03,
};

Packet *p = SCMalloc(SIZE_OF_PACKET);
Packet *p = PacketGetFromAlloc();
FAIL_IF_NULL(p);
ThreadVars tv;
DecodeThreadVars dtv;

memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&tv, 0, sizeof(ThreadVars));
memset(p, 0, SIZE_OF_PACKET);

DecodeEthernet(&tv, &dtv, p, raw_eth, sizeof(raw_eth));

Expand Down Expand Up @@ -152,14 +150,13 @@ static int DecodeEthernetTestDceNextTooSmall(void)
0x94, 0x56, 0x00, 0x01,
};

Packet *p = SCMalloc(SIZE_OF_PACKET);
Packet *p = PacketGetFromAlloc();
FAIL_IF_NULL(p);
ThreadVars tv;
DecodeThreadVars dtv;

memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&tv, 0, sizeof(ThreadVars));
memset(p, 0, SIZE_OF_PACKET);

DecodeEthernet(&tv, &dtv, p, raw_eth, sizeof(raw_eth));

Expand Down
21 changes: 7 additions & 14 deletions src/decode-icmpv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ static int DecodeICMPV4test01(void)
0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
0xab };
Packet *p = SCMalloc(SIZE_OF_PACKET);
Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
ThreadVars tv;
Expand All @@ -389,7 +389,6 @@ static int DecodeICMPV4test01(void)

memset(&ip4h, 0, sizeof(IPV4Hdr));
memset(&tv, 0, sizeof(ThreadVars));
memset(p, 0, SIZE_OF_PACKET);
memset(&ip4h, 0, sizeof(IPV4Hdr));
memset(&dtv, 0, sizeof(DecodeThreadVars));

Expand Down Expand Up @@ -431,7 +430,7 @@ static int DecodeICMPV4test02(void)
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f };
Packet *p = SCMalloc(SIZE_OF_PACKET);
Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
ThreadVars tv;
Expand All @@ -441,7 +440,6 @@ static int DecodeICMPV4test02(void)

memset(&ip4h, 0, sizeof(IPV4Hdr));
memset(&tv, 0, sizeof(ThreadVars));
memset(p, 0, SIZE_OF_PACKET);
memset(&dtv, 0, sizeof(DecodeThreadVars));

FlowInitConfig(FLOW_QUIET);
Expand Down Expand Up @@ -480,7 +478,7 @@ static int DecodeICMPV4test03(void)
0x01, 0x11, 0xde, 0xfd, 0xc0, 0xa8, 0x01, 0x0d,
0xd1, 0x55, 0xe3, 0x93, 0x8b, 0x12, 0x82, 0xaa,
0x00, 0x28, 0x7c, 0xdd };
Packet *p = SCMalloc(SIZE_OF_PACKET);
Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
ThreadVars tv;
Expand All @@ -490,7 +488,6 @@ static int DecodeICMPV4test03(void)

memset(&ip4h, 0, sizeof(IPV4Hdr));
memset(&tv, 0, sizeof(ThreadVars));
memset(p, 0, SIZE_OF_PACKET);
memset(&dtv, 0, sizeof(DecodeThreadVars));

FlowInitConfig(FLOW_QUIET);
Expand Down Expand Up @@ -560,7 +557,7 @@ static int DecodeICMPV4test04(void)
0x3e, 0x36, 0x38, 0x7c, 0x00, 0x00, 0x00, 0x00,
0xa0, 0x02, 0x16, 0xd0, 0x72, 0x04, 0x00, 0x00,
0x02, 0x04, 0x05, 0x8a, 0x04, 0x02, 0x08, 0x0a };
Packet *p = SCMalloc(SIZE_OF_PACKET);
Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
ThreadVars tv;
Expand All @@ -570,7 +567,6 @@ static int DecodeICMPV4test04(void)

memset(&ip4h, 0, sizeof(IPV4Hdr));
memset(&tv, 0, sizeof(ThreadVars));
memset(p, 0, SIZE_OF_PACKET);
memset(&dtv, 0, sizeof(DecodeThreadVars));

FlowInitConfig(FLOW_QUIET);
Expand Down Expand Up @@ -630,7 +626,7 @@ static int DecodeICMPV4test05(void)
0xd6, 0xbd, 0xc0, 0xa8, 0x02, 0x05, 0x3d, 0x23, 0xa1,
0x23, 0x04, 0x18, 0x00, 0x50, 0xd2, 0x08, 0xc2, 0x48,
};
Packet *p = SCMalloc(SIZE_OF_PACKET);
Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
ThreadVars tv;
Expand All @@ -640,7 +636,6 @@ static int DecodeICMPV4test05(void)

memset(&ip4h, 0, sizeof(IPV4Hdr));
memset(&tv, 0, sizeof(ThreadVars));
memset(p, 0, SIZE_OF_PACKET);
memset(&dtv, 0, sizeof(DecodeThreadVars));

FlowInitConfig(FLOW_QUIET);
Expand Down Expand Up @@ -737,7 +732,7 @@ static int ICMPV4InvalidType07(void)
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x38};

Packet *p = SCMalloc(SIZE_OF_PACKET);
Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
ThreadVars tv;
Expand All @@ -747,7 +742,6 @@ static int ICMPV4InvalidType07(void)

memset(&ip4h, 0, sizeof(IPV4Hdr));
memset(&tv, 0, sizeof(ThreadVars));
memset(p, 0, SIZE_OF_PACKET);
memset(&dtv, 0, sizeof(DecodeThreadVars));

FlowInitConfig(FLOW_QUIET);
Expand Down Expand Up @@ -781,7 +775,7 @@ static int DecodeICMPV4test08(void)
uint8_t raw_icmpv4[] = {
0x08, 0x00, 0x78, 0x47, 0xfc, 0x55, 0x00, 0x00
};
Packet *p = SCMalloc(SIZE_OF_PACKET);
Packet *p = PacketGetFromAlloc();
if (unlikely(p == NULL))
return 0;
ThreadVars tv;
Expand All @@ -791,7 +785,6 @@ static int DecodeICMPV4test08(void)

memset(&ip4h, 0, sizeof(IPV4Hdr));
memset(&tv, 0, sizeof(ThreadVars));
memset(p, 0, SIZE_OF_PACKET);
memset(&dtv, 0, sizeof(DecodeThreadVars));

FlowInitConfig(FLOW_QUIET);
Expand Down
Loading