diff options
author | Wenzel, Alexander <alexander.wenzel@qsc.de> | 2016-06-21 15:49:54 +0000 |
---|---|---|
committer | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2016-06-21 20:56:28 +0200 |
commit | 35adc1fa7fbecea572afaf829a33454da0f764b0 (patch) | |
tree | dcfdda8fbb42d41a03833260205f9c7b2fe473dc /libc/inet/inet_net.c | |
parent | e3848e3dd64a8d6437531488fe341354bc02eaed (diff) |
inet/getaddrinfo: fix AF_V4MAPPED behavior for non IPv6 host resolution
When trying to resolve a hostname by getaddrinfo() using some specific
settings, it will always return -EAI_NONAME (Name or service not known).
To reproduce this behavior, you need to request an IPv6 address with the
additional AF_V4MAPPED flag set from an non IPv6 capable hostname. If
you choose a IPv4/IPv6 capable hostname like google.com, everything
works fine.
This patch is more or less a port [1][2] from the glibc and their behavior
for the AF_V4MAPPED flag. To test the bug you can use the following snippet.
---- 8< ----
int ret;
struct addrinfo* result;
struct addrinfo hints;
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_INET6;
hints.ai_flags = AI_V4MAPPED;
ret = getaddrinfo("test.com", NULL, &hints, &result);
printf("getaddrinfo(): %i", ret);
---- 8< ----
[1] https://sourceware.org/git/?p=glibc.git;a=commit;f=sysdeps/posix/getaddrinfo.c;h=925c3c5c71596c02f7e58a0ffcdcaae44eb065c1
[2] https://sourceware.org/git/?p=glibc.git;a=commit;f=sysdeps/posix/getaddrinfo.c;h=28977c2c1acb789660ad47e0d88e42486059c916
Signed-off-by: Alexander Wenzel <alexander.wenzel@qsc.de>
Diffstat (limited to 'libc/inet/inet_net.c')
0 files changed, 0 insertions, 0 deletions