File: README

package info (click to toggle)
udhcp 0.9.6-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 288 kB
  • ctags: 321
  • sloc: ansic: 2,426; makefile: 151; sh: 105
file content (158 lines) | stat: -rw-r--r-- 5,701 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
udhcp server/client package readme
-------------------------

The udhcp server/client package is primarily geared towards embedded
systems. It does however, strive to be fully functional, and RFC
compliant.

udhcp server (udhcpd)
--------------------

The udhcp server employs a number of simple config files:

udhcpd.leased
------------

The udhcpd.leases behavior is designed for an embedded system. The
file is written either every auto_time seconds, or when a SIGUSR1
is received. When the file is written, a script can be optionally
called to commit the file to flash. Lease times are stored in the
file by time remaining in lease (for systems without clock that works
when there is no power), or by the absolute time that it expires in
seconds from epoch. In the remainig format, expired leases are stored
as zero. The file is of the format:

16 byte MAC
4 byte ip address
u32 expire time
16 byte MAC
4 byte ip address
u32 expire time
.
etc.

example: hexdump udhcpd.leases

0000000 1000 c95a 27d9 0000 0000 0000 0000 0000
0000010 a8c0 150a 0d00 2d29 5000 23fc 8566 0000
0000020 0000 0000 0000 0000 a8c0 140a 0d00 4e29
0000030


udhcpd.conf
----------

The format is fairly simple, there is a sample file with all the
available options and comments describing them in samples/udhcpd.conf


udhcp client (udhcpc)
--------------------

The udhcp client negotiates a lease with the DHCP server and notifies
a set of scripts when a leases is obtained or lost. The command line
options for the udhcp client are:

-c, --clientid=CLIENTID         Client identifier
-H, --hostname=HOSTNAME         Client hostname
-f, --foreground                Do not fork after getting lease
-i, --interface=INTERFACE       Interface to use (default: eth0)
-n, --now                       Exit with failure if lease cannot be
                                immediately negotiated.
-p, --pidfile=file              Store process ID of daemon in file
-q, --quit                      Quit after obtaining lease
-r, --request=IP                IP address to request (default: none)
-s, --script=file               Run file at dhcp events (default:
                                /usr/share/udhcpc/default.script)
-v, --version                   Display version

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

When an event occurs, udhcpc calls the action script. The script by
default is /usr/share/udhcpc/default.script but this can be changed via 
the command line arguments. The three possible arguments to the script 
are:

	deconfig: This argument is used when udhcpc starts, and
	when a leases is lost. The script should put the interface in an
	up, but deconfigured state, ie: ifconfig $interface 0.0.0.0.
	
	bound: This argument is used when udhcpc moves from an
	unbound, to a bound state. All of the paramaters are set in
	enviromental variables, The script should configure the interface,
	and set any other relavent parameters (default gateway, dns server, 
	etc).
	
	renew: This argument is used when a DHCP lease is renewed. All of
	the paramaters are set in enviromental variables. This argument is
	used when the interface is already configured, so the IP address,
	will not change, however, the other DHCP paramaters, such as the
	default gateway, subnet mask, and dns server may change.

The paramaters for enviromental variables are as follows:

	$HOME		- The set $HOME env or "/"
	$PATH		- the set $PATH env or "/bin:/usr/bin:/sbin:/usr/sbin"
	$1		- What action the script should perform
	interface	- The interface this was obtained on
	ip		- The obtained IP
	siaddr		- The bootp next server option
	sname		- The bootp server name option
	boot_file	- The bootp boot file option
	subnet		- The assigend subnet mask
	timezone	- Offset in seconds from UTC
	router		- A list of routers
	timesvr		- A list of time servers
	namesvr		- A list of IEN 116 name servers
	dns		- A list of DNS server
	logsvr		- A list of MIT-LCS UDP log servers
	cookiesvr	- A list of RFC 865 cookie servers
	lprsvr		- A list of LPR servers
	hostname	- The assigned hostname
	bootsize	- The length in 512 octect blocks of the bootfile
	domain		- The domain name of the network
	swapsvr		- The IP address of the client's swap server
	rootpath	- The path name of the client's root disk
	ipttl		- The TTL to use for this network
	mtu		- The MTU to use for this network
	broadcast	- The broadcast address for this network
	ntpsrv		- A list of NTP servers
	wins		- A list of WINS servers
	lease		- The lease time, in seconds
	dhcptype	- DHCP message type (safely ignored)
	serverid	- The IP of the server
	tftp		- The TFTP server name
	bootfile	- The bootfile name

additional options are easily added in options.c.
	
udhcpc also responds to SIGUSR1 and SIGUSR2. SIGUSR1 will force a renew state,
and SIGUSR2 will force a release of the current lease, and cause udhcpc to
go into an inactive state (until it is killed, or receives a SIGUSR1).



compile time options
-------------------

The Makefile contains three of the compile time options:
	
	DEBUG: If DEBUG is defined, udhcpd will output extra debugging
	output, compile with -g, and not fork to the background when run.
	SYSLOG: If SYSLOG is defined, udhcpd will log all its messages
	syslog, otherwise, it will attempt to log them to stdout.
	
	COMBINED_BINARY: If COMBINED_BINARY is define, one binary, udhcpd,
	is created. If called as udhcpd, the dhcp server will be started.
	If called as udhcpc, the dhcp client will be started.
	
dhcpd.h contains the other two compile time options:
	
	LEASE_TIME: The default lease time if not specified in the config
	file.
	
	DHCPD_CONFIG_FILE: What config file to use.