ndhc/ndhc
2011-03-30 16:41:29 -04:00
..
arp.c Remove dhcpd.h. 2011-03-30 05:55:12 -04:00
arp.h Rename arpping.[ch] to arp.[ch]. 2010-12-24 09:58:47 -05:00
CMakeLists.txt Use netlink for getting interface mac and index in ndhc instead of ioctl. 2011-03-29 14:37:45 -04:00
config.h Wire up the netlink socket to the epoll handler. Still need to actually 2011-03-29 15:34:00 -04:00
COPYING Initial commit. 2010-11-12 04:02:18 -05:00
dhcpmsg.c Change parameters for add_option_request_list(). 2011-03-30 16:05:28 -04:00
dhcpmsg.h Remove dhcpd.h. 2011-03-30 05:55:12 -04:00
ifchange.c Untabify and headerize ifchange.[ch]. 2011-03-30 16:38:53 -04:00
ifchange.h Untabify and headerize ifchange.[ch]. 2011-03-30 16:38:53 -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 Add new code for creating DHCP option data, and use it in ndhc.c. 2011-03-30 07:05:00 -04:00
netlink.c Move add_requests() from dhcpmsg.c to options.c. Fixes a layering violation. 2011-03-30 07:26:42 -04:00
netlink.h Wire up the netlink socket to the epoll handler. Still need to actually 2011-03-29 15:34:00 -04:00
options.c Remove a unnecessary debug print from add_u32_option(). 2011-03-30 16:41:29 -04:00
options.h Untabify options.[ch]. 2011-03-30 16:35:23 -04:00
packet.c Do more boundary and sanity checking when adding dhcp options. 2011-03-30 15:57:01 -04:00
packet.h Move change_listen_mode to packet.c. 2010-12-24 09:41:52 -05:00
README Rewrite get_option(): new version fixes at least one bug, and is much easier 2011-03-30 09:35:17 -04:00
socket.c Remove dhcpd.h. 2011-03-30 05:55:12 -04:00
socket.h Use netlink for getting interface mac and index in ndhc instead of ioctl. 2011-03-29 14:37:45 -04:00
sys.c After fork(), a signalfd-created file descriptor still returns signal info 2010-12-27 10:05:43 -05:00
sys.h After fork(), a signalfd-created file descriptor still returns signal info 2010-12-27 10:05:43 -05:00
timeout.c After fork(), a signalfd-created file descriptor still returns signal info 2010-12-27 10:05:43 -05:00
timeout.h Move timeout and arp handling code out to arpping.c and timeout.c. 2010-12-24 09:32:58 -05: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.