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

x/net/dns: create package #8540

Closed
gopherbot opened this issue Aug 16, 2014 · 7 comments
Closed

x/net/dns: create package #8540

gopherbot opened this issue Aug 16, 2014 · 7 comments

Comments

@gopherbot
Copy link
Contributor

by [email protected]:

What does 'go version' print?
go version go1.3.1 darwin/amd64

What steps reproduce the problem?
If possible, include a link to a program on play.golang.org.

1. Run this program locally https://play.golang.org/p/BMNcHrJ1D5
2. Run dig txt 20120113._domainkey.gmail.com

What happened?
The Go program prints:
2014/08/16 16:23:06 lookup 20120113._domainkey.gmail.com on [192.168.1.1]:53: no such
host
2014/08/16 16:23:06 []

What should have happened instead?
The Go program should have found something. 

Please provide any additional information below.
I looked at a packet dump, and it looks like the problem is that TXT record contains two
strings. (For this particular use, the strings within a record are supposed to be
concatenated[1]. I don't know if this is true in general. If not, I guess there may need
to be a [][]string version of net.LookupTXT or something.)

unpackRR[2] in dnsmsg.go returns only the header if it fails to parse the entire body.
It tries to parse a dnsRR_TXT, but that only contains a string rather than a []string
and its Walk method only pulls one string out[3].

Per [4], a TXT-DATA contains "One or more <character-string>s.".

[1] https://tools.ietf.org/html/rfc6376#section-3.6.2.2
[2]
https://code.google.com/p/go/codesearch#go/src/pkg/net/dnsmsg.go&;q=unpackRR&sq=package:go&l=706
[3]
https://code.google.com/p/go/codesearch#go/src/pkg/net/dnsmsg.go&;q=unpackRR&sq=package:go&l=299
[4] https://tools.ietf.org/html/rfc1035#section-3.3.14
@gopherbot
Copy link
Contributor Author

Comment 1 by [email protected]:

> For this particular use, the strings within a record are supposed to be
> concatenated[1]. I don't know if this is true in general. 
No such luck.  RFC 1035 leaves it up to the application, and although DKIM, DMARC, IKE,
and SPF specify that the constituent strings of their TXT record should be concatenated,
DNS-SD specifies a different interpretation for its TXT record (RFC 6763 §6.3):
“Each key/value pair is encoded as its own constituent string within the DNS TXT
record, in the form "key=value" (without the quotation marks).”
So for the general case, we do need a [][]string.

@ianlancetaylor
Copy link
Member

Comment 2:

Labels changed: added repo-main, release-go1.4.

@rsc
Copy link
Contributor

rsc commented Sep 16, 2014

Comment 3:

We should make a go.net/dns that has all the bells and whistles. This one is for basic
things, and for basic things I don't think we need to support this case.

Labels changed: added release-none, removed release-go1.4.

Status changed to Accepted.

@mikioh
Copy link
Contributor

mikioh commented Oct 2, 2014

Comment 4:

Labels changed: added repo-net, removed repo-main.

@mikioh mikioh changed the title go.net/dns: create package x/net/dns: create package Dec 23, 2014
@mikioh mikioh added repo-net and removed repo-net labels Dec 23, 2014
@mikioh mikioh changed the title x/net/dns: create package dns: create package Jan 4, 2015
@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title dns: create package x/net/dns: create package Apr 14, 2015
@rsc rsc modified the milestones: Unreleased, Unplanned Apr 14, 2015
@rsc rsc removed the repo-net label Apr 14, 2015
@bradfitz
Copy link
Contributor

@iangudger
Copy link
Contributor

I am working on improvements for x/net/dns/dnsmessage and a DNS server to go along with it.

@mikioh
Copy link
Contributor

mikioh commented Dec 1, 2017

Merged into #16218.

@mikioh mikioh closed this as completed Dec 1, 2017
@golang golang locked and limited conversation to collaborators Dec 1, 2018
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

6 participants