49 static void DecodePartialIPV6(
Packet *p, uint8_t *partial_packet, uint16_t
len )
61 if(((icmp6_ip6h->s_ip6_vfc & 0xf0) >> 4) != 6)
63 SCLogDebug(
"ICMPv6 contains Unknown IPV6 version "
64 "ICMPV6_IPV6_UNKNOWN_VER");
86 switch (icmp6_ip6h->s_ip6_nxt) {
98 "header Didn't fit in the packet!");
115 "header Didn't fit in the packet!");
136 SCLogDebug(
"ICMPv6 embedding IPV6 %s->%s - CLASS: %" PRIu32
" FLOW: "
137 "%" PRIu32
" NH: %" PRIu32
" PLEN: %" PRIu32
" HLIM: %" PRIu32,
148 #define CASE_CODE(t,r) case (t): return r; case (r): return t;
179 const uint8_t *pkt, uint32_t
len)
191 p->
proto = IPPROTO_ICMPV6;
200 p->
icmp_d.type = (uint8_t)ctype;
270 SCLogDebug(
"ICMP6_ECHO_REQUEST id: %u seq: %u",
492 SCLogDebug(
"ICMPV6 Message type %" PRIu8
" not "
502 p->
payload = (uint8_t *)pkt + 4;
511 SCLogDebug(
"Unknown Code, ICMPV6_UNKNOWN_CODE");
514 SCLogDebug(
"Unknown Type, ICMPV6_UNKNOWN_TYPE");
526 static int ICMPV6CalculateValidChecksumtest01(
void)
530 uint8_t raw_ipv6[] = {
531 0x00, 0x00, 0x86, 0x05, 0x80, 0xda, 0x00, 0x60,
532 0x97, 0x07, 0x69, 0xea, 0x86, 0xdd, 0x60, 0x00,
533 0x00, 0x00, 0x00, 0x44, 0x3a, 0x40, 0x3f, 0xfe,
534 0x05, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x60,
535 0x97, 0xff, 0xfe, 0x07, 0x69, 0xea, 0x3f, 0xfe,
536 0x05, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00,
537 0x86, 0xff, 0xfe, 0x05, 0x80, 0xda, 0x03, 0x00,
538 0xf7, 0x52, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
539 0x00, 0x00, 0x00, 0x14, 0x11, 0x01, 0x3f, 0xfe,
540 0x05, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00,
541 0x86, 0xff, 0xfe, 0x05, 0x80, 0xda, 0x3f, 0xfe,
542 0x05, 0x01, 0x04, 0x10, 0x00, 0x00, 0x02, 0xc0,
543 0xdf, 0xff, 0xfe, 0x47, 0x03, 0x3e, 0xa0, 0x75,
544 0x82, 0x9b, 0x00, 0x14, 0x82, 0x8b, 0x01, 0x01,
545 0x00, 0x00, 0xf9, 0xc8, 0xe7, 0x36, 0xf5, 0xed,
548 csum = *( ((uint16_t *)(raw_ipv6 + 56)));
550 FAIL_IF(csum != ICMPV6CalculateChecksum((uint16_t *)(raw_ipv6 + 14 + 8),
551 (uint16_t *)(raw_ipv6 + 54), 68));
555 static int ICMPV6CalculateInvalidChecksumtest02(
void)
559 uint8_t raw_ipv6[] = {
560 0x00, 0x00, 0x86, 0x05, 0x80, 0xda, 0x00, 0x60,
561 0x97, 0x07, 0x69, 0xea, 0x86, 0xdd, 0x60, 0x00,
562 0x00, 0x00, 0x00, 0x44, 0x3a, 0x40, 0x3f, 0xfe,
563 0x05, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x60,
564 0x97, 0xff, 0xfe, 0x07, 0x69, 0xea, 0x3f, 0xfe,
565 0x05, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00,
566 0x86, 0xff, 0xfe, 0x05, 0x80, 0xda, 0x03, 0x00,
567 0xf7, 0x52, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00,
568 0x00, 0x00, 0x00, 0x14, 0x11, 0x01, 0x3f, 0xfe,
569 0x05, 0x07, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00,
570 0x86, 0xff, 0xfe, 0x05, 0x80, 0xda, 0x3f, 0xfe,
571 0x05, 0x01, 0x04, 0x10, 0x00, 0x00, 0x02, 0xc0,
572 0xdf, 0xff, 0xfe, 0x47, 0x03, 0x3e, 0xa0, 0x75,
573 0x82, 0x9b, 0x00, 0x14, 0x82, 0x8b, 0x01, 0x01,
574 0x00, 0x00, 0xf9, 0xc8, 0xe7, 0x36, 0xf5, 0xed,
577 csum = *( ((uint16_t *)(raw_ipv6 + 56)));
579 FAIL_IF(csum == ICMPV6CalculateChecksum((uint16_t *)(raw_ipv6 + 14 + 8),
580 (uint16_t *)(raw_ipv6 + 54), 68));
588 static int ICMPV6ParamProbTest01(
void)
590 static uint8_t raw_ipv6[] = {
591 0x60, 0x00, 0x00, 0x00, 0x00, 0x38, 0x3a, 0xff,
592 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
593 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
594 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
595 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
596 0x04, 0x00, 0xcc, 0x2a, 0x6d, 0x93, 0x0b, 0xdf,
597 0x69, 0x70, 0x12, 0xb7, 0x00, 0x08, 0x3a, 0xff,
598 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
599 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
600 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
601 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
602 0x80, 0x00, 0x08, 0xb5, 0x99, 0xc3, 0xde, 0x40 };
611 ipv6src = (uint32_t*) &raw_ipv6[8];
612 ipv6dst = (uint32_t*) &raw_ipv6[24];
616 memset(&ip6h, 0,
sizeof(
IPV6Hdr));
629 for (i = 0; i < 4; i++) {
644 static int ICMPV6PktTooBigTest01(
void)
646 static uint8_t raw_ipv6[] = {
647 0x60, 0x00, 0x00, 0x00, 0x00, 0x30, 0x3a, 0xff,
648 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
649 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
650 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
651 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
652 0x02, 0x00, 0x5c, 0x7a, 0x00, 0x00, 0x05, 0x00,
653 0x64, 0x14, 0xfd, 0xff, 0x00, 0x00, 0x3b, 0xff,
654 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
655 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
656 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
657 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 };
666 ipv6src = (uint32_t*) &raw_ipv6[8];
667 ipv6dst = (uint32_t*) &raw_ipv6[24];
671 memset(&ip6h, 0,
sizeof(
IPV6Hdr));
685 for (i = 0; i < 4; i++) {
690 SCLogDebug(
"ICMPV6 IPV6 src and dst properly set");
702 static int ICMPV6TimeExceedTest01(
void)
704 static uint8_t raw_ipv6[] = {
705 0x60, 0x00, 0x00, 0x00, 0x00, 0x30, 0x3a, 0xff,
706 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
707 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
708 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
709 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
710 0x03, 0x00, 0x56, 0x2d, 0x00, 0x00, 0x00, 0x00,
711 0x6d, 0x23, 0xff, 0x3d, 0x00, 0x00, 0x3b, 0xff,
712 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
713 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
714 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
715 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 };
724 ipv6src = (uint32_t*) &raw_ipv6[8];
725 ipv6dst = (uint32_t*) &raw_ipv6[24];
729 memset(&ip6h, 0,
sizeof(
IPV6Hdr));
743 for (i = 0; i < 4; i++) {
748 SCLogDebug(
"ICMPV6 IPV6 src and dst properly set");
760 static int ICMPV6DestUnreachTest01(
void)
762 static uint8_t raw_ipv6[] = {
763 0x60, 0x00, 0x00, 0x00, 0x00, 0x30, 0x3a, 0xff,
764 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
765 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
766 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
767 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
768 0x01, 0x00, 0x7b, 0x85, 0x00, 0x00, 0x00, 0x00,
769 0x60, 0x4b, 0xe8, 0xbd, 0x00, 0x00, 0x3b, 0xff,
770 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
771 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
772 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
773 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 };
782 ipv6src = (uint32_t*) &raw_ipv6[8];
783 ipv6dst = (uint32_t*) &raw_ipv6[24];
787 memset(&ip6h, 0,
sizeof(
IPV6Hdr));
801 for (i = 0; i < 4; i++) {
815 static int ICMPV6EchoReqTest01(
void)
817 static uint8_t raw_ipv6[] = {
818 0x60, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3a, 0xff,
819 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
820 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
821 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
822 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
823 0x80, 0x00, 0xe5, 0xa5, 0x25, 0xf0, 0x75, 0x23 };
833 memset(&ip6h, 0,
sizeof(
IPV6Hdr));
844 printf(
"ICMPv6 Echo reply decode failed TYPE %u CODE %u ID %04x(%u) SEQ %04x(%u): ",
859 static int ICMPV6EchoRepTest01(
void)
861 static uint8_t raw_ipv6[] = {
862 0x60, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3a,
863 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
864 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
865 0x00, 0x00, 0x00, 0xff, 0x02, 0x00, 0x00,
866 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
867 0x00, 0x00, 0x00, 0x00, 0x01, 0x81, 0x00,
868 0xe5, 0xa5, 0x25, 0xf0, 0x75, 0x23 };
878 memset(&ip6h, 0,
sizeof(
IPV6Hdr));
890 printf(
"ICMPv6 Echo reply decode failed TYPE %u CODE %u ID %04x(%u) SEQ %04x(%u): ",
906 static int ICMPV6ParamProbTest02(
void)
908 static uint8_t raw_ipv6[] = {
909 0x60, 0x00, 0x00, 0x00, 0x00, 0x38, 0x3a, 0xff,
910 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
911 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
912 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
913 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
914 0x04, 0x00, 0xcc, 0x2a, 0x6d, 0x93, 0x0b, 0xdf,
915 0x38, 0x70, 0x12, 0xb7, 0x00, 0x08, 0x3a, 0xff,
916 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
917 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
918 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
919 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
920 0x80, 0x00, 0x08, 0xb5, 0x99, 0xc3, 0xde, 0x40 };
930 memset(&ip6h, 0,
sizeof(
IPV6Hdr));
949 static int ICMPV6PktTooBigTest02(
void)
951 static uint8_t raw_ipv6[] = {
952 0x60, 0x00, 0x00, 0x00, 0x00, 0x30, 0x3a, 0xff,
953 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
954 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
955 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
956 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
957 0x02, 0x10, 0x5c, 0x7a, 0x00, 0x00, 0x05, 0x00,
958 0x64, 0x14, 0xfd, 0xff, 0x00, 0x00, 0x3b, 0xff,
959 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
960 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
961 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
962 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 };
972 memset(&ip6h, 0,
sizeof(
IPV6Hdr));
990 static int ICMPV6TimeExceedTest02(
void)
992 static uint8_t raw_ipv6[] = {
993 0x60, 0x00, 0x00, 0x00, 0x00, 0x03, 0x3a, 0xff,
994 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
995 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
996 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
997 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
1010 memset(&ip6h, 0,
sizeof(
IPV6Hdr));
1027 static int ICMPV6DestUnreachTest02(
void)
1029 static uint8_t raw_ipv6[] = {
1030 0x60, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x3a, 0xff,
1031 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1032 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1033 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1034 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
1035 0x01, 0x00, 0x7b, 0x85, 0x00, 0x00, 0x00, 0x00,
1036 0x60, 0x4b, 0xe8, 0xbd, 0x00, 0x00, 0x3b, 0xff,
1037 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1038 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1039 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1040 0x00, 0x00, 0x00, 0x00, 0x00 };
1050 memset(&ip6h, 0,
sizeof(
IPV6Hdr));
1067 static int ICMPV6EchoReqTest02(
void)
1069 static uint8_t raw_ipv6[] = {
1070 0x60, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3a,
1071 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1072 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1073 0x00, 0x00, 0x00, 0xff, 0x02, 0x00, 0x00,
1074 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1075 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x01,
1076 0xe5, 0xa5, 0x25, 0xf0, 0x75, 0x23 };
1086 memset(&ip6h, 0,
sizeof(
IPV6Hdr));
1103 static int ICMPV6EchoRepTest02(
void)
1105 static uint8_t raw_ipv6[] = {
1106 0x60, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3a,
1107 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1108 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1109 0x00, 0x00, 0x00, 0xff, 0x02, 0x00, 0x00,
1110 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1111 0x00, 0x00, 0x00, 0x00, 0x01, 0x81, 0x01,
1112 0xe5, 0xa5, 0x25, 0xf0, 0x75, 0x23 };
1122 memset(&ip6h, 0,
sizeof(
IPV6Hdr));
1138 static int ICMPV6PayloadTest01(
void)
1140 static uint8_t raw_ipv6[] = {
1141 0x60, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x3a, 0xff,
1142 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1143 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1144 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1145 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
1146 0x01, 0x00, 0x7b, 0x85, 0x00, 0x00, 0x00, 0x00,
1147 0x60, 0x4b, 0xe8, 0xbd, 0x00, 0x00, 0x3b, 0xff,
1148 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1149 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1150 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1151 0x00, 0x00, 0x00, 0x00, 0x00 };
1161 memset(&ip6h, 0,
sizeof(
IPV6Hdr));
1175 static int ICMPV6RouterSolicitTestKnownCode(
void)
1177 static uint8_t raw_ipv6[] = {
1178 0x60, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3a, 0xff,
1179 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1180 0x02, 0x24, 0x8c, 0xff, 0xfe, 0x0e, 0x31, 0x54,
1181 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1182 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
1183 0x85, 0x00, 0xbe, 0xb0, 0x00, 0x00, 0x00, 0x00
1194 memset(&ip6h, 0,
sizeof(
IPV6Hdr));
1207 static int ICMPV6RouterSolicitTestUnknownCode(
void)
1209 static uint8_t raw_ipv6[] = {
1210 0x60, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3a, 0xff,
1211 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1212 0x02, 0x24, 0x8c, 0xff, 0xfe, 0x0e, 0x31, 0x54,
1213 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1214 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
1215 0x85, 0x01, 0xbe, 0xaf, 0x00, 0x00, 0x00, 0x00
1226 memset(&ip6h, 0,
sizeof(
IPV6Hdr));
1239 static int ICMPV6RouterAdvertTestKnownCode(
void)
1241 static uint8_t raw_ipv6[] = {
1242 0x60, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3a, 0xff,
1243 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1244 0x02, 0x24, 0x8c, 0xff, 0xfe, 0x0e, 0x31, 0x54,
1245 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1246 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
1247 0x86, 0x00, 0xbd, 0xb0, 0x00, 0x00, 0x00, 0x00
1258 memset(&ip6h, 0,
sizeof(
IPV6Hdr));
1271 static int ICMPV6RouterAdvertTestUnknownCode(
void)
1273 static uint8_t raw_ipv6[] = {
1274 0x60, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3a, 0xff,
1275 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1276 0x02, 0x24, 0x8c, 0xff, 0xfe, 0x0e, 0x31, 0x54,
1277 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1278 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
1279 0x86, 0x01, 0xbd, 0xaf, 0x00, 0x00, 0x00, 0x00
1290 memset(&ip6h, 0,
sizeof(
IPV6Hdr));
1303 static int ICMPV6NeighbourSolicitTestKnownCode(
void)
1305 static uint8_t raw_ipv6[] = {
1306 0x60, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3a, 0xff,
1307 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1308 0x02, 0x24, 0x8c, 0xff, 0xfe, 0x0e, 0x31, 0x54,
1309 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1310 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
1311 0x87, 0x00, 0xbc, 0xb0, 0x00, 0x00, 0x00, 0x00
1322 memset(&ip6h, 0,
sizeof(
IPV6Hdr));
1335 static int ICMPV6NeighbourSolicitTestUnknownCode(
void)
1337 static uint8_t raw_ipv6[] = {
1338 0x60, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3a, 0xff,
1339 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1340 0x02, 0x24, 0x8c, 0xff, 0xfe, 0x0e, 0x31, 0x54,
1341 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1342 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
1343 0x87, 0x01, 0xbc, 0xaf, 0x00, 0x00, 0x00, 0x00
1354 memset(&ip6h, 0,
sizeof(
IPV6Hdr));
1367 static int ICMPV6NeighbourAdvertTestKnownCode(
void)
1369 static uint8_t raw_ipv6[] = {
1370 0x60, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3a, 0xff,
1371 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1372 0x02, 0x24, 0x8c, 0xff, 0xfe, 0x0e, 0x31, 0x54,
1373 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1374 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
1375 0x88, 0x00, 0xbb, 0xb0, 0x00, 0x00, 0x00, 0x00
1386 memset(&ip6h, 0,
sizeof(
IPV6Hdr));
1399 static int ICMPV6NeighbourAdvertTestUnknownCode(
void)
1401 static uint8_t raw_ipv6[] = {
1402 0x60, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3a, 0xff,
1403 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1404 0x02, 0x24, 0x8c, 0xff, 0xfe, 0x0e, 0x31, 0x54,
1405 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1406 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
1407 0x88, 0x01, 0xbb, 0xaf, 0x00, 0x00, 0x00, 0x00
1418 memset(&ip6h, 0,
sizeof(
IPV6Hdr));
1431 static int ICMPV6RedirectTestKnownCode(
void)
1433 static uint8_t raw_ipv6[] = {
1434 0x60, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3a, 0xff,
1435 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1436 0x02, 0x24, 0x8c, 0xff, 0xfe, 0x0e, 0x31, 0x54,
1437 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1438 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
1439 0x89, 0x00, 0xba, 0xb0, 0x00, 0x00, 0x00, 0x00
1450 memset(&ip6h, 0,
sizeof(
IPV6Hdr));
1463 static int ICMPV6RedirectTestUnknownCode(
void)
1465 static uint8_t raw_ipv6[] = {
1466 0x60, 0x00, 0x00, 0x00, 0x00, 0x08, 0x3a, 0xff,
1467 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1468 0x02, 0x24, 0x8c, 0xff, 0xfe, 0x0e, 0x31, 0x54,
1469 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1470 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
1471 0x89, 0x01, 0xba, 0xaf, 0x00, 0x00, 0x00, 0x00
1482 memset(&ip6h, 0,
sizeof(
IPV6Hdr));
1502 static int ICMPV6CalculateValidChecksumWithFCS(
void)
1507 uint8_t raw_ipv6[] = {
1508 0x33, 0x33, 0x00, 0x00, 0x00, 0x16, 0x00, 0x50,
1509 0x56, 0xa6, 0x6a, 0x7d, 0x86, 0xdd, 0x60, 0x00,
1510 0x00, 0x00, 0x00, 0x24, 0x00, 0x01, 0xfe, 0x80,
1511 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0x09,
1512 0xad, 0x44, 0x49, 0x38, 0x5f, 0xa9, 0xff, 0x02,
1513 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1514 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x3a, 0x00,
1515 0x05, 0x02, 0x00, 0x00, 0x01, 0x00, 0x8f, 0x00,
1516 0x24, 0xe0, 0x00, 0x00, 0x00, 0x01, 0x03, 0x00,
1517 0x00, 0x00, 0xff, 0x02, 0x00, 0x00, 0x00, 0x00,
1518 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1519 0x00, 0xfb, 0x1f, 0x34, 0xf6, 0xa4
1521 uint16_t csum = *(((uint16_t *)(raw_ipv6 + 64)));
1531 memset(&ip6h, 0,
sizeof(
IPV6Hdr));
1540 FAIL_IF(ICMPV6CalculateChecksum(p->
ip6h->s_ip6_addrs,
1541 (uint16_t *)p->
icmpv6h, icmpv6_len) != csum);
1558 ICMPV6CalculateValidChecksumtest01);
1559 UtRegisterTest(
"ICMPV6CalculateInvalidChecksumtest02", ICMPV6CalculateInvalidChecksumtest02);
1561 UtRegisterTest(
"ICMPV6ParamProbTest01 (Valid)", ICMPV6ParamProbTest01);
1562 UtRegisterTest(
"ICMPV6DestUnreachTest01 (Valid)", ICMPV6DestUnreachTest01);
1563 UtRegisterTest(
"ICMPV6PktTooBigTest01 (Valid)", ICMPV6PktTooBigTest01);
1564 UtRegisterTest(
"ICMPV6TimeExceedTest01 (Valid)", ICMPV6TimeExceedTest01);
1565 UtRegisterTest(
"ICMPV6EchoReqTest01 (Valid)", ICMPV6EchoReqTest01);
1566 UtRegisterTest(
"ICMPV6EchoRepTest01 (Valid)", ICMPV6EchoRepTest01);
1568 UtRegisterTest(
"ICMPV6ParamProbTest02 (Invalid)", ICMPV6ParamProbTest02);
1570 ICMPV6DestUnreachTest02);
1571 UtRegisterTest(
"ICMPV6PktTooBigTest02 (Invalid)", ICMPV6PktTooBigTest02);
1572 UtRegisterTest(
"ICMPV6TimeExceedTest02 (Invalid)", ICMPV6TimeExceedTest02);
1573 UtRegisterTest(
"ICMPV6EchoReqTest02 (Invalid)", ICMPV6EchoReqTest02);
1574 UtRegisterTest(
"ICMPV6EchoRepTest02 (Invalid)", ICMPV6EchoRepTest02);
1579 ICMPV6RouterSolicitTestKnownCode);
1581 ICMPV6RouterSolicitTestUnknownCode);
1583 ICMPV6RouterAdvertTestKnownCode);
1585 ICMPV6RouterAdvertTestUnknownCode);
1588 ICMPV6NeighbourSolicitTestKnownCode);
1590 ICMPV6NeighbourSolicitTestUnknownCode);
1592 ICMPV6NeighbourAdvertTestKnownCode);
1594 ICMPV6NeighbourAdvertTestUnknownCode);
1596 UtRegisterTest(
"ICMPV6RedirectTestKnownCode", ICMPV6RedirectTestKnownCode);
1598 ICMPV6RedirectTestUnknownCode);
1600 ICMPV6CalculateValidChecksumWithFCS);