ndhc/ndhc
2011-07-01 05:35:38 -04:00
..
arp.c Keep track of whether the ARP BPF has been successfully installed. If it has, 2011-07-01 03:01:29 -04:00
arp.h Make frenew() less insane. It was most likely subtly buggy before depending 2011-06-30 03:43:09 -04:00
CMakeLists.txt Theoretical correctness fix: 2011-05-30 10:54:05 -04:00
config.h Make the DHCP BPF perform stricter checks. Now packets that have IP options 2011-07-01 04:14:10 -04:00
COPYING Initial commit. 2010-11-12 04:02:18 -05:00
ifchange.c Remove pointless length-checking in get_raw_packet() that can never be triggered 2011-06-26 17:25:00 -04:00
ifchange.h Remove pointless length-checking in get_raw_packet() that can never be triggered 2011-06-26 17:25:00 -04:00
leasefile.c fsync() the leasefile after writing a new lease IP so that it's instantly 2011-06-28 13:47:36 -04:00
leasefile.h Add support for writing lease files. 2011-04-19 16:37:43 -04:00
ndhc-defines.h Make write() and sendto() properly handle short writes and errors in ndhc. 2010-11-12 18:44:49 -05:00
ndhc.8 Initial commit. 2010-11-12 04:02:18 -05:00
ndhc.c C99 designated initializers guarantee zero-init of unspecified members. 2011-06-30 22:02:28 -04:00
netlink.c Hide details of the listen mode implementation in packet.c. 2011-06-30 21:33:38 -04:00
netlink.h Centralize DHCP timeout, packet reciept, and user-demanded action handling 2011-06-29 23:47:31 -04:00
options.c Cosmetic cleanups to options.c. 2011-06-27 15:19:54 -04:00
options.h Make the various functions in options.c that take a pointer to an options 2011-06-27 12:53:35 -04:00
packet.c Cosmetic cleanup of create_udp_listen_socket() to eliminate invariant 2011-07-01 05:35:38 -04:00
packet.h Hide details of the listen mode implementation in packet.c. 2011-06-30 21:33:38 -04:00
README Theoretical correctness fix: 2011-05-30 10:54:05 -04:00
state.c Hide details of the listen mode implementation in packet.c. 2011-06-30 21:33:38 -04:00
state.h Rename ARP_GW_CHECK to BOUND_GW_CHECK and call anfrelease() rather than 2011-06-30 00:39:17 -04:00
sys.c Theoretical correctness fix: 2011-05-30 10:54:05 -04:00
sys.h Theoretical correctness fix: 2011-05-30 10:54:05 -04:00

ndhc client
--------------------

The ndhc client negotiates a lease with the DHCP server and notifies
ifchd when a leases is obtained or lost.


command line options
-------------------

The command line options for the ndhc client are:

-c, --clientid=CLIENTID         Client identifier
-H, --hostname=HOSTNAME         Client hostname
-h,				Alias for -H
-f, --foreground                Do not fork after getting lease
-b, --background                Fork to background if lease cannot be
                                immediately negotiated.
-i, --interface=INTERFACE       Interface to use (default: eth0)
-n, --now                       Exit with failure if lease cannot be
                                immediately negotiated.
-q, --quit                      Quit after obtaining lease
-r, --request=IP                IP address to request (default: none)
-v, --version                   Display version


If the requested IP address cannot be obtained, the client accepts the
address that the server offers.


note on ndhc's random seed
---------------------------

ndhc will seed its random number generator (used for generating xids)
by reading /dev/urandom. If you have a lot of embedded systems on the same
network, with no entropy, you can either seed /dev/urandom by a method of
your own, or doing the following on startup:

ifconfig eth0 > /dev/urandom

in order to seed /dev/urandom with some data (mac address) unique to your
system. If reading /dev/urandom fails, ndhc will fall back to its old
behavior of seeding with time(0).


signals accepted by ndhc
-------------------------

ndhc also responds to SIGUSR1 and SIGUSR2. SIGUSR1 will force a renew state,
and SIGUSR2 will force a release of the current lease, and cause ndhc to
go into an inactive state (until it is killed, or receives a SIGUSR1). You do
not need to sleep between sending signals, as signals received are processed
sequentially in the order they are received.

DHCP pitfalls
-------------

Send a packet that has an options field set to:
DHCP-OPTION-OVERLOAD:3

Then in the file and sname fields:
DHCP-OPTION-OVERLOAD:3

I suspect some bad dhcp programs will hang given this input.