res_findzonecut2() problem/question
Mark Andrews
Mark_Andrews at isc.org
Fri Aug 22 14:33:07 UTC 2008
>
> I'm calling res_findzonecut2() in the following way:
>
> r = resfindzonecut2 (res, "120.40.64.in-addr.arpa", ns_c_in, RES_IPV4ONLY,
> zone_name, zone_size, NULL, 0);
>
> I just want to get the name of the zone that "120.40.64.in-addr.arpa" is
> part of.
>
> Unfortunately, the above call returns -1 and errno is set to EPROTOTYPE
> (Protocol wrong type for socket). I have no understanding of this error
> or how to work around it. Can anyone explain to me why the error is
> occuring and what I need to do in order to find the containing zone for
> "120.40.64.in-addr.arpa" ?
The nameservers for 120.40.64.in-addr.arpa are broken.
res_findzonecut2() detects that brokenness and aborts.
Mind you if you were to have provided a space to store
the addresses only the SOA query would have been made.
Bad response to NS query.
% dig ns 120.40.64.in-addr.arpa @ns1.netnation.com +dnssec +norec
; <<>> DiG 9.3.4-P1 <<>> ns 120.40.64.in-addr.arpa @ns1.netnation.com +dnssec +norec
; (1 server found)
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 13225
;; flags: qr aa; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;120.40.64.in-addr.arpa. IN NS
;; AUTHORITY SECTION:
120.40.64.in-addr.arpa. 86400 IN SOA ns1.netnation.com. hostmaster.netnation.com. 1123695064 28800 14400 604800 86400
;; Query time: 227 msec
;; SERVER: 204.174.223.1#53(204.174.223.1)
;; WHEN: Sat Aug 23 00:18:20 2008
;; MSG SIZE rcvd: 104
%
Initial run with debugging and no address records. This succeeds.
% env RES_OPTIONS=debug ./a.out
;; res_setoptions("debug", "env")..
;; debug
;; res_findzonecut: START dname='120.40.64.in-addr.arpa' class=IN, zsize=1024, naddrs=0
;; res_findzonecut: get the soa, and see if it has enough glue
;; res_nmkquery(QUERY, 120.40.64.in-addr.arpa., IN, SOA)
;; res_send()
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37345
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; QUERY SECTION:
;; 120.40.64.in-addr.arpa, type = SOA, class = IN
;; Querying server (# 1) address = 127.0.0.1
;; new DG socket
;; got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37345
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2
;; QUERY SECTION:
;; 120.40.64.in-addr.arpa, type = SOA, class = IN
;; ANSWER SECTION:
120.40.64.in-addr.arpa. 1D IN SOA ns1.netnation.com. hostmaster.netnation.com. (
1123695064 ; serial
8H ; refresh
4H ; retry
1W ; expiry
1D ) ; minimum
;; AUTHORITY SECTION:
120.40.64.in-addr.arpa. 23h59m59s IN NS ns2.netnation.com.
120.40.64.in-addr.arpa. 23h59m59s IN NS ns1.netnation.com.
;; ADDITIONAL SECTION:
ns1.netnation.com. 1d23h38m13s IN A 204.174.223.1
ns2.netnation.com. 1d23h38m13s IN A 204.174.223.31
;; res_findzonecut: satisfy(ns1.netnation.com): 0
;; res_findzonecut: get the ns rrset and see if it has enough glue
;; res_nmkquery(QUERY, 120.40.64.in-addr.arpa, IN, NS)
;; res_send()
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37346
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; QUERY SECTION:
;; 120.40.64.in-addr.arpa, type = NS, class = IN
;; Querying server (# 1) address = 127.0.0.1
;; new DG socket
;; got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 37346
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUERY SECTION:
;; 120.40.64.in-addr.arpa, type = NS, class = IN
;; AUTHORITY SECTION:
120.40.64.in-addr.arpa. 3H IN SOA ns1.netnation.com. hostmaster.netnation.com. (
1123695064 ; serial
8H ; refresh
4H ; retry
1W ; expiry
1D ) ; minimum
;; res_findzonecut: satisfy(ns1.netnation.com): 0
;; res_findzonecut: get the missing glue and see if it's finally enough
;; res_nmkquery(QUERY, ns2.netnation.com, IN, AAAA)
;; res_send()
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37347
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; QUERY SECTION:
;; ns2.netnation.com, type = AAAA, class = IN
;; Querying server (# 1) address = 127.0.0.1
;; new DG socket
;; got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37347
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUERY SECTION:
;; ns2.netnation.com, type = AAAA, class = IN
;; AUTHORITY SECTION:
netnation.com. 2h38m13s IN SOA ns1.netnation.com. hostmaster.netnation.com. (
2002090705 ; serial
3H ; refresh
30M ; retry
5w6d16h ; expiry
1D ) ; minimum
;; res_nmkquery(QUERY, ns1.netnation.com, IN, AAAA)
;; res_send()
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37348
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; QUERY SECTION:
;; ns1.netnation.com, type = AAAA, class = IN
;; Querying server (# 1) address = 127.0.0.1
;; new DG socket
;; got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37348
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUERY SECTION:
;; ns1.netnation.com, type = AAAA, class = IN
;; AUTHORITY SECTION:
netnation.com. 2h38m13s IN SOA ns1.netnation.com. hostmaster.netnation.com. (
2002090705 ; serial
3H ; refresh
30M ; retry
5w6d16h ; expiry
1D ) ; minimum
;; res_findzonecut: satisfy(ns1.netnation.com): 0
;; res_findzonecut: FINISH n=0 (OK)
0 120.40.64.in-addr.arpa
%
Second run fails due to cached self contradictory NXDOMAIN
record.
% env RES_OPTIONS=debug ./a.out
;; res_setoptions("debug", "env")..
;; debug
;; res_findzonecut: START dname='120.40.64.in-addr.arpa' class=IN, zsize=1024, naddrs=0
;; res_findzonecut: get the soa, and see if it has enough glue
;; res_nmkquery(QUERY, 120.40.64.in-addr.arpa., IN, SOA)
;; res_send()
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17246
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; QUERY SECTION:
;; 120.40.64.in-addr.arpa, type = SOA, class = IN
;; Querying server (# 1) address = 127.0.0.1
;; new DG socket
;; got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 17246
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUERY SECTION:
;; 120.40.64.in-addr.arpa, type = SOA, class = IN
;; AUTHORITY SECTION:
120.40.64.in-addr.arpa. 2h59m51s IN SOA ns1.netnation.com. hostmaster.netnation.com. (
1123695064 ; serial
8H ; refresh
4H ; retry
1W ; expiry
1D ) ; minimum
;; res_findzonecut: get_soa: ns_samename() || !ns_samedomain('120.40.64.in-addr.arpa.', '120.40.64.in-addr.arpa')
;; res_findzonecut: FINISH n=-1 (Protocol wrong type for socket)
-1
%
Run with space to store the addresses of nameservers. This
succeeds with only one query.
% env RES_OPTIONS=debug ./a.out
;; res_setoptions("debug", "env")..
;; debug
;; res_findzonecut: START dname='120.40.64.in-addr.arpa' class=IN, zsize=1024, naddrs=10
;; res_findzonecut: get the soa, and see if it has enough glue
;; res_nmkquery(QUERY, 120.40.64.in-addr.arpa., IN, SOA)
;; res_send()
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27596
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; QUERY SECTION:
;; 120.40.64.in-addr.arpa, type = SOA, class = IN
;; Querying server (# 1) address = 127.0.0.1
;; new DG socket
;; got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27596
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2
;; QUERY SECTION:
;; 120.40.64.in-addr.arpa, type = SOA, class = IN
;; ANSWER SECTION:
120.40.64.in-addr.arpa. 1D IN SOA ns1.netnation.com. hostmaster.netnation.com. (
1123695064 ; serial
8H ; refresh
4H ; retry
1W ; expiry
1D ) ; minimum
;; AUTHORITY SECTION:
120.40.64.in-addr.arpa. 23h59m59s IN NS ns1.netnation.com.
120.40.64.in-addr.arpa. 23h59m59s IN NS ns2.netnation.com.
;; ADDITIONAL SECTION:
ns1.netnation.com. 1d23h31m54s IN A 204.174.223.1
ns2.netnation.com. 1d23h31m54s IN A 204.174.223.31
;; res_findzonecut: add_addrs: 1
;; res_findzonecut: add_addrs: 1
;; res_findzonecut: satisfy(ns1.netnation.com): 2
;; res_findzonecut: FINISH n=2 (OK)
2 120.40.64.in-addr.arpa
%
--
Mark Andrews, ISC
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742 INTERNET: Mark_Andrews at isc.org
More information about the bind-users
mailing list