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

How to disable recursion with q? #2

Open
bortzmeyer opened this issue May 12, 2016 · 2 comments
Open

How to disable recursion with q? #2

bortzmeyer opened this issue May 12, 2016 · 2 comments

Comments

@bortzmeyer
Copy link
Contributor

The q program in the example has a -rd option to ask for recursion but it is enabled by default. How to disable it?

  -rd
        set RD flag in query (default true)

There is a RD each time;

% ./q  @::1 SOA internautique.fr   
;; opcode: QUERY, status: NOERROR, id: 12804
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 0

;; QUESTION SECTION:
;internautique.fr.      IN       SOA

;; ANSWER SECTION:
internautique.fr.       3114    IN      SOA     ns3.bortzmeyer.org. hostmaster.bortzmeyer.org. 2016051200 7200 3600 604800 3600

;; AUTHORITY SECTION:
internautique.fr.       85914   IN      NS      ns3.bortzmeyer.org.
internautique.fr.       85914   IN      NS      ns1.bortzmeyer.org.
internautique.fr.       85914   IN      NS      ns2.bortzmeyer.org.

;; query time: 185 µs, server: [::1]:53(udp), size: 273 bytes

% ./q -rd @::1 SOA internautique.fr
;; opcode: QUERY, status: NOERROR, id: 61230
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 0

;; QUESTION SECTION:
;internautique.fr.      IN       SOA

;; ANSWER SECTION:
internautique.fr.       3112    IN      SOA     ns3.bortzmeyer.org. hostmaster.bortzmeyer.org. 2016051200 7200 3600 604800 3600

;; AUTHORITY SECTION:
internautique.fr.       85912   IN      NS      ns3.bortzmeyer.org.
internautique.fr.       85912   IN      NS      ns1.bortzmeyer.org.
internautique.fr.       85912   IN      NS      ns2.bortzmeyer.org.

;; query time: 146 µs, server: [::1]:53(udp), size: 273 bytes
@bortzmeyer
Copy link
Contributor Author

A possible patch could be as simple as (but may disconcert people used to dig being recursive by default):

diff --git a/q/q.go b/q/q.go
index 11f4051..dd2e155 100644
--- a/q/q.go
+++ b/q/q.go
@@ -45,7 +45,7 @@ func main() {
        aa := flag.Bool("aa", false, "set AA flag in query")
        ad := flag.Bool("ad", false, "set AD flag in query")
        cd := flag.Bool("cd", false, "set CD flag in query")
-       rd := flag.Bool("rd", true, "set RD flag in query")
+       rd := flag.Bool("rd", false, "set RD flag in query")
        fallback := flag.Bool("fallback", false, "fallback to 4096 bytes bufsize and after that TCP")
        tcp := flag.Bool("tcp", false, "TCP mode, multiple queries are asked over the same connection")

        nsid := flag.Bool("nsid", false, "set edns nsid option")

@miekg
Copy link
Owner

miekg commented May 12, 2016

"You must use the -flag=false form to turn off a boolean flag."

See https://godoc.org/flag

[ Quoting notifications@github.com in "Re: [miekg/exdns] How to disable re..." ]

A possible patch could be as simple as (but may disconcert people used to dig being recursive by default):

diff --git a/q/q.go b/q/q.go
index 11f4051..dd2e155 100644
--- a/q/q.go
+++ b/q/q.go
@@ -45,7 +45,7 @@ func main() {
       aa := flag.Bool("aa", false, "set AA flag in query")
       ad := flag.Bool("ad", false, "set AD flag in query")
       cd := flag.Bool("cd", false, "set CD flag in query")
-       rd := flag.Bool("rd", true, "set RD flag in query")
+       rd := flag.Bool("rd", false, "set RD flag in query")
       fallback := flag.Bool("fallback", false, "fallback to 4096 bytes bufsize and after that TCP")
       tcp := flag.Bool("tcp", false, "TCP mode, multiple queries are asked over the same connection")

       nsid := flag.Bool("nsid", false, "set edns nsid option")

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#2 (comment)
/Miek

Miek Gieben

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

No branches or pull requests

2 participants