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

RFC3597 #1209

Closed
madestro opened this issue Jan 22, 2021 · 1 comment · Fixed by #1211
Closed

RFC3597 #1209

madestro opened this issue Jan 22, 2021 · 1 comment · Fixed by #1211

Comments

@madestro
Copy link
Contributor

Hi,
I was checking your library for parsing a zone with generic representation and it seems that or I'm doing something wrong, or something is broken. If we have this code (called test-parser.go) that reads a zone file and print the RRs:

package main
import (
	"fmt"
	"os"
	"github.com/miekg/dns"
	)
func main () {

	zonefile := os.Args[1]
	fd, _ := os.Open(zonefile)
	defer fd.Close()

	zone := dns.NewZoneParser(fd,"","")

	for rr, ok := zone.Next(); ok; rr, ok = zone.Next() {
		fmt.Println(rr)
	}
}

and having this simple.zone file:

example.        86400   IN      NS      ns.example.
example.        86400   IN      SOA     ns.example. admin.example. 2018031900 18
00 900 604800 86400
ns.example.     3600    IN      A       127.0.0.1
example.     3600    IN      A       127.0.0.2

It is printed correctly with $ go run test-parser.go simple.zone

But, if I change the last line for the Hex representation using:
perl -MNet::DNS::RR -e '$rr = new Net::DNS::RR("example. 3600 IN A 127.0.0.2");print $rr->generic;'

Which gives me the simple.zone file:

example.        86400   IN      NS      ns.example.
example.        86400   IN      SOA     ns.example. admin.example. 2018031900 18
00 900 604800 86400
ns.example.     3600    IN      A       127.0.0.1
example. 3600 CLASS1 TYPE1 \# 4 7f000002

Then, running the code i will have:

$ go run test-parser.go simple.zone 
example.	86400	IN	NS	ns.example.
example.	86400	IN	SOA	ns.example. admin.example. 2018031900 1800 900 604800 86400
ns.example.	3600	IN	A	127.0.0.1

@miekg
Copy link
Owner

miekg commented Jan 22, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants