decode/ipv4: unittest to show parsing issue

pull/4243/head
Victor Julien 6 years ago
parent 922f4f7d78
commit 7bb3dfcfc8

@ -1631,6 +1631,36 @@ end:
return result;
}
/**
*/
static int DecodeEthernetTestIPv4Opt(void)
{
uint8_t raw_eth[] = {
0xae, 0x71, 0x00, 0x00, 0x00, 0x4b, 0x06, 0x90, 0x61, 0x02, 0x00, 0xcd, 0x88, 0x64, 0x11, 0x00,
0x15, 0x00, 0x80, 0x64, 0x00, 0x21, 0x4c, 0x00, 0x00, 0x30, 0x42, 0xd6, 0xff, 0xff, 0xbd, 0x2f,
0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
0x01, 0x44, 0x05, 0x22, 0x02, 0x01
};
DefragInit();
Packet *p = SCMalloc(SIZE_OF_PACKET);
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), NULL);
SCFree(p);
DefragDestroy();
PASS;
}
#endif /* UNITTESTS */
void DecodeIPV4RegisterTests(void)
@ -1674,6 +1704,7 @@ void DecodeIPV4RegisterTests(void)
UtRegisterTest("DecodeIPV4DefragTest01", DecodeIPV4DefragTest01);
UtRegisterTest("DecodeIPV4DefragTest02", DecodeIPV4DefragTest02);
UtRegisterTest("DecodeIPV4DefragTest03", DecodeIPV4DefragTest03);
UtRegisterTest("DecodeEthernetTestIPv4Opt", DecodeEthernetTestIPv4Opt);
#endif /* UNITTESTS */
}
/**

Loading…
Cancel
Save