# Last updated : Tue Apr 16 17:27:46 1996
# $Revision: 1.3 $
# $Date: 1996/04/17 23:12:42 $
#
This code is based on the bootp client written by Charles Hawkins
<ceh@eng.cam.ac.uk> and tidied up a little by me.  I've added a few
things to make it conform to RFC1542 and it now parses RFC1497 BOOTP
magic cookies.  The Magic cookie parser is not complete, it ignores
the following TAGS:

	(2)  Time of Day,
	(13) BOOTP file size,
	(14) Merit dump filename
	(17) root pathname to mount
	(18) extentions, file to TFTP with more cookie in it.

Of there only (2) and (17) seem worth adding at this point.  (18) is a
real pain as it requires a TFTP client in the bootp setup.  I've not
had access to a bootpd which provides any of these so I can't easily
test them.

It does correctly parse the rest as far as I've been able to test with
the bootp servers I've got access to.  The script rc.bootp sets up the
IP layer from the bootp packet results, and is based loosely on the
startup script provided by Charles Hawkins <ceh@eng.cam.ac.uk>, but
with additions for the bootp cookies.  Hopefully now all the locations
of the binaries it uses are configurable at the top of rc.bootp saving
people the effort of trying to guess what needs changing for their
distribution.

The code is cleanly compiled by gcc -wall -pedantic, so should be ok ;-)

The setting up of the resolv.conf file is done if enough info can be
got from the bootp reply and/or the inverse lookup of the IP address
we were allocated (for those servers which supply DNS server info but
not the DNS domain name.)  For the reverse lookup to work (and DNS in
general), you must of course already have the order line include the
"bind" keyword in your host.conf file.  If all the domain name lookups
fail, but you still have an existing resolv.conf file, the script will
update the nameservers lines, leaving the domain/search line alone.

**********************************************************************
** I'll repeat that.  set up /etc/host.conf or this bit won't work. **
**********************************************************************

There are a few options near the top of rc.bootp which you may want to
alter for your setup:

Note that if you want the bootpc to give up after it fails, then you
need the --returniffail option to tell it to do so.  If this is set
then the return code signifies success or failure (0 for success, 1
for failure).

For testing bootp servers you may also want to check out the
--waitformore option.  This causes bootpc to wait for multple replies
and tell you about each of them.  e.g. I find that with the options:

  ./bootpc --server 131.111.255.255 --waitformore 20

I get multiple replies for some machines.  (131.111.255.255 is MY
broadcast address, use your own!, the 20 is how long to wait).  This
is handy with the --hwaddr option to see who would reply for a request
from a given MAC address.

If you have problems then please read the WHEN-IT-FAILS file, and
failing that please mail me.

This code is provided as-is, with no warrenty, share and enjoy.

Please report any bugs or problems and I'll try to fix them.

I'm still (!!!) about to get a SLIP connection (no PPP ;-) so wil be
able to test that as well as ethernet links soon.  The current version
is largely untested on network interfaces other than ethernet.  I'm
told that the current rc.bootp script makes for difficult use when
using SLIP, once I've tried it a few times myself I may agree.

I've been told that DIP 3.x now supports bootp directly which may be a
better way to go than to use this code with DIP.  I've had a cursory
look at it and it seems to do the job (I still can't test it).  Of
course the bootp client code in DIP doesn't extract as much info from
the server as this one does.  :-(

  -- Jon Peatfield  (DAMTP unix network admin)

Jon Peatfield, Computer Officer, the DAMTP, University of Cambridge
Telephone: +44 1223  3 37852    Mail: J.S.Peatfield@damtp.cam.ac.uk
