mirror of
https://github.com/rsmarples/dhcpcd.git
synced 2024-11-23 18:14:09 +08:00
Don't use a DUID by default even though support is compiled in, #70. Also, fix some man page entries a little.
This commit is contained in:
parent
5a0bf07060
commit
d2616b0835
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,5 +2,7 @@
|
||||
version.h
|
||||
dhcpcd
|
||||
dhcpcd.8
|
||||
dhcpcd.conf.5
|
||||
dhcpcd.sh
|
||||
dhcpcd.sh.8
|
||||
dhcpcd-*.bz2
|
||||
|
2
Makefile
2
Makefile
@ -12,7 +12,7 @@ MAN5= dhcpcd.conf.5
|
||||
MAN8= dhcpcd.8 dhcpcd.sh.8
|
||||
|
||||
VERSION= 4.0.0-alpha3
|
||||
CLEANFILES= dhcpcd.sh dhcpcd.8 dhcpcd.sh.8
|
||||
CLEANFILES= dhcpcd.sh dhcpcd.conf.5 dhcpcd.8 dhcpcd.sh.8
|
||||
|
||||
BINDIR= ${PREFIX}/sbin
|
||||
SYSCONFDIR?= ${PREFIX}/etc/${PROG}
|
||||
|
27
README
27
README
@ -5,12 +5,7 @@ Copyright 2006-2008 Roy Marples <roy@marples.name>
|
||||
Installation
|
||||
------------
|
||||
Edit config.h to match your building requirements.
|
||||
|
||||
Take special note of ENABLE_DUID and unset it if the target media is
|
||||
volatile, like say a LiveCD.
|
||||
|
||||
Then just make; make install
|
||||
|
||||
man dhcpcd for command line options
|
||||
|
||||
|
||||
@ -33,12 +28,6 @@ linux-2.6.24 finally ships with a working 32-bit header.
|
||||
If your linux headers are older, or your distro hasn't patched them you can
|
||||
set CSTD=gnu99 to work around this.
|
||||
|
||||
If you require compatibility with dhcpcd-3 and older style variables,
|
||||
you can install dhcpcd-compat into the directory /etc/dhcpcd/enter-hook.d
|
||||
We don't install this by default.
|
||||
You should also add -DCMDLINE_COMPAT to your CFLAGS if you need to be fully
|
||||
commandline compatible with prior versions.
|
||||
|
||||
|
||||
Hooks
|
||||
-----
|
||||
@ -47,6 +36,22 @@ NTP (www.ntp.org) and ypbind (Linux).
|
||||
There are not installed by default as they are platform dependant.
|
||||
|
||||
|
||||
Compatibility
|
||||
-------------
|
||||
If you require compatibility with dhcpcd-3 and older style variables,
|
||||
you can install dhcpcd-compat into the directory /etc/dhcpcd/enter-hook.d
|
||||
We don't install this by default.
|
||||
You should also add -DCMDLINE_COMPAT to your CFLAGS if you need to be fully
|
||||
commandline compatible with prior versions.
|
||||
|
||||
dhcpcd-3 enabled DUID support by default - this has changed in dhcpcd-4.
|
||||
You can enable it via the --duid, -D command line option or by using the
|
||||
duid directive in dhcpcd.conf.
|
||||
|
||||
dhcpcd-4 is NOT fully commandline compatible with dhcpcd-2 and older and
|
||||
changes the meaning of some options.
|
||||
|
||||
|
||||
ChangeLog
|
||||
---------
|
||||
We no longer supply a ChangeLog.
|
||||
|
2
client.c
2
client.c
@ -478,7 +478,7 @@ client_setup(struct if_state *state, const struct options *options)
|
||||
memcpy(iface->clientid + 1,
|
||||
options->clientid, iface->clientid_len - 1);
|
||||
}
|
||||
} else {
|
||||
} else if (options->options & DHCPCD_CLIENTID) {
|
||||
#ifdef ENABLE_DUID
|
||||
if (options->options & DHCPCD_DUID) {
|
||||
duid = xmalloc(DUID_LEN);
|
||||
|
10
dhcp.c
10
dhcp.c
@ -764,10 +764,12 @@ make_message(struct dhcp_message **message,
|
||||
p += 2;
|
||||
}
|
||||
|
||||
*p++ = DHCP_CLIENTID;
|
||||
*p++ = iface->clientid_len;
|
||||
memcpy(p, iface->clientid, iface->clientid_len);
|
||||
p+= iface->clientid_len;
|
||||
if (iface->clientid_len > 0) {
|
||||
*p++ = DHCP_CLIENTID;
|
||||
*p++ = iface->clientid_len;
|
||||
memcpy(p, iface->clientid, iface->clientid_len);
|
||||
p+= iface->clientid_len;
|
||||
}
|
||||
|
||||
if (type != DHCP_DECLINE && type != DHCP_RELEASE) {
|
||||
if (options->userclass_len > 0) {
|
||||
|
57
dhcpcd.8.in
57
dhcpcd.8.in
@ -22,14 +22,14 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd Apr 24, 2008
|
||||
.Dd May 01, 2008
|
||||
.Dt DHCPCD 8 SMM
|
||||
.Sh NAME
|
||||
.Nm dhcpcd
|
||||
.Nd an RFC 2131 compliant DHCP client
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl dknpAEGLSTV
|
||||
.Op Fl dknpADEGLSTV
|
||||
.Op Fl c , -script Ar script
|
||||
.Op Fl f , -config Ar file
|
||||
.Op Fl h , -hostname Ar hostname
|
||||
@ -144,7 +144,8 @@ is an FQDN (ie, contains a .) then it will be encoded as such.
|
||||
Override the DHCP vendor
|
||||
.Ar classid
|
||||
field we send. The default is
|
||||
dhcpcd-<version>.
|
||||
dhcpcd <version>.
|
||||
If not set then none is sent.
|
||||
.It Fl k , -release
|
||||
This causes an existing
|
||||
.Nm
|
||||
@ -229,6 +230,16 @@ Tags the DHCP message with the userclass
|
||||
.Ar class .
|
||||
DHCP servers use this give memebers of the class DHCP options other than the
|
||||
default, without having to know things like hardware address or hostname.
|
||||
.It Fl D , -duid
|
||||
Generate an
|
||||
.Rs
|
||||
.%T "RFC 4361"
|
||||
.Re
|
||||
compliant clientid. This requires persistent storage
|
||||
and not all DHCP servers work with it so it's not enabled by default.
|
||||
The DUID generated will be held in
|
||||
.Pa @SYSCONFDIR@/dhcpcd.duid
|
||||
and should not be copied to other hosts.
|
||||
.It Fl F , -fqdn Ar fqdn
|
||||
Requests that the DHCP server updates DNS using FQDN instead of just a
|
||||
hostname. Valid values for
|
||||
@ -237,18 +248,9 @@ are none, ptr and both.
|
||||
.Nm
|
||||
dhcpcd itself never does any DNS updates.
|
||||
.It Fl I , -clientid Ar clientid
|
||||
Send
|
||||
.Ar clientid
|
||||
as a client identifier string. If
|
||||
.Ar clientid
|
||||
matches a hardware address format, such as 01:00:01:02:03:04:05 then we encode
|
||||
it as that, otherwise as a string. You need to specify the hardware type in
|
||||
the first byte. Ethernet is 01, and the hardware address in the example is
|
||||
00:01:02:03:04:05. If the
|
||||
.Ar clientid
|
||||
is a blank string, then we disable DUID support and use a
|
||||
.Ar clientid
|
||||
as shown above.
|
||||
Change the default clientid sent from the interface hardware address.
|
||||
If the string is of the format 01:02:03 then it is encoded as hex.
|
||||
If not set then none is sent.
|
||||
.El
|
||||
.Ss Restriciting behaviour
|
||||
.Nm
|
||||
@ -277,31 +279,6 @@ Display a list of option codes and the associated variable for use in
|
||||
.Xr dhcpcd.sh 8 .
|
||||
.El
|
||||
.Sh NOTES
|
||||
Because
|
||||
.Nm
|
||||
supports InfiniBand, we put a Node-specific Client Identifier in the
|
||||
ClientID field. This is required by RFC 4390. It's also required for DHCP IPv6
|
||||
which
|
||||
.Nm
|
||||
should support one day. However, some DHCP servers have no idea what this is
|
||||
and reject the message as they do not understand type 255. This is not
|
||||
conformant with RFC 2132 and the server should be fixed. Also, some DHCP
|
||||
server configurations require an ethernet hardware address of 6 hexacdecimal
|
||||
numbers in the ClientID which is the default behaviour of most other DHCP
|
||||
clients. If your DHCP server is as desribed above, you should fix the server,
|
||||
or if that is not an option you can compile DUID support out of
|
||||
.Nm
|
||||
or use the
|
||||
.Fl I , -clientid Ar clientid
|
||||
option and set
|
||||
.Ar clientid
|
||||
to ''.
|
||||
.Pp
|
||||
ISC dhcpd, dnsmasq, udhcpd and Microsoft DHCP server 2003 default configurations
|
||||
work just fine with the default
|
||||
.Nm
|
||||
configuration.
|
||||
.Pp
|
||||
.Nm
|
||||
requires a Berkley Packet Filter, or BPF device on BSD based systems and a
|
||||
Linux Socket Filter, or LPF device on Linux based systems.
|
||||
|
38
dhcpcd.c
38
dhcpcd.c
@ -51,12 +51,11 @@ const char copyright[] = "Copyright (c) 2006-2008 Roy Marples";
|
||||
|
||||
/* Don't set any optional arguments here so we retain POSIX
|
||||
* compatibility with getopt */
|
||||
#define OPTS "c:df:h:i:kl:m:no:pr:s:t:u:xAEF:GHI:LO:STV"
|
||||
#define OPTS "c:df:h:i:kl:m:no:pr:s:t:u:xADEF:GHI:LO:STV"
|
||||
|
||||
static int doversion = 0;
|
||||
static int dohelp = 0;
|
||||
static const struct option longopts[] = {
|
||||
{"arp", no_argument, NULL, 'a'},
|
||||
{"script", required_argument, NULL, 'c'},
|
||||
{"debug", no_argument, NULL, 'd'},
|
||||
{"config", required_argument, NULL, 'f'},
|
||||
@ -74,6 +73,8 @@ static const struct option longopts[] = {
|
||||
{"userclass", required_argument, NULL, 'u'},
|
||||
{"exit", no_argument, NULL, 'x'},
|
||||
{"lastlease", no_argument, NULL, 'E'},
|
||||
{"noarp", no_argument, NULL, 'A'},
|
||||
{"duid", no_argument, NULL, 'D'},
|
||||
{"fqdn", optional_argument, NULL, 'F'},
|
||||
{"nogateway", no_argument, NULL, 'G'},
|
||||
{"clientid", optional_argument, NULL, 'I'},
|
||||
@ -89,12 +90,13 @@ static const struct option longopts[] = {
|
||||
#endif
|
||||
#ifdef CMDLINE_COMPAT
|
||||
{"nohostname", no_argument, NULL, 'H'},
|
||||
{"nodns", no_argument, NULL, 'R'},
|
||||
{"nomtu", no_argument, NULL, 'M'},
|
||||
{"nontp", no_argument, NULL, 'N'},
|
||||
{"nonis", no_argument, NULL, 'Y'},
|
||||
{"nodns", no_argument, NULL, 'R'},
|
||||
{"msscr", no_argument, NULL, 'S'},
|
||||
{"nonis", no_argument, NULL, 'Y'},
|
||||
#endif
|
||||
{NULL, 0, NULL, 0}
|
||||
{NULL, 0, NULL, '\0'}
|
||||
};
|
||||
|
||||
#ifdef THERE_IS_NO_FORK
|
||||
@ -103,8 +105,8 @@ char **dhcpcd_argv = NULL;
|
||||
int dhcpcd_argc = 0;
|
||||
char *dhcpcd_skiproutes = NULL;
|
||||
#define EXTRA_OPTS "XZ:"
|
||||
#elif defined(CMDLINE_COMPAT)
|
||||
# define EXTRA_OPTS "NRSY"
|
||||
#elif CMDLINE_COMAPT
|
||||
# define EXTRA_OPTS "HMNRSY"
|
||||
#endif
|
||||
|
||||
#ifndef EXTRA_OPTS
|
||||
@ -149,9 +151,9 @@ read_pid(const char *pidfile)
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
printf("usage: "PACKAGE" [-adknpEGHLOSTV] [-c script] [-f file ] [-h hostname] [-i classID]\n"
|
||||
" [-l leasetime] [-m metric] [-o option] [-r ipaddress]\n"
|
||||
" [-s ipaddress] [-t timeout] [-u userclass] [-F none | ptr | both]\n"
|
||||
printf("usage: "PACKAGE" [-dknpADEGHLOSTV] [-c script] [-f file ] [-h hostname]\n"
|
||||
" [-i classID ] [-l leasetime] [-m metric] [-o option] [-r ipaddr]\n"
|
||||
" [-s ipaddr] [-t timeout] [-u userclass] [-F none|ptr|both]\n"
|
||||
" [-I clientID] <interface>\n");
|
||||
}
|
||||
|
||||
@ -278,6 +280,9 @@ parse_option(int opt, char *oarg, struct options *options)
|
||||
/* IPv4LL requires ARP */
|
||||
options->options &= ~DHCPCD_IPV4LL;
|
||||
break;
|
||||
case 'D':
|
||||
options->options |= DHCPCD_DUID;
|
||||
break;
|
||||
case 'E':
|
||||
options->options |= DHCPCD_LASTLEASE;
|
||||
break;
|
||||
@ -310,13 +315,15 @@ parse_option(int opt, char *oarg, struct options *options)
|
||||
return -1;
|
||||
}
|
||||
if (strlcpy(options->clientid, oarg,
|
||||
sizeof(options->clientid)) == 0)
|
||||
sizeof(options->clientid)) == 0) {
|
||||
/* empty string disabled duid */
|
||||
options->options &= ~DHCPCD_DUID;
|
||||
options->options &= ~DHCPCD_CLIENTID;
|
||||
}
|
||||
} else {
|
||||
memset(options->clientid, 0,
|
||||
sizeof(options->clientid));
|
||||
options->clientid[0] = '\0';
|
||||
options->options &= ~DHCPCD_DUID;
|
||||
options->options &= ~DHCPCD_CLIENTID;
|
||||
}
|
||||
break;
|
||||
case 'L':
|
||||
@ -395,7 +402,7 @@ main(int argc, char **argv)
|
||||
PACKAGE, VERSION);
|
||||
|
||||
options->options |= DHCPCD_GATEWAY | DHCPCD_ARP | DHCPCD_IPV4LL |
|
||||
DHCPCD_DUID | DHCPCD_DAEMONISE;
|
||||
DHCPCD_DAEMONISE | DHCPCD_CLIENTID;
|
||||
options->timeout = DEFAULT_TIMEOUT;
|
||||
|
||||
gethostname(options->hostname, sizeof(options->hostname));
|
||||
@ -598,7 +605,8 @@ main(int argc, char **argv)
|
||||
print_options();
|
||||
goto abort;
|
||||
#ifdef CMDLINE_COMPAT
|
||||
case 'H':
|
||||
case 'H': /* FALLTHROUGH */
|
||||
case 'M':
|
||||
break;
|
||||
case 'N':
|
||||
del_reqmask(options->reqmask, DHCP_NTPSERVER);
|
||||
|
@ -22,7 +22,7 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd Apr 24, 2008
|
||||
.Dd May 01, 2008
|
||||
.Dt DHCPCD.CONF 5 SMM
|
||||
.Sh NAME
|
||||
.Nm dhcpcd.conf
|
||||
@ -41,19 +41,29 @@ Blank lines and lines starting with # are ignored.
|
||||
.Pp
|
||||
Here's a list of available options:
|
||||
.Bl -tag -width indent
|
||||
.It Ic option Ar dhcp-option
|
||||
Requests the
|
||||
.Ar dhcp-option
|
||||
from the server. It can be a variable to be used in
|
||||
.Xr dhcpcd.sh 8
|
||||
or the numerical value. You can specify more seperated by commas, spaces or
|
||||
more option lines.
|
||||
.It Ic classid Ar string
|
||||
Change the default classid sent from dhcpcd-version. If not set then none
|
||||
is sent.
|
||||
.It Ic clientid Ar string
|
||||
Change the default clientid sent from the interface hardware address.
|
||||
If the string is of the format 01:02:03 then it is encoded as hex.
|
||||
If not set then none is sent.
|
||||
.It Ic duid
|
||||
Generate an
|
||||
.Rs
|
||||
.%T "RFC 4361"
|
||||
.Re
|
||||
compliant clientid. This requires persistent storage
|
||||
and not all DHCP servers work with it so it's not enabled by default.
|
||||
The duid generated will be held in
|
||||
.Pa @SYSCONFDIR@/dhcpcd.duid
|
||||
and should not be copied to other hosts.
|
||||
.It Ic hostname Ar name
|
||||
Sends specified
|
||||
.Ar hostname
|
||||
o the DHCP server so it can be registered in DNS. If
|
||||
to the DHCP server so it can be registered in DNS. If
|
||||
.Ar hostname
|
||||
if a FQDN (ie, contains a .) then it will be encoded a such.
|
||||
if a FQDN (ie, contains a .) then it will be encoded as such.
|
||||
.It Ic fqdn Op none | ptr | both
|
||||
none disables FQDN encoding, ptr just asks the DHCP server to update the PTR
|
||||
record of the host in DNS whereas both also updates the A record.
|
||||
@ -63,24 +73,6 @@ Subsequent options are only parsed for this
|
||||
.It Ic leasetime Ar seconds
|
||||
Request a leasetime of
|
||||
.Ar seconds .
|
||||
.It Ic timeout Ar seconds
|
||||
The default timeout for waiting for a DHCP response is 20 seconds which may
|
||||
be too long or too short and can be changed here.
|
||||
.It Ic classid Ar string
|
||||
Change the default classid sent from dhcpcd-version. If not set then none
|
||||
is sent.
|
||||
.It Ic clientid Ar string
|
||||
By default,
|
||||
.Nm dhcpcd
|
||||
sends a Client Node Identifier
|
||||
.Rs
|
||||
.%T "RFC 4361"
|
||||
.Re
|
||||
as the ClientID. Not setting anything causes the interface MAC address to
|
||||
be sent instead. Otherwise, it sends the string specified. If the string
|
||||
is of the format 01:02:03 then it encodes it.
|
||||
.It Ic userclass Ar string
|
||||
Tag the DHCP messages with the userclass. You can specify more than one.
|
||||
.It Ic noarp
|
||||
Don't send any ARP requests. This also disables IPv4LL.
|
||||
.It Ic nogateway
|
||||
@ -91,6 +83,18 @@ See
|
||||
.Rs
|
||||
.%T "RFC 3927"
|
||||
.Re
|
||||
.It Ic option Ar dhcp-option
|
||||
Requests the
|
||||
.Ar dhcp-option
|
||||
from the server. It can be a variable to be used in
|
||||
.Xr dhcpcd.sh 8
|
||||
or the numerical value. You can specify more seperated by commas, spaces or
|
||||
more option lines.
|
||||
.It Ic timeout Ar seconds
|
||||
The default timeout for waiting for a DHCP response is 20 seconds which may
|
||||
be too long or too short and can be changed here.
|
||||
.It Ic userclass Ar string
|
||||
Tag the DHCP messages with the userclass. You can specify more than one.
|
||||
.Sh SEE ALSO
|
||||
.Xr dhcpcd.sh 8 ,
|
||||
.Xr dhcpcd 8
|
Loading…
Reference in New Issue
Block a user