Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: TestLookupCNAME fails #1745

Closed
peterGo opened this issue Apr 27, 2011 · 6 comments
Closed

net: TestLookupCNAME fails #1745

peterGo opened this issue Apr 27, 2011 · 6 comments

Comments

@peterGo
Copy link
Contributor

peterGo commented Apr 27, 2011

On linux/amd64, using Go hg id 7f2899bf1256:

$ gotest
rm -f _test/net.a
rm -f _test/net.a
gopack grc _test/net.a _gotest_.6  _cgo_defun.6 _cgo_import.6 cgo_linux.cgo2.o
cgo_unix.cgo2.o _cgo_export.o
--- FAIL: net.TestLookupCNAME (0.72 seconds)
    LookupCNAME("www.google.com.") = "www.google.com.", <nil>, want "*.l.google.com.", nil
FAIL
gotest: "./6.out" failed: exit status 1
$
@rsc
Copy link
Contributor

rsc commented Apr 27, 2011

Comment 1:

What does
host -t cname www.google.com.
print on your machine?  How about without "-t cname"?

@peterGo
Copy link
Contributor Author

peterGo commented Apr 27, 2011

Comment 2:

$ host -t cname www.google.com.
www.google.com is an alias for www.l.google.com.
$ host  www.google.com.
www.google.com has address 67.142.161.38
www.google.com is an alias for www.l.google.com.
www.google.com is an alias for www.l.google.com.
$

@rsc
Copy link
Contributor

rsc commented Apr 27, 2011

Comment 3:

How about this C program?
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define nil ((void*)0)
int
main(int argc, char **argv)
{
    int g;
    struct addrinfo *res, hints;
    
    memset(&hints, 0, sizeof hints);
    hints.ai_flags = AI_CANONNAME | AI_V4MAPPED | AI_ALL;
    g = getaddrinfo("www.google.com", nil, &hints, &res);
    if(g != 0) {
        fprintf(stderr, "%s\n", gai_strerror(g));
        exit(2);
    }
    for(; res; res=res->ai_next) {
        printf("%d %d %d %d %s\n", res->ai_family, res->ai_socktype,
res->ai_protocol, res->ai_addrlen, res->ai_canonname);
    }
    exit(0);
}

Owner changed to @rsc.

Status changed to Accepted.

@peterGo
Copy link
Contributor Author

peterGo commented Apr 27, 2011

Comment 4:

2 1 6 16 www.google.com
2 2 17 16 (null)
2 3 0 16 (null)

@rsc
Copy link
Contributor

rsc commented Apr 27, 2011

Comment 5:

This is one of the many reasons we omit that test
during gotest -short (and all.bash).
The IP address that your host output returned is
not actually a Google server:
$ host 67.142.161.38
38.161.142.67.in-addr.arpa domain name pointer host671420038161.direcway.com.
$
Your ISP (or its ISP, or ...) is intercepting the lookup for
www.google.com and providing false records, probably
because it wants to intercept your search traffic.
Go is just returning what the (false) DNS records say,
and they are wrong, so the test fails.
One possible workaround is to use the Google public DNS
servers 8.8.8.8 and 8.8.4.4 instead of the ones suggested
by your ISP.  http://code.google.com/speed/public-dns/

Status changed to Invalid.

@peterGo
Copy link
Contributor Author

peterGo commented Apr 27, 2011

Comment 6:

Using Google Public DNS:
$ gotest
rm -f _test/net.a
rm -f _test/net.a
gopack grc _test/net.a _gotest_.6  _cgo_defun.6 _cgo_import.6 cgo_linux.cgo2.o
cgo_unix.cgo2.o _cgo_export.o
PASS

@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc removed their assignment Jun 22, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants