version.h
dhcpcd
dhcpcd.8
+dhcpcd.conf.5
dhcpcd.sh
+dhcpcd.sh.8
dhcpcd-*.bz2
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}
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
If your linux headers are older, or your distro hasn't patched them you can
set CSTD=gnu99 to work around this.
+
+Hooks
+-----
+We provide example exit hooks for looking up the hostname in DNS,
+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.
-Hooks
------
-We provide example exit hooks for looking up the hostname in DNS,
-NTP (www.ntp.org) and ypbind (Linux).
-There are not installed by default as they are platform dependant.
+dhcpcd-4 is NOT fully commandline compatible with dhcpcd-2 and older and
+changes the meaning of some options.
ChangeLog
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);
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) {
.\" 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
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
.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
.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
.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.
/* 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'},
{"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'},
#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
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
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");
}
/* IPv4LL requires ARP */
options->options &= ~DHCPCD_IPV4LL;
break;
+ case 'D':
+ options->options |= DHCPCD_DUID;
+ break;
case 'E':
options->options |= DHCPCD_LASTLEASE;
break;
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':
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));
print_options();
goto abort;
#ifdef CMDLINE_COMPAT
- case 'H':
+ case 'H': /* FALLTHROUGH */
+ case 'M':
break;
case 'N':
del_reqmask(options->reqmask, DHCP_NTPSERVER);
.\" 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
.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.
.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
.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
#define DHCPCD_TEST (1 << 16)
#define DHCPCD_FORKED (1 << 17)
#define DHCPCD_HOSTNAME (1 << 18)
+#define DHCPCD_CLIENTID (1 << 19)
struct options {
char interface[IF_NAMESIZE];