# 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 seem to 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
is an example only.  It 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 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. **
**********************************************************************

* For glibc 2.0 base systems you will need to set up /etc/nsswitch.conf
* to use the DNS for hosts lookup.  e.g. a line like:
* 
*  hosts:      files dns
*
* will need adding instead of the hosts.conf stuff.

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 are on a machine which will not see the unicast replies and you
have a server which supports the bpboradcast bit (most seem to), then
use the new --serverbcast option.  This is needed on Linux 2.1.x for
recent x (certainly for 130 and newer).

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 have
nothing but ethernet here, so I've got little experience with using
bootpc on other types of network.  I've had some success reports (and
patches sent back, so it must work for some people).

  -- 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
