summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
f6f98ad)
Posix says that canonname should use the text representation of an IP address
when a numerical nodename given
See: http://pubs.opengroup.org/onlinepubs/
9699919799/functions/getaddrinfo.html
Signed-off-by: Ed Wildgoose <lists@wildgooses.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
char buffer[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
while (at2 != NULL) {
char buffer[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
while (at2 != NULL) {
- if (req->ai_flags & AI_CANONNAME) {
+ c = inet_ntop(at2->family, at2->addr, buffer, sizeof(buffer));
+ if (c) {
+ namelen = strlen(c) + 1;
+ } else if (req->ai_flags & AI_CANONNAME) {
struct hostent *h = NULL;
int herrno;
struct hostent th;
size_t tmpbuflen = 512;
char *tmpbuf;
struct hostent *h = NULL;
int herrno;
struct hostent th;
size_t tmpbuflen = 512;
char *tmpbuf;
+ /* Hint says numeric, but address is not */
+ if (req->ai_flags & AI_NUMERICHOST)
+ return -EAI_NONAME;
+
do {
tmpbuflen *= 2;
tmpbuf = alloca(tmpbuflen);
do {
tmpbuflen *= 2;
tmpbuf = alloca(tmpbuflen);
- if (h == NULL)
- c = inet_ntop(at2->family, at2->addr, buffer, sizeof(buffer));
- else
c = h->h_name;
if (c == NULL)
c = h->h_name;
if (c == NULL)