56 for (i = 0; i < 4; i++) {
70 for (i = 0; i < 4; i++) {
94 for (i = 0; i < 4; i++) {
108 for (i = 0; i < 4; i++) {
132 for (i = 0; i < 4; i++) {
133 if (a->addr_data32[i] != b->addr_data32[i])
144 for (i = 0; i < 4; i++) {
259 SCLogDebug(
"Internal Error: should be unreachable\n");
274 static void AddressCutIPv6CopySubOne(uint32_t *a, uint32_t *b)
310 static void AddressCutIPv6CopyAddOne(uint32_t *a, uint32_t *b)
345 static void AddressCutIPv6Copy(uint32_t *a, uint32_t *b)
379 AddressCutIPv6Copy(a_ip1, a->
ip.addr_data32);
380 AddressCutIPv6CopySubOne(b_ip1, a->
ip2.addr_data32);
382 AddressCutIPv6Copy(b_ip1, b->
ip.addr_data32);
383 AddressCutIPv6Copy(a_ip2, b->
ip2.addr_data32);
391 AddressCutIPv6CopyAddOne(a_ip2, tmp_c->
ip.addr_data32);
392 AddressCutIPv6Copy(b_ip2, tmp_c->
ip2.addr_data32);
402 AddressCutIPv6Copy(b_ip1, a->
ip.addr_data32);
403 AddressCutIPv6CopySubOne(a_ip1, a->
ip2.addr_data32);
405 AddressCutIPv6Copy(a_ip1, b->
ip.addr_data32);
406 AddressCutIPv6Copy(b_ip2, b->
ip2.addr_data32);
414 AddressCutIPv6CopyAddOne(b_ip2, tmp_c->
ip.addr_data32);
415 AddressCutIPv6Copy(a_ip2, tmp_c->
ip2.addr_data32);
434 AddressCutIPv6Copy(a_ip1, a->
ip.addr_data32);
435 AddressCutIPv6Copy(a_ip2, a->
ip2.addr_data32);
437 AddressCutIPv6CopyAddOne(a_ip2, b->
ip.addr_data32);
438 AddressCutIPv6Copy(b_ip2, b->
ip2.addr_data32);
441 AddressCutIPv6Copy(b_ip1, a->
ip.addr_data32);
442 AddressCutIPv6CopySubOne(a_ip1, a->
ip2.addr_data32);
444 AddressCutIPv6Copy(a_ip1, b->
ip.addr_data32);
445 AddressCutIPv6Copy(a_ip2, b->
ip2.addr_data32);
448 AddressCutIPv6Copy(b_ip1, a->
ip.addr_data32);
449 AddressCutIPv6CopySubOne(a_ip1, a->
ip2.addr_data32);
451 AddressCutIPv6Copy(a_ip1, b->
ip.addr_data32);
452 AddressCutIPv6Copy(a_ip2, b->
ip2.addr_data32);
460 AddressCutIPv6CopyAddOne(a_ip2, tmp_c->
ip.addr_data32);
461 AddressCutIPv6Copy(b_ip2, tmp_c->
ip2.addr_data32);
481 AddressCutIPv6Copy(b_ip1, a->
ip.addr_data32);
482 AddressCutIPv6Copy(b_ip2, a->
ip2.addr_data32);
484 AddressCutIPv6CopyAddOne(b_ip2, b->
ip.addr_data32);
485 AddressCutIPv6Copy(a_ip2, b->
ip2.addr_data32);
487 AddressCutIPv6Copy(a_ip1, a->
ip.addr_data32);
488 AddressCutIPv6CopySubOne(b_ip1, a->
ip2.addr_data32);
490 AddressCutIPv6Copy(b_ip1, b->
ip.addr_data32);
491 AddressCutIPv6Copy(b_ip2, b->
ip2.addr_data32);
493 AddressCutIPv6Copy(a_ip1, a->
ip.addr_data32);
494 AddressCutIPv6CopySubOne(b_ip1, a->
ip2.addr_data32);
496 AddressCutIPv6Copy(b_ip1, b->
ip.addr_data32);
497 AddressCutIPv6Copy(b_ip2, b->
ip2.addr_data32);
505 AddressCutIPv6CopyAddOne(b_ip2, tmp_c->
ip.addr_data32);
506 AddressCutIPv6Copy(a_ip2, tmp_c->
ip2.addr_data32);
519 DetectAddressData **c)
544 AddressCutIPv6Copy(a_ip1, a->ip);
545 AddressCutIPv6CopySubOne(b_ip1, a->ip2);
547 AddressCutIPv6Copy(b_ip1, b->ip);
548 AddressCutIPv6Copy(a_ip2, b->ip2);
550 DetectAddressData *tmp_c;
551 tmp_c = DetectAddressDataInit();
554 tmp_c->family = AF_INET6;
556 AddressCutIPv6CopyAddOne(a_ip2, tmp_c->ip);
557 AddressCutIPv6Copy(b_ip2, tmp_c->ip2);
567 AddressCutIPv6Copy(b_ip1, a->ip);
568 AddressCutIPv6CopySubOne(a_ip1, a->ip2);
570 AddressCutIPv6Copy(a_ip1, b->ip);
571 AddressCutIPv6Copy(b_ip2, b->ip2);
573 DetectAddressData *tmp_c;
574 tmp_c = DetectAddressDataInit();
577 tmp_c->family = AF_INET6;
579 AddressCutIPv6CopyAddOne(b_ip2, tmp_c->ip);
580 AddressCutIPv6Copy(a_ip2, tmp_c->ip2);
600 AddressCutIPv6Copy(a_ip1, a->ip);
601 AddressCutIPv6Copy(a_ip2, a->ip2);
603 AddressCutIPv6CopyAddOne(a_ip2, b->ip);
604 AddressCutIPv6Copy(b_ip2, b->ip2);
606 AddressCutIPv6Copy(b_ip1, a->ip);
607 AddressCutIPv6CopySubOne(a_ip1, a->ip2);
609 AddressCutIPv6Copy(a_ip1, b->ip);
610 AddressCutIPv6Copy(a_ip2, b->ip2);
612 AddressCutIPv6Copy(b_ip1, a->ip);
613 AddressCutIPv6CopySubOne(a_ip1, a->ip2);
615 AddressCutIPv6Copy(a_ip1, b->ip);
616 AddressCutIPv6Copy(a_ip2, b->ip2);
618 DetectAddressData *tmp_c;
619 tmp_c = DetectAddressDataInit();
623 tmp_c->family = AF_INET6;
625 AddressCutIPv6CopyAddOne(a_ip2, tmp_c->ip);
626 AddressCutIPv6Copy(b_ip2, tmp_c->ip2);
645 AddressCutIPv6Copy(b_ip1, a->ip);
646 AddressCutIPv6Copy(b_ip2, a->ip2);
648 AddressCutIPv6CopyAddOne(b_ip2, b->ip);
649 AddressCutIPv6Copy(a_ip2, b->ip2);
651 AddressCutIPv6Copy(a_ip1, a->ip);
652 AddressCutIPv6CopySubOne(b_ip1, a->ip2);
654 AddressCutIPv6Copy(b_ip1, b->ip);
655 AddressCutIPv6Copy(b_ip2, b->ip2);
657 AddressCutIPv6Copy(a_ip1, a->ip);
658 AddressCutIPv6CopySubOne(b_ip1, a->ip2);
660 AddressCutIPv6Copy(b_ip1, b->ip);
661 AddressCutIPv6Copy(b_ip2, b->ip2);
663 DetectAddressData *tmp_c;
664 tmp_c = DetectAddressDataInit();
667 tmp_c->family = AF_INET6;
669 AddressCutIPv6CopyAddOne(b_ip2, tmp_c->ip);
670 AddressCutIPv6Copy(a_ip2, tmp_c->ip2);
710 uint32_t ip_nul[4] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000 };
711 uint32_t ip_max[4] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
716 if (!(a_ip1[0] == 0x00000000 && a_ip1[1] == 0x00000000 &&
717 a_ip1[2] == 0x00000000 && a_ip1[3] == 0x00000000) &&
718 !(a_ip2[0] == 0xFFFFFFFF && a_ip2[1] == 0xFFFFFFFF &&
719 a_ip2[2] == 0xFFFFFFFF && a_ip2[3] == 0xFFFFFFFF)) {
720 AddressCutIPv6Copy(ip_nul, a->
ip.addr_data32);
721 AddressCutIPv6CopySubOne(a_ip1, a->
ip2.addr_data32);
728 AddressCutIPv6CopyAddOne(a_ip2, tmp_b->
ip.addr_data32);
729 AddressCutIPv6Copy(ip_max, tmp_b->
ip2.addr_data32);
731 }
else if ((a_ip1[0] == 0x00000000 && a_ip1[1] == 0x00000000 &&
732 a_ip1[2] == 0x00000000 && a_ip1[3] == 0x00000000) &&
733 !(a_ip2[0] == 0xFFFFFFFF && a_ip2[1] == 0xFFFFFFFF &&
734 a_ip2[2] == 0xFFFFFFFF && a_ip2[3] == 0xFFFFFFFF)) {
735 AddressCutIPv6CopyAddOne(a_ip2, a->
ip.addr_data32);
736 AddressCutIPv6Copy(ip_max, a->
ip2.addr_data32);
737 }
else if (!(a_ip1[0] == 0x00000000 && a_ip1[1] == 0x00000000 &&
738 a_ip1[2] == 0x00000000 && a_ip1[3] == 0x00000000) &&
739 (a_ip2[0] == 0xFFFFFFFF && a_ip2[1] == 0xFFFFFFFF &&
740 a_ip2[2] == 0xFFFFFFFF && a_ip2[3] == 0xFFFFFFFF)) {
741 AddressCutIPv6Copy(ip_nul, a->
ip.addr_data32);
742 AddressCutIPv6CopySubOne(a_ip1, a->
ip2.addr_data32);
758 static int AddressTestIPv6Gt01(
void)
762 uint32_t a[4] = { 1, 2, 3, 4 };
763 uint32_t b[4] = { 0, 2, 3, 4 };
771 static int AddressTestIPv6Gt02(
void)
775 uint32_t a[4] = { 0, 2, 3, 4 };
776 uint32_t b[4] = { 1, 2, 3, 4 };
784 static int AddressTestIPv6Gt03(
void)
788 uint32_t a[4] = { 1, 2, 3, 4 };
789 uint32_t b[4] = { 1, 2, 3, 4 };
797 static int AddressTestIPv6Gt04(
void)
801 uint32_t a[4] = { 1, 2, 3, 5 };
802 uint32_t b[4] = { 1, 2, 3, 4 };
810 static int AddressTestIPv6Lt01(
void)
814 uint32_t a[4] = { 0, 2, 3, 4 };
815 uint32_t b[4] = { 1, 2, 3, 4 };
823 static int AddressTestIPv6Lt02(
void)
827 uint32_t a[4] = { 1, 2, 3, 4 };
828 uint32_t b[4] = { 0, 2, 3, 4 };
836 static int AddressTestIPv6Lt03(
void)
840 uint32_t a[4] = { 1, 2, 3, 4 };
841 uint32_t b[4] = { 1, 2, 3, 4 };
849 static int AddressTestIPv6Lt04(
void)
853 uint32_t a[4] = { 1, 2, 3, 4 };
854 uint32_t b[4] = { 1, 2, 3, 5 };
862 static int AddressTestIPv6Eq01(
void)
866 uint32_t a[4] = { 0, 2, 3, 4 };
867 uint32_t b[4] = { 1, 2, 3, 4 };
875 static int AddressTestIPv6Eq02(
void)
879 uint32_t a[4] = { 1, 2, 3, 4 };
880 uint32_t b[4] = { 0, 2, 3, 4 };
888 static int AddressTestIPv6Eq03(
void)
892 uint32_t a[4] = { 1, 2, 3, 4 };
893 uint32_t b[4] = { 1, 2, 3, 4 };
901 static int AddressTestIPv6Eq04(
void)
905 uint32_t a[4] = { 1, 2, 3, 4 };
906 uint32_t b[4] = { 1, 2, 3, 5 };
914 static int AddressTestIPv6Le01(
void)
918 uint32_t a[4] = { 0, 2, 3, 4 };
919 uint32_t b[4] = { 1, 2, 3, 4 };
927 static int AddressTestIPv6Le02(
void)
931 uint32_t a[4] = { 1, 2, 3, 4 };
932 uint32_t b[4] = { 0, 2, 3, 4 };
940 static int AddressTestIPv6Le03(
void)
944 uint32_t a[4] = { 1, 2, 3, 4 };
945 uint32_t b[4] = { 1, 2, 3, 4 };
953 static int AddressTestIPv6Le04(
void)
957 uint32_t a[4] = { 1, 2, 3, 4 };
958 uint32_t b[4] = { 1, 2, 3, 5 };
966 static int AddressTestIPv6Le05(
void)
974 if (inet_pton(AF_INET6,
"1999:ffff:ffff:ffff:ffff:ffff:ffff:ffff", &in6) != 1)
976 memcpy(&a, &in6.s6_addr,
sizeof(in6.s6_addr));
978 if (inet_pton(AF_INET6,
"2000::0", &in6) != 1)
980 memcpy(&b, &in6.s6_addr,
sizeof(in6.s6_addr));
988 static int AddressTestIPv6Ge01(
void)
992 uint32_t a[4] = { 0, 2, 3, 4 };
993 uint32_t b[4] = { 1, 2, 3, 4 };
1001 static int AddressTestIPv6Ge02(
void)
1005 uint32_t a[4] = { 1, 2, 3, 4 };
1006 uint32_t b[4] = { 0, 2, 3, 4 };
1014 static int AddressTestIPv6Ge03(
void)
1018 uint32_t a[4] = { 1, 2, 3, 4 };
1019 uint32_t b[4] = { 1, 2, 3, 4 };
1027 static int AddressTestIPv6Ge04(
void)
1031 uint32_t a[4] = { 1, 2, 3, 4 };
1032 uint32_t b[4] = { 1, 2, 3, 5 };
1040 static int AddressTestIPv6Ge05(
void)
1046 struct in6_addr in6;
1048 if (inet_pton(AF_INET6,
"1999:ffff:ffff:ffff:ffff:ffff:ffff:ffff", &in6) != 1)
1050 memcpy(&a, &in6.s6_addr,
sizeof(in6.s6_addr));
1052 if (inet_pton(AF_INET6,
"2000::0", &in6) != 1)
1054 memcpy(&b, &in6.s6_addr,
sizeof(in6.s6_addr));
1062 static int AddressTestIPv6SubOne01(
void)
1066 uint32_t a[4], b[4];
1067 struct in6_addr in6;
1069 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1071 memcpy(a, in6.s6_addr,
sizeof(in6.s6_addr));
1078 AddressCutIPv6CopySubOne(a, b);
1080 if (inet_pton(AF_INET6,
"2000::0", &in6) != 1)
1082 memcpy(a, in6.s6_addr,
sizeof(in6.s6_addr));
1083 if (b[0] == a[0] && b[1] == a[1] &&
1084 b[2] == a[2] && b[3] == a[3]) {
1091 static int AddressTestIPv6SubOne02(
void)
1095 uint32_t a[4], b[4];
1096 struct in6_addr in6;
1098 if (inet_pton(AF_INET6,
"2000::0", &in6) != 1)
1100 memcpy(a, in6.s6_addr,
sizeof(in6.s6_addr));
1107 AddressCutIPv6CopySubOne(a, b);
1109 if (inet_pton(AF_INET6,
"1FFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF", &in6) != 1)
1111 memcpy(a, in6.s6_addr,
sizeof(in6.s6_addr));
1112 if (b[0] == a[0] && b[1] == a[1] &&
1113 b[2] == a[2] && b[3] == a[3]) {
1120 static int AddressTestIPv6AddOne01(
void)
1124 uint32_t a[4], b[4];
1125 struct in6_addr in6;
1127 if (inet_pton(AF_INET6,
"2000::0", &in6) != 1)
1129 memcpy(a, in6.s6_addr,
sizeof(in6.s6_addr));
1136 AddressCutIPv6CopyAddOne(a, b);
1138 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1140 memcpy(a, in6.s6_addr,
sizeof(in6.s6_addr));
1141 if (b[0] == a[0] && b[1] == a[1] &&
1142 b[2] == a[2] && b[3] == a[3]) {
1149 static int AddressTestIPv6AddOne02(
void)
1153 uint32_t a[4], b[4];
1154 struct in6_addr in6;
1156 if (inet_pton(AF_INET6,
"1FFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF", &in6) != 1)
1158 memcpy(a, in6.s6_addr,
sizeof(in6.s6_addr));
1165 AddressCutIPv6CopyAddOne(a, b);
1167 if (inet_pton(AF_INET6,
"2000::0", &in6) != 1)
1169 memcpy(a, in6.s6_addr,
sizeof(in6.s6_addr));
1170 if (b[0] == a[0] && b[1] == a[1] &&
1171 b[2] == a[2] && b[3] == a[3]) {
1178 static int AddressTestIPv6AddressCmp01(
void)
1182 struct in6_addr in6;
1185 if (a == NULL || b == NULL)
1188 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1190 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1191 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1193 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1194 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1196 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1197 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1199 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1202 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1204 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1205 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1207 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1208 if (inet_pton(AF_INET6,
"2000::0", &in6) != 1)
1210 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1211 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1213 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1216 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1218 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1219 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1221 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1222 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1224 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1225 if (inet_pton(AF_INET6,
"2000::11", &in6) != 1)
1227 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1230 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1232 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1233 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1235 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1236 if (inet_pton(AF_INET6,
"2000::0", &in6) != 1)
1238 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1239 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1241 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1244 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1246 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1247 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1249 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1250 if (inet_pton(AF_INET6,
"2000::0", &in6) != 1)
1252 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1253 if (inet_pton(AF_INET6,
"2000::11", &in6) != 1)
1255 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1258 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1260 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1261 if (inet_pton(AF_INET6,
"2000::11", &in6) != 1)
1263 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1264 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1266 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1267 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1269 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1272 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1274 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1275 if (inet_pton(AF_INET6,
"2000::11", &in6) != 1)
1277 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1278 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1280 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1281 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1283 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1286 if (inet_pton(AF_INET6,
"2000::0", &in6) != 1)
1288 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1289 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1291 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1292 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1294 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1295 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1297 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1300 if (inet_pton(AF_INET6,
"2000::0", &in6) != 1)
1302 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1303 if (inet_pton(AF_INET6,
"2000::11", &in6) != 1)
1305 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1306 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1308 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1309 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1311 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1314 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1316 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1317 if (inet_pton(AF_INET6,
"2000::11", &in6) != 1)
1319 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1320 if (inet_pton(AF_INET6,
"2000::0", &in6) != 1)
1322 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1323 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1325 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1328 if (inet_pton(AF_INET6,
"2000::0", &in6) != 1)
1330 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1331 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1333 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1334 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1336 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1337 if (inet_pton(AF_INET6,
"2000::20", &in6) != 1)
1339 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1342 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1344 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1345 if (inet_pton(AF_INET6,
"2000::15", &in6) != 1)
1347 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1348 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1350 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1351 if (inet_pton(AF_INET6,
"2000::20", &in6) != 1)
1353 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1356 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1358 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1359 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1361 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1362 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1364 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1365 if (inet_pton(AF_INET6,
"2000::20", &in6) != 1)
1367 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1370 if (inet_pton(AF_INET6,
"2000::0", &in6) != 1)
1372 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1373 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1375 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1376 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1378 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1379 if (inet_pton(AF_INET6,
"2000::20", &in6) != 1)
1381 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1384 if (inet_pton(AF_INET6,
"2000::0", &in6) != 1)
1386 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1387 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1389 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1390 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1392 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1393 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1395 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1398 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1400 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1401 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1403 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1404 if (inet_pton(AF_INET6,
"2000::15", &in6) != 1)
1406 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1407 if (inet_pton(AF_INET6,
"2000::20", &in6) != 1)
1409 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1412 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1414 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1415 if (inet_pton(AF_INET6,
"2000::15", &in6) != 1)
1417 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1418 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1420 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1421 if (inet_pton(AF_INET6,
"2000::20", &in6) != 1)
1423 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1427 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1429 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1430 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1432 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1433 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1435 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1436 if (inet_pton(AF_INET6,
"2000::20", &in6) != 1)
1438 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1442 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1444 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1445 if (inet_pton(AF_INET6,
"2000::19", &in6) != 1)
1447 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1448 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1450 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1451 if (inet_pton(AF_INET6,
"2000::20", &in6) != 1)
1453 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1456 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1458 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1459 if (inet_pton(AF_INET6,
"2000::20", &in6) != 1)
1461 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1462 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1464 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1465 if (inet_pton(AF_INET6,
"2000::20", &in6) != 1)
1467 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1470 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1472 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1473 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1475 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1476 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1478 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1479 if (inet_pton(AF_INET6,
"2000::20", &in6) != 1)
1481 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1484 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1486 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1487 if (inet_pton(AF_INET6,
"2000::20", &in6) != 1)
1489 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1490 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1492 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1493 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1495 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1498 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1500 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1501 if (inet_pton(AF_INET6,
"2000::20", &in6) != 1)
1503 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1504 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1506 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1507 if (inet_pton(AF_INET6,
"2000::15", &in6) != 1)
1509 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1512 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1514 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1515 if (inet_pton(AF_INET6,
"2000::20", &in6) != 1)
1517 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1518 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1520 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1521 if (inet_pton(AF_INET6,
"2000::15", &in6) != 1)
1523 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1526 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1528 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1529 if (inet_pton(AF_INET6,
"2000::20", &in6) != 1)
1531 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1532 if (inet_pton(AF_INET6,
"2000::0", &in6) != 1)
1534 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1535 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1537 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1540 if (inet_pton(AF_INET6,
"2000::0", &in6) != 1)
1542 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1543 if (inet_pton(AF_INET6,
"2000::20", &in6) != 1)
1545 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1546 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1548 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1549 if (inet_pton(AF_INET6,
"2000::19", &in6) != 1)
1551 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1554 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1556 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1557 if (inet_pton(AF_INET6,
"2000::20", &in6) != 1)
1559 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1560 if (inet_pton(AF_INET6,
"2000::0", &in6) != 1)
1562 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1563 if (inet_pton(AF_INET6,
"2000::20", &in6) != 1)
1565 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1568 if (inet_pton(AF_INET6,
"2000::15", &in6) != 1)
1570 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1571 if (inet_pton(AF_INET6,
"2000::20", &in6) != 1)
1573 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1574 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1576 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1577 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1579 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1582 if (inet_pton(AF_INET6,
"2000::15", &in6) != 1)
1584 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1585 if (inet_pton(AF_INET6,
"2000::20", &in6) != 1)
1587 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1588 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1590 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1591 if (inet_pton(AF_INET6,
"2000::15", &in6) != 1)
1593 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1596 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1598 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1599 if (inet_pton(AF_INET6,
"2000::20", &in6) != 1)
1601 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1602 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1604 memcpy(&b->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1605 if (inet_pton(AF_INET6,
"2000::10", &in6) != 1)
1607 memcpy(&b->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1624 static int AddressTestIPv6CutNot01(
void)
1628 struct in6_addr in6;
1634 if (inet_pton(AF_INET6,
"::", &in6) != 1)
1636 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1637 if (inet_pton(AF_INET6,
"FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF", &in6) != 1)
1639 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1656 static int AddressTestIPv6CutNot02(
void)
1661 struct in6_addr in6;
1669 if (inet_pton(AF_INET6,
"::", &in6) != 1)
1671 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1672 if (inet_pton(AF_INET6,
"2000::0", &in6) != 1)
1674 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1677 result &= (b == NULL);
1679 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1681 memcpy(&temp->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1682 if (inet_pton(AF_INET6,
"FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF", &in6) != 1)
1684 memcpy(&temp->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1706 static int AddressTestIPv6CutNot03(
void)
1711 struct in6_addr in6;
1719 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1721 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1722 if (inet_pton(AF_INET6,
"FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF", &in6) != 1)
1724 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1727 result &= (b == NULL);
1729 if (inet_pton(AF_INET6,
"::", &in6) != 1)
1731 memcpy(&temp->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1732 if (inet_pton(AF_INET6,
"2000::0", &in6) != 1)
1734 memcpy(&temp->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1756 static int AddressTestIPv6CutNot04(
void)
1761 struct in6_addr in6;
1769 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1771 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1772 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1774 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1777 if (inet_pton(AF_INET6,
"::", &in6) != 1)
1779 memcpy(&temp->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1780 if (inet_pton(AF_INET6,
"2000::0", &in6) != 1)
1782 memcpy(&temp->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1785 result &= (b != NULL);
1788 if (inet_pton(AF_INET6,
"2000::2", &in6) != 1)
1790 memcpy(&temp->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1791 if (inet_pton(AF_INET6,
"FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF", &in6) != 1)
1793 memcpy(&temp->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1814 static int AddressTestIPv6CutNot05(
void)
1819 struct in6_addr in6;
1827 if (inet_pton(AF_INET6,
"2000::1", &in6) != 1)
1829 memcpy(&a->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1830 if (inet_pton(AF_INET6,
"2000::20", &in6) != 1)
1832 memcpy(&a->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1835 if (inet_pton(AF_INET6,
"::", &in6) != 1)
1837 memcpy(&temp->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1838 if (inet_pton(AF_INET6,
"2000::0", &in6) != 1)
1840 memcpy(&temp->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1843 result &= (b != NULL);
1846 if (inet_pton(AF_INET6,
"2000::21", &in6) != 1)
1848 memcpy(&temp->
ip.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1849 if (inet_pton(AF_INET6,
"FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF", &in6) != 1)
1851 memcpy(&temp->
ip2.
address, in6.s6_addr,
sizeof(in6.s6_addr));
1905 UtRegisterTest(
"AddressTestIPv6SubOne01", AddressTestIPv6SubOne01);
1906 UtRegisterTest(
"AddressTestIPv6SubOne02", AddressTestIPv6SubOne02);
1908 UtRegisterTest(
"AddressTestIPv6AddOne01", AddressTestIPv6AddOne01);
1909 UtRegisterTest(
"AddressTestIPv6AddOne02", AddressTestIPv6AddOne02);
1911 UtRegisterTest(
"AddressTestIPv6AddressCmp01", AddressTestIPv6AddressCmp01);
1913 UtRegisterTest(
"AddressTestIPv6CutNot01", AddressTestIPv6CutNot01);
1914 UtRegisterTest(
"AddressTestIPv6CutNot02", AddressTestIPv6CutNot02);
1915 UtRegisterTest(
"AddressTestIPv6CutNot03", AddressTestIPv6CutNot03);
1916 UtRegisterTest(
"AddressTestIPv6CutNot04", AddressTestIPv6CutNot04);
1917 UtRegisterTest(
"AddressTestIPv6CutNot05", AddressTestIPv6CutNot05);