s6-dns: the s6-dnsqr program
Keywords: s6-dns client s6-dnsqr dnsqr analysis debug

s6-dns
Software
skarnet.org

# The s6-dnsqr program

s6-dnsqr is an analysis and debug tool. It performs a DNS resolution, then prints the contents of the answer packet, and optionally debug information during the resolution.

## Interface

         s6-dnsqr [ -1 | -2 ] [ -t timeout ] [ -D level ] qtype domain

- s6-dnsqr makes a recursive DNS query of type qtype for the name domain. It prints the answer packet, in human-readable form, to its standard output, then exits 0.
- It does not qualify domain.
- If the resolution fails for some reason, s6-dnsqr exits 2.
- By default, s6-dnsqr looks for DNS cache addresses in the `/etc/resolv.conf` file. If the DNSCACHEIP environment variable is set and contains a list of IP (v4 or v6) addresses, separated by commas, semicolons, spaces, tabs, newlines or carriage returns, then this list is used instead.

## Options

- `-1` : send debug information to stdout.
- `-2` : send debug information to stderr. This is the default. Note that those options only apply to debug output, not to the regular packet dump, which is always printed to stdout.
- `-t` timeout : if the resolution takes more than timeout milliseconds, then it exits 99 right away with an error message. By default, timeout is 0, which means no timeout.
- `-D` level : produce debug output during resolution. If level is:
  - 0: no debug output is produced
  - 1: information is printed when s6-dnsqr receives a DNS packet from a cache
  - 2: information is printed before and after s6-dnsqr sends a DNS packet to a cache
  - 3: both 1. and 2. apply

## Notes

- TXT records are printed in a quoted form similar to s6-quote's output.
- If s6-dnsqr finds a record it cannot print, such as an unknown RR type, it dumps its content in the same quoted form.
- The normal output format should be stable, so you can write programs that automatically parse it. However, the debug output format is undocumented and subject to change.