SUMMARY: Need to add DNS to Sun OS 4.1

Date: Wed Oct 30 1991 - 18:14:24 CST

  And .. here are the answers. Many thanks to Matt Crawford for the more
amusing reply, Hal Stern for the same reply without the amusing header,
and to Casper H.S. Dik for the specific instructions on how to turn on
NIS and DNS via the NIS makefiles.

------- Forwarded Message


If the following were on paper, it would be a ragged, smudged,
multiply zeroxed and faxed mess. Instead, thanks to the digital
communications revolution, it appears with no less clarity than
it had the moment it was written ... and no more.

From: Greg Earle - Sun JPL on-site Software Support <>
Subject: Creating a with DNS resolver support (+ no YP) under SunOS 4.1
Date: Tue, 24 Apr 90 22:03:04 -0700

As it appears that SunOS 4.1 is now reaching our users in reasonable
quantities, we offer the following announcement for our Internet customers:

As you may know, the normal /usr/lib/* that ships with SunOS 4.x
contains the library routines gethostbyname(3) and gethostbyaddr(3) to do
host name and address resolution. These routines normally reference the
`hosts' NIS (nee YP) map first, and then fall back to looking in the
/etc/hosts file. By changing the NIS Makefile to invoke `makedbm' with the
`-b' option, one can arrange things so that NIS does lookups first to a DNS
(Domain Name Service) name server, via the resolver routines. This is the
Sun supported way of doing things.

But many of Sun's Internet customers want to be able to use resolver-based
lookups without having to run NIS/YP. In order to fill this void under SunOS
4.0.x, Sun created `' versions of the shared C library with the
gethostbyname()/gethostbyaddr() routines replaced by the equivalent functions
from the BIND nameserver distribution's resolver library (plus supporting
functions). These were made available via anonymous FTP on the host
`uunet.UU.NET', in the `sun-fixes' directory.

Now SunOS 4.1 has arrived, but there is no equivalent `'
available via this mechanism (anonymous FTP from `uunet.UU.NET'). This message
addresses this situation.

Fortunately, 2 things in SunOS 4.1 have come to the rescue:

(1) There is a selectable software category in the 4.1 Full Install called
    `Shlib Custom' that enables one to build custom shared libraries.
    This software gets installed in /usr/lib/shlib.etc, with a README file
    containing instructions on how to build your own custom shared C library.
    If you wish to build a version of with the resolver routines,
    make sure to select this category when installing SunOS 4.1.

(2) The version of /usr/lib/libresolv.a in 4.1 has been compiled with
    `cc -pic', thus producing position-independant code.

Thus, what follows is an additional set of comments that can be *directly*
*appended* (i.e., `cat <remainder-of-this-message> >> README') to the file
`/usr/lib/shlib.etc/README' which provides instructions on how to build a that will use the resolver for hostname/hostaddr resolution.

Sun can make no guarantees on this, but this method has been in use on
Internet hosts running SunOS 4.1FCS for 3 weeks now, doing telnet, rlogin,
ftp, etc. to hosts that are not in the hosts table (on hosts that do not
run NIS/YP), and it works without any known problems.

One final note: the method described below applies to Sun's supported SunOS 4.1
version of the resolver library (libresolv.a), which is based on BIND 4.8.
As many of you are aware, there are `post-4.8' versions of BIND floating around
out there. We are aware of versions from UC Berkeley, University of Toronto,
and University of Michigan, among others. Although these versions cannot be
supported, it is our opinion that if the code for these customized versions of
the resolver library adheres to proper shared library conventions, then if
the modules in these libraries are compiled with `cc -pic', the resulting
object modules should be usable in the manner described below for the shipped
/usr/lib/libresolv.a. A simple test will confirm whether this will work:

        % mkdir tmp ; cd tmp ; ar xv /path/to/your/custom/libresolv.a
        % ld -assert pure-text *.o

If there are non-PIC constructs in these objects, the assertion would tell you
about them. For more information about position-independant code and shared
libraries, please read Chapter 1 in the "Programming Utilities and Libraries"
manual that is included in the SunOS 4.1 documentation set. It is contained
in the binder labelled "Programmer's Overview - Utilities and Libraries" on
the spine.

Without further ado, here it is. As mentioned, cut off below the line,
save to a file, and then append that file to /usr/lib/shlib.etc/README.

        Greg Earle
        Sun Microsystems, Inc. - JPL on-site Software Support
        earle@poseur.JPL.NASA.GOV (direct)
        earle@Sun.COM (indirect)

- -------------------------------- >8 Cut here 8< ------------------------------

Supplemental instructions for building a shared that uses the resolver
for hostname/addr resolution:

10. Extract the contents of libc_pic.a and /usr/lib/libresolv.a into the
    tmp directory:
        % cd tmp
        % ar x ../libc_pic.a
        % ar x /usr/lib/libresolv.a

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

11. Remove the old routine to do the hostname/addr resolution:
        % rm gethostent.o

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

13. As mentioned in step 5 above, 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:

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

14. Continue as above, from steps 6 to 9.

- --
        - Greg Earle | It takes up to 40 dumb animals to
          Sun Los Angeles | make one fur coat ... but only one
          JPL on-site Software Support | to wear it.
          sun!poseur!earle | Fur - the look that kills.

------- End of Forwarded Message

Subject: Re: Need to add DNS to Sun OS 4.1

The easy way to do this is:

        install /etc/resolv.conf (pointing to your nameserver)
        go to "/var/yp" on your NIS server.
        edit /var/yp/Makefile and set ``B=-b''
        # rm hosts.time
        # make

Your suns will then use NIS and NIS will look in DNS, if it doesn't
know the answer.


This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:17 CDT