mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-09-28 23:00:50 +00:00
Merge edf2572e22
into 86c9f79991
This commit is contained in:
commit
a14721ca5a
@ -96,7 +96,7 @@ ip6addr_aton(const char *cp, ip6_addr_t *addr)
|
|||||||
break;
|
break;
|
||||||
#endif /* LWIP_IPV4 */
|
#endif /* LWIP_IPV4 */
|
||||||
} else if (!lwip_isxdigit(*s)) {
|
} else if (!lwip_isxdigit(*s)) {
|
||||||
break;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ ip6addr_aton(const char *cp, ip6_addr_t *addr)
|
|||||||
(u32_t)(10 + (lwip_islower(*s) ? *s - 'a' : *s - 'A')));
|
(u32_t)(10 + (lwip_islower(*s) ? *s - 'a' : *s - 'A')));
|
||||||
} else {
|
} else {
|
||||||
/* unexpected digit, space? CRLF? */
|
/* unexpected digit, space? CRLF? */
|
||||||
break;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,6 +198,8 @@ START_TEST(test_ip6_aton_ipv4mapped)
|
|||||||
const ip_addr_t addr_expected = IPADDR6_INIT_HOST(0, 0, 0xFFFF, 0xD4CC65D2);
|
const ip_addr_t addr_expected = IPADDR6_INIT_HOST(0, 0, 0xFFFF, 0xD4CC65D2);
|
||||||
const char *full_ipv6_addr = "0:0:0:0:0:FFFF:D4CC:65D2";
|
const char *full_ipv6_addr = "0:0:0:0:0:FFFF:D4CC:65D2";
|
||||||
const char *shortened_ipv6_addr = "::FFFF:D4CC:65D2";
|
const char *shortened_ipv6_addr = "::FFFF:D4CC:65D2";
|
||||||
|
const char *shortened_ipv6_addr_unexpected_char = "::FFFF:D4CC:65DZ";
|
||||||
|
const char *shortened_ipv6_addr_invalid = "::GGGGGGGG";
|
||||||
const char *full_ipv4_mapped_addr = "0:0:0:0:0:FFFF:212.204.101.210";
|
const char *full_ipv4_mapped_addr = "0:0:0:0:0:FFFF:212.204.101.210";
|
||||||
const char *shortened_ipv4_mapped_addr = "::FFFF:212.204.101.210";
|
const char *shortened_ipv4_mapped_addr = "::FFFF:212.204.101.210";
|
||||||
const char *bogus_ipv4_mapped_addr = "::FFFF:212.204.101.2101";
|
const char *bogus_ipv4_mapped_addr = "::FFFF:212.204.101.2101";
|
||||||
@ -223,6 +225,16 @@ START_TEST(test_ip6_aton_ipv4mapped)
|
|||||||
fail_unless(ret == 1);
|
fail_unless(ret == 1);
|
||||||
fail_unless(memcmp(&addr, &addr_expected, 16) == 0);
|
fail_unless(memcmp(&addr, &addr_expected, 16) == 0);
|
||||||
|
|
||||||
|
/* check shortened IPv6 with unexpected char */
|
||||||
|
memset(&addr6, 0, sizeof(addr6));
|
||||||
|
ret = ip6addr_aton(shortened_ipv6_addr_unexpected_char, &addr6);
|
||||||
|
fail_unless(ret == 0);
|
||||||
|
|
||||||
|
/* check shortened IPv6 that is clearly invalid */
|
||||||
|
memset(&addr6, 0, sizeof(addr6));
|
||||||
|
ret = ip6addr_aton(shortened_ipv6_addr_invalid, &addr6);
|
||||||
|
fail_unless(ret == 0);
|
||||||
|
|
||||||
/* checked shortened mixed representation */
|
/* checked shortened mixed representation */
|
||||||
memset(&addr6, 0, sizeof(addr6));
|
memset(&addr6, 0, sizeof(addr6));
|
||||||
ret = ip6addr_aton(shortened_ipv4_mapped_addr, &addr6);
|
ret = ip6addr_aton(shortened_ipv4_mapped_addr, &addr6);
|
||||||
|
Loading…
Reference in New Issue
Block a user