[comp.unix.questions] Sun DNS resolver question

IJAH400@indyvax.iupui.edu (James A. Harvey) (01/03/91)

I have a problem with domain name resolving on a Sun Sparcstation running
SunOS 4.0.3 that is driving me mad.  I have read and re-read the Sun manuals
and the man pages on the system and cannot figure out what I am doing wrong.

The machine in question, hummer.iupui.edu, is the primary nameserver for the
domain iupui.edu.  BIND (named) is running just fine and the machine responds
to DNS queries from other hosts just fine.  The file /etc/resolv.conf exists,
is world readable, and contains the two lines:

domain iupui.edu
nameserver 127.0.0.1

The nslookup utility appears to function exactly as expected, that is, it
uses "iupui.edu" as the default domain, and the loopback address for the
default name server.  However, none of the TCP/IP client programs try to
do DNS queries at all; if the hostname given isn't in /etc/hosts, they all
lose with an "unknown host" error.  How does the resolver know to use the
/etc/hosts file or a domain name server?  I'm missing something here...
Thanks in advance of any help, and please cc: any replies to one of the
addresses below, as I don't get to read INFO-UNIX very often.

James Harvey, IUPUI Computing Services   IJAH400@IUPUI.EDU | HARVEY@INDIANA.EDU
799 West Michigan Street, ET Room 1023          UUCP: {...}!iuvax!iugate!harvey
Indianapolis, IN  46202-5160  (317)274-0747            BITNET:  IJAH400@INDYVAX

boyter@bimbo.uucp (Maj Brian Boyter) (01/04/91)

IJAH400@indyvax.iupui.edu (James A. Harvey) writes:
>The nslookup utility appears to function exactly as expected, that is, it
>uses "iupui.edu" as the default domain, and the loopback address for the
>default name server.  However, none of the TCP/IP client programs try to
>do DNS queries at all; if the hostname given isn't in /etc/hosts, they all
>lose with an "unknown host" error.  How does the resolver know to use the
>/etc/hosts file or a domain name server?  I'm missing something here...

Yo Jim...

You need a new /usr/lib/libc.so...

If you are running 4.0.3, you can get the sendmail(use the .mx one),
ypbind, and libc.so, ftpd, etc from directory sun-fixes on
uunet.uu.net....   Take a look at the README in that same
directory...   I can vouch for the fact that this works...

If you upgrade to 4.1 then you need to build your own libc.so...
The directions were posted in Apr 90....
I can vouch for the fact that they work with SunOS 4.1...
Here they are:


  From: earle@poseur.jpl.nasa.gov (Greg Earle - Sun JPL Software Support)
  Newsgroups: comp.sys.sun
  Subject: Revised posting on how to create libc_resolv.so under SunOS 4.1
  Date: 19 May 90 03:59:57 GMT
  X-Sun-Spots-Digest: Volume 9, Issue 176, message 3

Evan Wetstone's posting to Sun-Spots about libc+resolv under 4.1 has
reminded me to repost a slightly revised version of the instructions.
This is prompted by 3 things:

1. The original, virgin /usr/lib/shlib.etc/README file has an oversight
   in it; The original mentions that 2 files in the archive library need to
   be renamed after they are extracted, because the names are truncated at 16
   characters.  This is true for the Sun-3 and Sun-3x, but on Sun-4's and
   Sun-4c's (SPARCstation-1's, 1+'s, and presumably SLC's), there is an
   additional library module whose name is also truncated.  This is
   corrected.

2. Several people complained to me that my instructions, being placed as
   an addendum rather than in line with the rest of the instructions, were
   thus unneccessarily confusing, and could even (if misinterpreted) cause
   someone to build a libc that would not work.

3. I accidentally included my .signature file at the end of the posting,
   and then told everyone to append the rest of my message to their README
   files, thus immortalizing my .signature in everybody's README (^:  I
   humbly apologize ...

So, without further ado, here is the revised version of the file
/usr/lib/shlib.etc/README.  I recommend backing up the original, nuke my
previous version (the one that Evan re-posted), and insert this in its
place.

Greg Earle			| "This is Kraft.  It uses a blue box.
Sun Microsystems, Inc.		|  This is Stouffer's.  It uses red.
JPL on-site Software Support	|  The choice is yours."
sun!poseur!earle		| Pretty damn convincing argument, eh?

-------------  >8  Cut here - /usr/lib/shlib.etc/README  8<  ---------------

