Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Feb 2015 14:30:40 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-standards@FreeBSD.org
Subject:   [Bug 198092] getaddrinfo(3) fails with "Invalid value for ai_flags" (error code 3) if hint.ai_flags contains AI_V4MAPPED
Message-ID:  <bug-198092-15@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198092

            Bug ID: 198092
           Summary: getaddrinfo(3) fails with "Invalid value for ai_flags"
                    (error code 3) if hint.ai_flags contains AI_V4MAPPED
           Product: Base System
           Version: 10.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: standards
          Assignee: freebsd-standards@FreeBSD.org
          Reporter: andriys@gmail.com

The getaddrinfo(3) manual page refer to POSIX.1 and RFC 3493 in the STANDARDS
section. Both of these documents say getaddrinfo accepts AI_V4MAPPED flag in
the hint. In fact if the AI_V4MAPPED bit is set in the ai_flags member of the
hint addrinfo structure, getaddrinfo(3) always fails with error code 3
("Invalid value for ai_flags").

This can be easily demonstrated with the following sample code:

#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <string.h>
#include <stdio.h>

int main(void)
{
    struct addrinfo *ai;
    struct addrinfo hint;
    int errcode;

    memset(&hint, 0, sizeof(hint));
    hint.ai_family = PF_INET6;
    hint.ai_flags = AI_V4MAPPED;

    errcode = getaddrinfo("freebsd.org", "80", &hint, &ai);
    if(errcode) {
        fprintf(stderr, "Error %d: %s\n", errcode, gai_strerror(errcode));
        return 1;
    }

    freeaddrinfo(ai);
    return 0;
}

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-198092-15>