49 static int IPV4OptValidateGeneric(
Packet *p,
const IPV4Opt *o)
116 if (
unlikely((ptr < 4) || (ptr % 4) || (ptr > o->
len + 1))) {
131 static int IPV4OptValidateTimestamp(
Packet *p,
const IPV4Opt *o)
155 flag = *(o->
data + 1) & 0x0f;
158 rec_size = ((flag == 1) || (flag == 3)) ? 8 : 4;
164 if (
unlikely(((ptr - 5) % rec_size) || (ptr > o->
len + 1))) {
301 for (i = 0; i <
len; i++) {
321 SCLogDebug(
"IPV4OPT %" PRIu8
" len 1 @ %d/%d",
322 *pkt, (
len - plen), (
len - 1));
326 SCLogDebug(
"IPV4OPT %" PRIu8
" len 1 @ %d/%d",
327 *pkt, (
len - plen), (
len - 1));
348 IPV4Opt opt = {*pkt, *(pkt+1), plen > 2 ? (pkt + 2) : NULL };
366 }
else if (IPV4OptValidateTimestamp(p, &opt) == 0) {
375 }
else if (IPV4OptValidateRoute(p, &opt) == 0) {
384 }
else if (IPV4OptValidateGeneric(p, &opt) == 0) {
393 }
else if (IPV4OptValidateGeneric(p, &opt) == 0) {
402 }
else if (IPV4OptValidateRoute(p, &opt) == 0) {
411 }
else if (IPV4OptValidateGeneric(p, &opt) == 0) {
420 }
else if (IPV4OptValidateCIPSO(p, &opt) == 0) {
429 }
else if (IPV4OptValidateGeneric(p, &opt) == 0) {
438 }
else if (IPV4OptValidateRoute(p, &opt) == 0) {
447 }
else if (IPV4OptValidateGeneric(p, &opt) == 0) {
453 SCLogDebug(
"IPV4OPT <unknown> (%" PRIu8
") len %" PRIu8,
468 static const IPV4Hdr *DecodeIPV4Packet(
Packet *p,
const uint8_t *pkt, uint16_t
len)
481 const IPV4Hdr *ip4h = PacketSetIPV4(p, pkt);
504 if (ip_opt_len > 0) {
506 memset(&opts, 0x00,
sizeof(opts));
507 if (DecodeIPV4Options(p, pkt +
IPV4_HEADER_LEN, ip_opt_len, &opts) < 0) {
516 const uint8_t *pkt, uint16_t
len)
522 if (!PacketIncreaseCheckLayers(p)) {
526 const IPV4Hdr *ip4h = DecodeIPV4Packet(p, pkt,
len);
552 SCLogDebug(
"IPV4 %s->%s PROTO: %" PRIu32
" OFFSET: %" PRIu32
" RF: %" PRIu8
" DF: %" PRIu8
553 " MF: %" PRIu8
" ID: %" PRIu32
"",
624 static int DecodeIPV4OptionsNONETest01(
void)
626 uint8_t raw_opts[] = { };
631 memset(&opts, 0x00,
sizeof(opts));
632 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
640 static int DecodeIPV4OptionsEOLTest01(
void)
642 uint8_t raw_opts[] = {
648 memset(&opts, 0x00,
sizeof(opts));
649 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
656 static int DecodeIPV4OptionsNOPTest01(
void)
658 uint8_t raw_opts[] = {
664 memset(&opts, 0x00,
sizeof(opts));
665 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
672 static int DecodeIPV4OptionsRRTest01(
void)
674 uint8_t raw_opts[] = {
675 IPV4_OPT_RR, 0x27, 0x08, 0xc0, 0xa8, 0x2a, 0x64, 0x00,
676 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
677 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
678 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
679 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
685 memset(&opts, 0x00,
sizeof(opts));
686 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
694 static int DecodeIPV4OptionsRRTest02(
void)
696 uint8_t raw_opts[] = {
697 IPV4_OPT_RR, 0xff, 0x08, 0xc0, 0xa8, 0x2a, 0x64, 0x00,
698 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
699 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
700 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
701 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
707 memset(&opts, 0x00,
sizeof(opts));
708 FAIL_IF(DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts) != -1);
716 static int DecodeIPV4OptionsRRTest03(
void)
718 uint8_t raw_opts[] = {
719 IPV4_OPT_RR, 0x27, 0xff, 0xc0, 0xa8, 0x2a, 0x64, 0x00,
720 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
721 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
722 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
723 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
729 memset(&opts, 0x00,
sizeof(opts));
730 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
738 static int DecodeIPV4OptionsRRTest04(
void)
740 uint8_t raw_opts[] = {
741 IPV4_OPT_RR, 0x27, 0x05, 0xc0, 0xa8, 0x2a, 0x64, 0x00,
742 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
743 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
744 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
745 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
751 memset(&opts, 0x00,
sizeof(opts));
752 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
760 static int DecodeIPV4OptionsQSTest01(
void)
762 uint8_t raw_opts[] = {
763 IPV4_OPT_QS, 0x08, 0x0d, 0x00, 0xbe, 0xef, 0x00, 0x00
769 memset(&opts, 0x00,
sizeof(opts));
770 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
778 static int DecodeIPV4OptionsQSTest02(
void)
780 uint8_t raw_opts[] = {
781 IPV4_OPT_QS, 0x07, 0x0d, 0x00, 0xbe, 0xef, 0x00, 0x00
787 memset(&opts, 0x00,
sizeof(opts));
788 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
796 static int DecodeIPV4OptionsTSTest01(
void)
798 uint8_t raw_opts[] = {
799 IPV4_OPT_TS, 0x24, 0x0d, 0x01, 0x0a, 0x0a, 0x0a, 0x69,
800 0x04, 0xce, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00,
801 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
802 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
803 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
809 memset(&opts, 0x00,
sizeof(opts));
810 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
818 static int DecodeIPV4OptionsTSTest02(
void)
820 uint8_t raw_opts[] = {
821 IPV4_OPT_TS, 0x24, 0x04, 0x01, 0x0a, 0x0a, 0x0a, 0x69,
822 0x04, 0xce, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00,
823 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
824 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
825 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
831 memset(&opts, 0x00,
sizeof(opts));
832 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
840 static int DecodeIPV4OptionsTSTest03(
void)
842 uint8_t raw_opts[] = {
843 IPV4_OPT_TS, 0x24, 0xff, 0x01, 0x0a, 0x0a, 0x0a, 0x69,
844 0x04, 0xce, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00,
845 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
846 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
847 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
853 memset(&opts, 0x00,
sizeof(opts));
854 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
862 static int DecodeIPV4OptionsTSTest04(
void)
864 uint8_t raw_opts[] = {
865 IPV4_OPT_TS, 0x24, 0x0a, 0x01, 0x0a, 0x0a, 0x0a, 0x69,
866 0x04, 0xce, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00,
867 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
868 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
869 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
875 memset(&opts, 0x00,
sizeof(opts));
876 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
884 static int DecodeIPV4OptionsSECTest01(
void)
886 uint8_t raw_opts[] = {
888 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
894 memset(&opts, 0x00,
sizeof(opts));
895 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
903 static int DecodeIPV4OptionsSECTest02(
void)
905 uint8_t raw_opts[] = {
IPV4_OPT_SEC, 0x02, 0xf1, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
906 0x00, 0x00, 0x00, 0x00, 0x00 };
911 memset(&opts, 0x00,
sizeof(opts));
912 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
920 static int DecodeIPV4OptionsESECTest01(
void)
922 uint8_t raw_opts[] = {
IPV4_OPT_ESEC, 0x0b, 0xf1, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
923 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
928 memset(&opts, 0x00,
sizeof(opts));
929 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
937 static int DecodeIPV4OptionsESECTest02(
void)
939 uint8_t raw_opts[] = {
IPV4_OPT_ESEC, 0x02, 0xf1, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
940 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
945 memset(&opts, 0x00,
sizeof(opts));
946 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
954 static int DecodeIPV4OptionsLSRRTest01(
void)
956 uint8_t raw_opts[] = {
958 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
959 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
960 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
961 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
967 memset(&opts, 0x00,
sizeof(opts));
968 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
976 static int DecodeIPV4OptionsLSRRTest02(
void)
978 uint8_t raw_opts[] = {
980 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
981 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
982 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
983 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
989 memset(&opts, 0x00,
sizeof(opts));
990 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
998 static int DecodeIPV4OptionsLSRRTest03(
void)
1000 uint8_t raw_opts[] = {
1002 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1003 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1004 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1005 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1011 memset(&opts, 0x00,
sizeof(opts));
1012 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
1020 static int DecodeIPV4OptionsLSRRTest04(
void)
1022 uint8_t raw_opts[] = {
1024 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1025 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1026 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1027 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1033 memset(&opts, 0x00,
sizeof(opts));
1034 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
1042 static int DecodeIPV4OptionsCIPSOTest01(
void)
1044 uint8_t raw_opts[] = {
1046 0x00, 0x03, 0x00, 0xef, 0x00, 0xef, 0x00, 0x06,
1047 0x00, 0x04, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00
1053 memset(&opts, 0x00,
sizeof(opts));
1054 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
1062 static int DecodeIPV4OptionsSIDTest01(
void)
1064 uint8_t raw_opts[] = {
1071 memset(&opts, 0x00,
sizeof(opts));
1072 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
1080 static int DecodeIPV4OptionsSIDTest02(
void)
1082 uint8_t raw_opts[] = {
1089 memset(&opts, 0x00,
sizeof(opts));
1090 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
1098 static int DecodeIPV4OptionsSSRRTest01(
void)
1100 uint8_t raw_opts[] = {
1102 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1103 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1104 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1105 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1111 memset(&opts, 0x00,
sizeof(opts));
1112 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
1120 static int DecodeIPV4OptionsSSRRTest02(
void)
1122 uint8_t raw_opts[] = {
1124 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1125 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1126 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1127 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1133 memset(&opts, 0x00,
sizeof(opts));
1134 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
1142 static int DecodeIPV4OptionsSSRRTest03(
void)
1144 uint8_t raw_opts[] = {
1146 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1147 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1148 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1149 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1155 memset(&opts, 0x00,
sizeof(opts));
1156 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
1164 static int DecodeIPV4OptionsSSRRTest04(
void)
1166 uint8_t raw_opts[] = {
1168 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1169 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1170 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1171 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1177 memset(&opts, 0x00,
sizeof(opts));
1178 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
1186 static int DecodeIPV4OptionsRTRALTTest01(
void)
1188 uint8_t raw_opts[] = {
1195 memset(&opts, 0x00,
sizeof(opts));
1196 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
1204 static int DecodeIPV4OptionsRTRALTTest02(
void)
1206 uint8_t raw_opts[] = {
1213 memset(&opts, 0x00,
sizeof(opts));
1214 DecodeIPV4Options(p, raw_opts,
sizeof(raw_opts), &opts);
1221 static int IPV4CalculateValidChecksumtest01(
void)
1225 uint8_t raw_ipv4[] = {
1226 0x45, 0x00, 0x00, 0x54, 0x00, 0x00, 0x40, 0x00,
1227 0x40, 0x01, 0xb7, 0x52, 0xc0, 0xa8, 0x01, 0x03,
1228 0xc0, 0xa8, 0x01, 0x03};
1230 csum = *( ((uint16_t *)raw_ipv4) + 5);
1232 FAIL_IF(IPV4Checksum((uint16_t *)raw_ipv4,
sizeof(raw_ipv4), csum) != 0);
1236 static int IPV4CalculateInvalidChecksumtest02(
void)
1240 uint8_t raw_ipv4[] = {
1241 0x45, 0x00, 0x00, 0x54, 0x00, 0x00, 0x40, 0x00,
1242 0x40, 0x01, 0xb7, 0x52, 0xc0, 0xa8, 0x01, 0x03,
1243 0xc0, 0xa8, 0x01, 0x07};
1245 csum = *( ((uint16_t *)raw_ipv4) + 5);
1247 FAIL_IF(IPV4Checksum((uint16_t *)raw_ipv4,
sizeof(raw_ipv4), csum) == 0);
1254 static int DecodeIPV4DefragTest01(
void)
1257 0x00, 0x50, 0x56, 0x00, 0x03, 0x05, 0xde, 0xad,
1258 0x01, 0xa3, 0xa2, 0x2f, 0x08, 0x00, 0x45, 0x00,
1259 0x00, 0x1c, 0xe9, 0xef, 0x20, 0x00, 0x40, 0x06,
1260 0x9a, 0xc8, 0x0a, 0x00, 0xe1, 0x17, 0x0a, 0x00,
1261 0xe1, 0x0c, 0x6e, 0x12, 0x01, 0xbd, 0x5b, 0xa3,
1265 0x00, 0x50, 0x56, 0x00, 0x03, 0x05, 0xde, 0xad,
1266 0x01, 0xa3, 0xa2, 0x2f, 0x08, 0x00, 0x45, 0x00,
1267 0x00, 0x1c, 0xe9, 0xef, 0x20, 0x01, 0x40, 0x06,
1268 0x9a, 0xc7, 0x0a, 0x00, 0xe1, 0x17, 0x0a, 0x00,
1269 0xe1, 0x0c, 0xac, 0xb0, 0xae, 0x8a, 0x50, 0x10,
1273 0x00, 0x50, 0x56, 0x00, 0x03, 0x05, 0xde, 0xad,
1274 0x01, 0xa3, 0xa2, 0x2f, 0x08, 0x00, 0x45, 0x00,
1275 0x00, 0x18, 0xe9, 0xef, 0x00, 0x02, 0x40, 0x06,
1276 0xba, 0xca, 0x0a, 0x00, 0xe1, 0x17, 0x0a, 0x00,
1277 0xe1, 0x0c, 0xb1, 0xa3, 0x00, 0x00
1279 uint8_t tunnel_pkt[] = {
1280 0x00, 0x50, 0x56, 0x00, 0x03, 0x05, 0xde, 0xad,
1281 0x01, 0xa3, 0xa2, 0x2f, 0x08, 0x00, 0x45, 0x00,
1282 0x00, 0x28, 0xe9, 0xef, 0x00, 0x00, 0x40, 0x06,
1283 0xba, 0xbc, 0x0a, 0x00, 0xe1, 0x17, 0x0a, 0x00,
1284 0xe1, 0x0c, 0x6e, 0x12, 0x01, 0xbd, 0x5b, 0xa3,
1285 0x81, 0x5e, 0xac, 0xb0, 0xae, 0x8a, 0x50, 0x10,
1286 0x80, 0x00, 0xb1, 0xa3, 0x00, 0x00
1337 static int DecodeIPV4DefragTest02(
void)
1340 0x00, 0x50, 0x56, 0x00, 0x03, 0x05, 0xde, 0xad,
1341 0x01, 0xa3, 0xa2, 0x2f, 0x08, 0x00, 0x45, 0x00,
1342 0x00, 0x24, 0xe9, 0xef, 0x20, 0x00, 0x40, 0x06,
1343 0x9a, 0xc8, 0x0a, 0x00, 0xe1, 0x17, 0x0a, 0x00,
1346 0x6e, 0x12, 0x01, 0xbd, 0x5b, 0xa3,
1347 0x81, 0x5e, 0xac, 0xb0, 0xae, 0x8a, 0x50, 0x10,
1351 0x00, 0x50, 0x56, 0x00, 0x03, 0x05, 0xde, 0xad,
1352 0x01, 0xa3, 0xa2, 0x2f, 0x08, 0x00, 0x45, 0x00,
1353 0x00, 0x2c, 0xe9, 0xef, 0x20, 0x02, 0x40, 0x06,
1354 0xba, 0xca, 0x0a, 0x00, 0xe1, 0x17, 0x0a, 0x00,
1357 0xb1, 0xa3, 0x00, 0x10, 0x5b, 0xa3, 0x81, 0x5e,
1358 0xac, 0xb0, 0xae, 0x8a, 0x50, 0x10, 0x80, 0x00,
1359 0xb1, 0xa3, 0x00, 0x10, 0x01, 0x02, 0x03, 0x04
1362 0x00, 0x50, 0x56, 0x00, 0x03, 0x05, 0xde, 0xad,
1363 0x01, 0xa3, 0xa2, 0x2f, 0x08, 0x00, 0x45, 0x00,
1364 0x00, 0x16, 0xe9, 0xef, 0x00, 0x05, 0x40, 0x06,
1365 0xba, 0xca, 0x0a, 0x00, 0xe1, 0x17, 0x0a, 0x00,
1371 uint8_t tunnel_pkt[] = {
1372 0x00, 0x50, 0x56, 0x00, 0x03, 0x05, 0xde, 0xad,
1373 0x01, 0xa3, 0xa2, 0x2f, 0x08, 0x00, 0x45, 0x00,
1374 0x00, 0x3e, 0xe9, 0xef, 0x00, 0x00, 0x40, 0x06,
1375 0xba, 0xae, 0x0a, 0x00, 0xe1, 0x17, 0x0a, 0x00,
1377 0x6e, 0x12, 0x01, 0xbd, 0x5b, 0xa3, 0x81, 0x5e,
1378 0xac, 0xb0, 0xae, 0x8a, 0x50, 0x10, 0x80, 0x00,
1379 0xb1, 0xa3, 0x00, 0x10, 0x5b, 0xa3, 0x81, 0x5e,
1380 0xac, 0xb0, 0xae, 0x8a, 0x50, 0x10, 0x80, 0x00,
1381 0xb1, 0xa3, 0x00, 0x10, 0x01, 0x02, 0x03, 0x04,
1433 static int DecodeIPV4DefragTest03(
void)
1436 0x00, 0x50, 0x56, 0x00, 0x03, 0x05, 0xde, 0xad,
1437 0x01, 0xa3, 0xa2, 0x2f, 0x08, 0x00, 0x45, 0x00,
1438 0x00, 0x28, 0xe9, 0xee, 0x00, 0x00, 0x40, 0x06,
1439 0xba, 0xbd, 0x0a, 0x00, 0xe1, 0x17, 0x0a, 0x00,
1440 0xe1, 0x0c, 0x6e, 0x12, 0x01, 0xbd, 0x5b, 0xa3,
1441 0x81, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x50, 0x02,
1442 0x80, 0x00, 0x0c, 0xee, 0x00, 0x00
1445 0x00, 0x50, 0x56, 0x00, 0x03, 0x05, 0xde, 0xad,
1446 0x01, 0xa3, 0xa2, 0x2f, 0x08, 0x00, 0x45, 0x00,
1447 0x00, 0x1c, 0xe9, 0xef, 0x20, 0x00, 0x40, 0x06,
1448 0x9a, 0xc8, 0x0a, 0x00, 0xe1, 0x17, 0x0a, 0x00,
1449 0xe1, 0x0c, 0x6e, 0x12, 0x01, 0xbd, 0x5b, 0xa3,
1453 0x00, 0x50, 0x56, 0x00, 0x03, 0x05, 0xde, 0xad,
1454 0x01, 0xa3, 0xa2, 0x2f, 0x08, 0x00, 0x45, 0x00,
1455 0x00, 0x1c, 0xe9, 0xef, 0x20, 0x01, 0x40, 0x06,
1456 0x9a, 0xc7, 0x0a, 0x00, 0xe1, 0x17, 0x0a, 0x00,
1457 0xe1, 0x0c, 0xac, 0xb0, 0xae, 0x8a, 0x50, 0x10,
1461 0x00, 0x50, 0x56, 0x00, 0x03, 0x05, 0xde, 0xad,
1462 0x01, 0xa3, 0xa2, 0x2f, 0x08, 0x00, 0x45, 0x00,
1463 0x00, 0x18, 0xe9, 0xef, 0x00, 0x02, 0x40, 0x06,
1464 0xba, 0xca, 0x0a, 0x00, 0xe1, 0x17, 0x0a, 0x00,
1465 0xe1, 0x0c, 0xb1, 0xa3, 0x00, 0x00
1467 uint8_t tunnel_pkt[] = {
1468 0x00, 0x50, 0x56, 0x00, 0x03, 0x05, 0xde, 0xad,
1469 0x01, 0xa3, 0xa2, 0x2f, 0x08, 0x00, 0x45, 0x00,
1470 0x00, 0x28, 0xe9, 0xef, 0x00, 0x00, 0x40, 0x06,
1471 0xba, 0xbc, 0x0a, 0x00, 0xe1, 0x17, 0x0a, 0x00,
1472 0xe1, 0x0c, 0x6e, 0x12, 0x01, 0xbd, 0x5b, 0xa3,
1473 0x81, 0x5e, 0xac, 0xb0, 0xae, 0x8a, 0x50, 0x10,
1474 0x80, 0x00, 0xb1, 0xa3, 0x00, 0x00
1532 static int DecodeEthernetTestIPv4Opt(
void)
1534 uint8_t raw_eth[] = {
1535 0xae, 0x71, 0x00, 0x00, 0x00, 0x4b, 0x06, 0x90, 0x61, 0x02, 0x00, 0xcd, 0x88, 0x64, 0x11, 0x00,
1536 0x15, 0x00, 0x80, 0x64, 0x00, 0x21, 0x4c, 0x00, 0x00, 0x30, 0x42, 0xd6, 0xff, 0xff, 0xbd, 0x2f,
1537 0x02, 0x02, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
1538 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
1539 0x01, 0x44, 0x05, 0x22, 0x02, 0x01
1564 UtRegisterTest(
"DecodeIPV4OptionsNONETest01", DecodeIPV4OptionsNONETest01);
1565 UtRegisterTest(
"DecodeIPV4OptionsEOLTest01", DecodeIPV4OptionsEOLTest01);
1566 UtRegisterTest(
"DecodeIPV4OptionsNOPTest01", DecodeIPV4OptionsNOPTest01);
1567 UtRegisterTest(
"DecodeIPV4OptionsRRTest01", DecodeIPV4OptionsRRTest01);
1568 UtRegisterTest(
"DecodeIPV4OptionsRRTest02", DecodeIPV4OptionsRRTest02);
1569 UtRegisterTest(
"DecodeIPV4OptionsRRTest03", DecodeIPV4OptionsRRTest03);
1570 UtRegisterTest(
"DecodeIPV4OptionsRRTest04", DecodeIPV4OptionsRRTest04);
1571 UtRegisterTest(
"DecodeIPV4OptionsQSTest01", DecodeIPV4OptionsQSTest01);
1572 UtRegisterTest(
"DecodeIPV4OptionsQSTest02", DecodeIPV4OptionsQSTest02);
1573 UtRegisterTest(
"DecodeIPV4OptionsTSTest01", DecodeIPV4OptionsTSTest01);
1574 UtRegisterTest(
"DecodeIPV4OptionsTSTest02", DecodeIPV4OptionsTSTest02);
1575 UtRegisterTest(
"DecodeIPV4OptionsTSTest03", DecodeIPV4OptionsTSTest03);
1576 UtRegisterTest(
"DecodeIPV4OptionsTSTest04", DecodeIPV4OptionsTSTest04);
1577 UtRegisterTest(
"DecodeIPV4OptionsSECTest01", DecodeIPV4OptionsSECTest01);
1578 UtRegisterTest(
"DecodeIPV4OptionsSECTest02", DecodeIPV4OptionsSECTest02);
1579 UtRegisterTest(
"DecodeIPV4OptionsESECTest01", DecodeIPV4OptionsESECTest01);
1580 UtRegisterTest(
"DecodeIPV4OptionsESECTest02", DecodeIPV4OptionsESECTest02);
1581 UtRegisterTest(
"DecodeIPV4OptionsLSRRTest01", DecodeIPV4OptionsLSRRTest01);
1582 UtRegisterTest(
"DecodeIPV4OptionsLSRRTest02", DecodeIPV4OptionsLSRRTest02);
1583 UtRegisterTest(
"DecodeIPV4OptionsLSRRTest03", DecodeIPV4OptionsLSRRTest03);
1584 UtRegisterTest(
"DecodeIPV4OptionsLSRRTest04", DecodeIPV4OptionsLSRRTest04);
1586 DecodeIPV4OptionsCIPSOTest01);
1587 UtRegisterTest(
"DecodeIPV4OptionsSIDTest01", DecodeIPV4OptionsSIDTest01);
1588 UtRegisterTest(
"DecodeIPV4OptionsSIDTest02", DecodeIPV4OptionsSIDTest02);
1589 UtRegisterTest(
"DecodeIPV4OptionsSSRRTest01", DecodeIPV4OptionsSSRRTest01);
1590 UtRegisterTest(
"DecodeIPV4OptionsSSRRTest02", DecodeIPV4OptionsSSRRTest02);
1591 UtRegisterTest(
"DecodeIPV4OptionsSSRRTest03", DecodeIPV4OptionsSSRRTest03);
1592 UtRegisterTest(
"DecodeIPV4OptionsSSRRTest04", DecodeIPV4OptionsSSRRTest04);
1594 DecodeIPV4OptionsRTRALTTest01);
1596 DecodeIPV4OptionsRTRALTTest02);
1598 IPV4CalculateValidChecksumtest01);
1600 IPV4CalculateInvalidChecksumtest02);
1601 UtRegisterTest(
"DecodeIPV4DefragTest01", DecodeIPV4DefragTest01);
1602 UtRegisterTest(
"DecodeIPV4DefragTest02", DecodeIPV4DefragTest02);
1603 UtRegisterTest(
"DecodeIPV4DefragTest03", DecodeIPV4DefragTest03);
1604 UtRegisterTest(
"DecodeEthernetTestIPv4Opt", DecodeEthernetTestIPv4Opt);