This is a procedure you can use to substitute or add 
a module in your shared libc C library. 

Note! If you are interested in a System V libc, please substitute
	libc_pic.a for libcs5_pic.a in step 3, 
	libc.so.x.y.z for libcs5.so.x.y.z in step 8.

1. Become super user
     % su

2. Make a temporary directory
     # mkdir tmp

3. Change to the "tmp" directory just made, extract the pic .o from
   libc_pic.a and rm the file __.SYMDEF. The reason you need to do the 2 (or
   3) "mv" commands is because "ar" truncated filenames over 16 characters.
     # cd tmp
     # ar x ../libc_pic.a
     # rm __.SYMDEF
     # mv rpc_dtablesize. rpc_dtablesize.o
     # mv rpc_commondata. rpc_commondata.o
   If on a Sun-4, perform this additional `mv' command:
     # mv xccs_multibyte. xccs_multibyte.o

   Here are some extra instructions for building a shared libc.so that uses
   the resolver for hostname/addr resolution:

3a. Extract the contents of libc_pic.a and /usr/lib/libresolv.a into the
    tmp directory:
     # ar x /usr/lib/libresolv.a

    The libresolv.a contains object modules that are position independant, so
    they can be added to the libc_pic modules.

    *Note*  If you have your own copy of the resolver library sources,
    (perhaps from a post-4.8 BIND distribution) you can compile each of these
    modules yourself using `cc -pic' and the resulting object modules *should*
    be usable in this schema as well.  To test that the custom resolver
    modules will be usable, cd to the directory containing the custom resolver
    sources and object modules and perform this test:

     # ld -assert pure-text *.o

    If `ld' issues no complaints, then you can assume that the object modules
    are safe to use.

3b. Remove the old routine to do the hostname/addr resolution:
     # rm gethostent.o

3c. Remove the libresolv module that contains `strncasecmp' (which is now
    in the main C library, so it is redundant):
     # rm strcasecmp.o

3d. As mentioned in step 5 below, edit the file `lorder-sparc' in the ..
    directory.  Remove the reference to `gethostent.o' and add the references
    to the resolver library routines by applying this patch:

	*** lorder-sparc.orig	Thu Feb  8 05:27:46 1990
	--- lorder-sparc	Mon Apr  9 12:58:59 1990
	***************
	*** 150,154 ****
	  getwd.o
	  getnetgrent.o
	! gethostent.o
	  ypxdr.o
	  ttyname.o
	--- 150,161 ----
	  getwd.o
	  getnetgrent.o
	! gethostnamadr.o
	! sethostent.o
	! res_query.o
	! res_mkquery.o
	! res_send.o
	! res_debug.o
	! res_comp.o
	! res_init.o
	  ypxdr.o
	  ttyname.o

3e. Continue on, from steps 6 to 9 (i.e., skip steps 4 and 5 immediately
    below).

4. Replace or add the .o that you wanted by doing a copy. Please note here
   that you are advised to create your object with the following compiler
   option, i.e "cc -c -pic yourprogram.c" to make it shareable.
     # cp your.o .

5. If you add a new module then you need to do this step.  You need to
   edit the file "lorder-sparc" and add the name of the file you have copied
   from step 4 at the end of this file. 
     # vi ../lorder-sparc

6. # cd ..

7. # make libc.so

8. Now you should have some libc.so.x.y.z built in the current directory.
   It is recommended that you tested out this library at this point before
   installing it. You can do so by setting the environment LD_LIBRARY_PATH
   to the current directory for example:
     # setenv LD_LIBRARY_PATH `pwd`
     # your_favorite_test_cmd
   Once you are satisfied that the new library worked, you can proceed to
   install it with the following commands:
     # cp libc.so.x.y.z /usr/lib
     # ldconfig
     # unsetenv LD_LIBRARY_PATH

9. You are now running with the new library. You can verify this by doing
   a trace command of let's say "date".
     # trace date
   The output should informed you that the new library is being used.

----------------------------------------------------------------------------

Brian

-- 
---------------------------------------------------------------
   Maj. Brian A Boyter
   US Army Foreign Science & Technology Center
   Charlottesville, Va 22901                         __
   off: (804)980-7362                              (    )
   home:     973-9440                             {      }
                                                   (    )
   boyter@fstc-chville.army.mil                      ||
                                                     ||
   Just say glow......                       _______<  >_______