Hide Forgot
Description of problem: When running IPv6 related tests on Fedora, inet_pton failed to deal with IPv6 address with format like 0:0:1:0:0:0:ffff:0a001 The source code: $ cat test.c #include <stdio.h> #include <unistd.h> #include <errno.h> #include <netinet/in.h> #include <arpa/inet.h> struct { char *addr; int ismap; } maptab[] = { {"2002::1", 0 }, {"::ffff:10.0.0.1", 1 }, {"::fffe:10.0.0.1", 0 }, {"::7fff:10.0.0.1", 0 }, {"0:0:0:0:0:0:ffff:0a001", 1 }, }; #define MAPSIZE (sizeof(maptab)/sizeof(maptab[0])) int main(int argc, char **argv) { struct in6_addr in6; int i; for (i=0; i<MAPSIZE; ++i) { if (inet_pton(AF_INET6, maptab[i].addr, &in6) <= 0) { fprintf(stderr, "\"%s\" is not a valid IPv6 address\n", maptab[i].addr); continue; } } return 0; } Version-Release number of selected component (if applicable): 4.14.2-300.fc27.x86_64 [root@lenovo-rd230-02 testcases]# rpm -qa | grep glibc glibc-headers-2.26-16.fc27.x86_64 glibc-common-2.26-16.fc27.x86_64 glibc-langpack-en-2.26-16.fc27.x86_64 glibc-devel-2.26-16.fc27.x86_64 glibc-2.26-16.fc27.x86_64 How reproducible: Always Steps to Reproduce: 1. compile the reproducer # gcc -o test test.c 2. run the reproducer # ./test Actual results: Expected results: Additional info: It could pass on Fedora 25 $ uname -r 4.8.6-300.fc25.x86_64 $ rpm -qa | grep glibc glibc-headers-2.24-3.fc25.x86_64 glibc-common-2.24-3.fc25.x86_64 glibc-all-langpacks-2.24-3.fc25.x86_64 glibc-2.24-3.fc25.x86_64 glibc-devel-2.24-3.fc25.x86_64
This is not a bug. RFC 4291 requires that the hexadecimal components contain one to four digits: https://tools.ietf.org/html/rfc4291#section-2.2
(In reply to Florian Weimer from comment #1) > This is not a bug. RFC 4291 requires that the hexadecimal components > contain one to four digits: > > https://tools.ietf.org/html/rfc4291#section-2.2 Thanks for clarifying it!