Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 522454 - =net-proxy/dante-1.4.0-r2 - multiple issues with IPv6
Summary: =net-proxy/dante-1.4.0-r2 - multiple issues with IPv6
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Robin Johnson
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-09 19:08 UTC by Casper Ti. Vector
Modified: 2016-10-24 13:06 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Casper Ti. Vector 2014-09-09 19:08:15 UTC
With =net-proxy/dante-1.4.0-r2, the wrapped getaddrinfo() function:
* returns no ipv6 address for hostnames even if both the hostnames and dns servers are ipv6 enabled.
* produces the `Address family for hostname not supported' error when ipv6 addresses is provided as the string input.

This issues affects downstream software such as irssi (for example, `/connect example.com' and `/connect ::1' will not work, effectively forbidding users to access ipv6 irc servers ;).

This issue does not happen with versions 1.1.19-r4, 1.3.2-r1 and 1.4.1.


Reproducible: Always

Steps to Reproduce:
1. # emerge -v1O '=net-proxy/dante-1.4.0-r2'
2. $ gcc test.c -o test (see below for the source code)
3. $ ./test <<< 'example.com'
4. $ ./test <<< '::1'

Actual Results:  
3.
> 93.184.216.119
4.
> getaddrinfo: -9 (Address family for hostname not supported)


Expected Results:  
3.
> 2606:2800:220:6d:26bf:1447:1097:aa7
> 93.184.216.119
4.
> ::1


Source code of the test program:

#include <string.h>
#include <stdio.h>

#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>

#ifdef HAVE_SOCKS_H
#include <socks.h>
#endif

#define NAME_LEN 250

union sockaddr_union {
        struct sockaddr sa;
        struct sockaddr_in sin;
        struct sockaddr_in6 sin6;
};

int main() {
        char name[NAME_LEN];

        while(fgets(name, NAME_LEN, stdin)) {
                struct addrinfo hints, *ai, *ailist;
                union sockaddr_union *so;
                int ret, len;

                len = strlen(name);
                if (len != 0 && name[len - 1] == '\n') name[len - 1] = '\0';

                memset(&hints, 0, sizeof(struct addrinfo));
                hints.ai_socktype = SOCK_STREAM;
                ret = getaddrinfo(name, NULL, &hints, &ailist);
                if (ret != 0) {
                        fprintf(stderr, "getaddrinfo: %d (%s)\n", ret, gai_strerror(ret));
                        continue;
                }

                for (ai = ailist; ai != NULL; ai = ai->ai_next) {
                        char addr[INET6_ADDRSTRLEN];
                        union sockaddr_union *so = (union sockaddr_union *)ai->ai_addr;
                        if (!inet_ntop(
                                so->sin.sin_family, 
                                (so->sin.sin_family == AF_INET ?
                                        (void *)&so->sin.sin_addr.s_addr :
                                        (void *)so->sin6.sin6_addr.s6_addr),
                                addr, INET6_ADDRSTRLEN
                        )) perror("inet_ntop");
                        printf("%s\n", addr);
                }
                freeaddrinfo(ailist);
        }

        return 0;
}
Comment 1 Casper Ti. Vector 2014-09-10 06:51:28 UTC
Correction: Step 2 in "steps to reproduce: should be
$ gcc -DHAVE_SOCKS_H test.c -o test -lsocks
Comment 2 Pacho Ramos gentoo-dev 2016-10-24 12:40:56 UTC
please retry with 1.4.1
Comment 3 Casper Ti. Vector 2016-10-24 13:06:46 UTC
Fixed.  Thanks :)