mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Yuri Kanivetsky <yuri.kanivetsky@gmail.com>
To: musl@lists.openwall.com
Subject: [musl] getaddrinfo() fails for domains with no AAAA records (regression?)
Date: Mon, 19 Jul 2021 15:58:25 +0300	[thread overview]
Message-ID: <CAMhVC3bmXRW0WBnJNgVN66vHfLr-oz0PkWTOa9tiqTtJkMXbtQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1878 bytes --]

Hi,

a.c:

    #include <netdb.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <arpa/inet.h>

    int
    main(int argc, char *argv[])
    {
        struct addrinfo hints;
        struct addrinfo *result, *rp;
        int r;
        char s[INET6_ADDRSTRLEN];

        memset(&hints, 0, sizeof(hints));
        if (argc > 2)
            hints.ai_family = AF_INET;
        hints.ai_socktype = SOCK_DGRAM;

        r = getaddrinfo(argv[1], NULL, &hints, &result);
        if (r != 0) {
            fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(r));
            exit(EXIT_FAILURE);
        }

        for (rp = result; rp != NULL; rp = rp->ai_next) {
            switch (rp->ai_family) {
            case AF_INET:
                inet_ntop(AF_INET, &((struct sockaddr_in
*)rp->ai_addr)->sin_addr, s, INET6_ADDRSTRLEN);
                printf("AF_INET: %s\n", s);
                break;
            case AF_INET6:
                inet_ntop(AF_INET6, &((struct sockaddr_in6
*)rp->ai_addr)->sin6_addr, s, INET6_ADDRSTRLEN);
                printf("AF_INET6: %s\n", s);
                break;
            }
        }

        freeaddrinfo(result);
    }

a.sh:

    #!/bin/sh -eux
    apk add build-base
    cd app
    gcc a.c
    ./a.out p2.x-yuri.site set_ai_family
    ./a.out p2.x-yuri.site

$ docker run --rm -itv $PWD:/app alpine:3.12 ./app/a.sh
...
+ ./a.out p2.x-yuri.site set_ai_family
AF_INET: 3.67.126.242
+ ./a.out p2.x-yuri.site
AF_INET: 3.67.126.242

$ docker run --rm -itv $PWD:/app alpine:3.13 ./app/a.sh
...
+ ./a.out p2.x-yuri.site set_ai_family
AF_INET: 3.67.126.242
+ ./a.out p2.x-yuri.site
getaddrinfo: Name does not resolve

$ docker run --rm -itv $PWD:/app alpine:3.14 ./app/a.sh
...
+ ./a.out p2.x-yuri.site set_ai_family
AF_INET: 3.67.126.242
+ ./a.out p2.x-yuri.site
getaddrinfo: Name does not resolve

Regards,
Yuri

[-- Attachment #2: p1.png --]
[-- Type: image/png, Size: 79835 bytes --]

             reply	other threads:[~2021-07-19 13:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-19 12:58 Yuri Kanivetsky [this message]
2021-07-19 13:22 ` Florian Weimer
2021-07-19 18:51   ` Yuri Kanivetsky
2021-07-19 19:29     ` Shiz
2021-07-19 19:47     ` Érico Nogueira
2021-07-19 21:08   ` Rich Felker
2021-07-19 21:07 ` Olivier A.
2021-07-19 21:12   ` Rich Felker
2021-07-23 20:25     ` Yuri Kanivetsky
2021-07-23 20:33       ` Yuri Kanivetsky
2021-07-23 20:45       ` Laurent Bercot
2021-07-27 14:21         ` Yuri Kanivetsky
2021-07-27 14:41           ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMhVC3bmXRW0WBnJNgVN66vHfLr-oz0PkWTOa9tiqTtJkMXbtQ@mail.gmail.com \
    --to=yuri.kanivetsky@gmail.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).