gwh@lion.inmos.co.uk (Graham Hudspith) (01/30/91)
I am working on an application which needs to implement the gethostent(3N) and getnetent(3N) socket calls using a DNS. Using rfcs 1034 and 1035 I have gotten gethostbyname() and gethostbyaddr() working. It seems that rfc 1101 is purpose-built for my needs (to get getnetbyname() and getnetbyaddr() working), but has anyone ever tried it? I have acquired the source code for BIND v4.8 and have tried to mimic the code for gethostby... to make getnetby... work. Unfortunately, although getnetbyaddr() was fairly simple, by adding: 0.0.198.138.IN-ADDR.ARPA. PTR br-ether. to the named.revzone file, getnetbyname() is proving more difficult. I have added a line: br-ether. PTR 0.0.198.138.IN-ADDR.ARPA. to the named.zone file and called: res_query("br-ether", C_IN, T_PTR, ...); Although the DNS returns an answer with the string "0.0.198.138.IN-ADDR.ARPA" present, it also indicates SERVFAIL in the return code. I don't want to hack the code for the DNS - the software must work with any DNS, so is there anyway I can hack the Resolver libraries to make the getnetent(3N) calls work?? The DNS that I am using is the standard DNS supplied with SunOs 4.1, here are the files: :::::::::::::: /etc/named.boot :::::::::::::: primary inmos.co.uk /etc/named.zone primary 198.138.IN-ADDR.ARPA /etc/named.revzone :::::::::::::: /etc/named.revzone :::::::::::::: 198.138.IN-ADDR.ARPA. IN SOA eagle.inmos.co.uk. gwh.inmos.co.uk. ( 1.0010 3600 300 360000 3600 ) ; 7.35 PTR eagle.inmos.co.uk. 204.35 PTR trout.inmos.co.uk. ; 0.0 PTR br-ether. :::::::::::::: /etc/named.zone :::::::::::::: @ IN SOA eagle.inmos.co.uk. gwh.inmos.co.uk. ( 1.0010 3600 300 360000 3600 ) ; eagle IN A 138.198.35.7 IN HINFO Sun-4/60 UNIX trout IN A 138.198.35.204 IN HINFO NCD X-Terminal ; br-ether. PTR 0.0.198.138.IN-ADDR.ARPA. Thanks for struggling through the article if you got this far!! Graham Hudspith. Graham W. Hudspith INMOS Ltd, Bristol | EMail(UK) ukc!inmos!gwh ---------------------------------------| or gwh@inmos.co.uk I wouldn't give a XXXX for any other | Internet: gwh@inmos.com windowing system | UUCP:(US) uunet!inmos.com!gwh
gwh@cheetah.inmos.co.uk (Graham Hudspith) (01/31/91)
Thanks to all those people who have mailed me the answer. It shows that trying to develop TCP/IP applications without access to The Internet can be like trying to learn to speak French only from a book !! The answer, for the interested among you, was that I cannot use RFC1101 to define a DNS entry for a network called "br-ether.", but I can do for a network called "br-ether.inmos.co.uk." Example ======= :::::::::::::: /etc/named.zone :::::::::::::: inmos.co.uk. IN SOA eagle.inmos.co.uk. gwh.inmos.co.uk. ( 1.0010 3600 300 360000 3600 ) ; eagle IN A 138.198.35.7 IN HINFO Sun-4/60 UNIX ; trout IN A 138.198.35.204 IN HINFO NCD X-Terminal ; br-ether PTR 0.0.198.138.IN-ADDR.ARPA. rather than br-ether. PTR 0.0.198.138.IN-ADDR.ARPA. Close, but no cigar! Now getnetbyname ("br-ether") returns: name = br-ether.inmos.co.uk addrtype = 2 net = 138.198.0.0 Graham Hudspith. Graham W. Hudspith INMOS Ltd, Bristol | EMail(UK) ukc!inmos!gwh ---------------------------------------| or gwh@inmos.co.uk I wouldn't give a XXXX for any other | Internet: gwh@inmos.com windowing system | UUCP:(US) uunet!inmos.com!gwh
lars@spectrum.CMC.COM (Lars Poulsen) (02/04/91)
In article <14170@ganymede.inmos.co.uk> gwh@inmos.co.uk () writes: >:::::::::::::: >/etc/named.zone (abbreviated excerpts): >:::::::::::::: >inmos.co.uk. IN SOA eagle.inmos.co.uk. gwh.inmos.co.uk. ( > 1.0010 3600 300 360000 3600 ) >eagle IN A 138.198.35.7 >trout IN A 138.198.35.204 >br-ether PTR 0.0.198.138.IN-ADDR.ARPA. > >Now getnetbyname ("br-ether") returns: > name = br-ether.inmos.co.uk > addrtype = 2 > net = 138.198.0.0 Seems utterly wrong to me. Can someone explain this ? I would have expected to see: /etc/named.zone (abbreviated excerpts): Inmos.CO.UK. IN SOA eagle.inmos.co.uk. gwh.inmos.co.uk. ( 1.0010 3600 300 360000 3600 ) eagle IN A 138.198.35.7 trout IN A 138.198.35.204 br-ether IN A 138.198.0.0 /etc/named.zone.rev: 198.138.IN-ADDR.ARPA. IN SOA eagle.inmos.co.uk. gwh.inmos.co.uk. ( 1.0010 3600 300 360000 3600 ) 0.0 PTR br-ether.Inmos.CO.UK. 7.35 PTR eagle.Inmos.CO.UK. 204.35 PTR trout.Inmos.CO.UK. (1) I believe that a "PTR" record is a pointer record, and must point to a "real" RR. (2) I believe that the "real" RR should be in the forward domain. (3) I believe that this only works because BIND synthesizes A-records out of reverse PTR records. On the other hand, I am quite willing to believe that I'm all wrong. -- / Lars Poulsen, SMTS Software Engineer CMC Rockwell lars@CMC.COM