Merge pull request #10 from 0x1eef/inet4

Add support for `::13.1.68.3`
This commit is contained in:
0x1eef 2023-09-22 14:45:42 -03:00 committed by GitHub
commit c41c1eda34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -27,8 +27,12 @@ isinetaddr6(const char *str)
if (has_consecutive_chars(&str[i], SEP, 3)) { if (has_consecutive_chars(&str[i], SEP, 3)) {
return 0; return 0;
} else if (has_consecutive_chars(&str[i], SEP, 2)) { } else if (has_consecutive_chars(&str[i], SEP, 2)) {
char new_str[MAX_STRLEN]; if (i == 0 && isinetaddr4(&str[3])) {
return isinetaddr6(expand(str, len, new_str, i)); return 1;
} else {
char new_str[MAX_STRLEN];
return isinetaddr6(expand(str, len, new_str, i));
}
} else if (str[i] == SEP) { } else if (str[i] == SEP) {
digitlen = 0; digitlen = 0;
} else if (isxdigit(str[i])) { } else if (isxdigit(str[i])) {

View file

@ -36,6 +36,7 @@ const char *valid[] = {
"FF01::101", "FF01::101",
"::ffff:192.168.2.1", "::ffff:192.168.2.1",
"::FFFF:192.168.2.1", "::FFFF:192.168.2.1",
"::13.1.68.3",
"::", "::",
"::1", "::1",
}; };