Handle ipv4-mapped addresses

This commit is contained in:
Sergey Lyubka committed 2021-09-18 19:38:59 +01:00
1 parent 9d1e61de93
commit a7afea0963
3 files changed
+44 -4

No files matched your search

+8
View File
@@ -1196,6 +1196,14 @@ static void test_util(void) {
"\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01",
sizeof(a.ip6)) == 0);
memset(a.ip6, 0xaa, sizeof(a.ip6));
ASSERT(mg_aton(mg_str("::fFff:1.2.3.4"), &a) == true);
ASSERT(a.is_ip6 == true);
ASSERT(memcmp(a.ip6,
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\xff\xff\x01\x02\x03\x04",
sizeof(a.ip6)) == 0);
memset(a.ip6, 0xaa, sizeof(a.ip6));
ASSERT(mg_aton(mg_str("::1"), &a) == true);
ASSERT(a.is_ip6 == true);