/*
* dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2009 Roy Marples <roy@marples.name>
+ * Copyright (c) 2006-2010 Roy Marples <roy@marples.name>
* All rights reserved
* Redistribution and use in source and binary forms, with or without
switch (iface->family) {
case ARPHRD_ETHER:
case ARPHRD_IEEE802:
- dhcp->hwlen = ETHER_ADDR_LEN;
- memcpy(&dhcp->chaddr, &iface->hwaddr, ETHER_ADDR_LEN);
- break;
- case ARPHRD_IEEE1394:
- case ARPHRD_INFINIBAND:
- dhcp->hwlen = 0;
- if (dhcp->ciaddr == 0 &&
- type != DHCP_DECLINE && type != DHCP_RELEASE)
- dhcp->flags = htons(BROADCAST_FLAG);
+ dhcp->hwlen = iface->hwlen;
+ memcpy(&dhcp->chaddr, &iface->hwaddr, iface->hwlen);
break;
}
+ if (ifo->options & DHCPCD_BROADCAST &&
+ dhcp->ciaddr == 0 &&
+ type != DHCP_DECLINE &&
+ type != DHCP_RELEASE)
+ dhcp->flags = htons(BROADCAST_FLAG);
+
if (type != DHCP_DECLINE && type != DHCP_RELEASE) {
if (up < 0 || up > (time_t)UINT16_MAX)
dhcp->secs = htons((uint16_t)UINT16_MAX);
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd January 14, 2009
+.Dd January 18, 2010
.Dt DHCPCD 8 SMM
.Os
.Sh NAME
.Nd an RFC 2131 compliant DHCP client
.Sh SYNOPSIS
.Nm
-.Op Fl bdgknpqwABDEGHKLTV
+.Op Fl bdgknpqwABDEGHJKLTV
.Op Fl c , -script Ar script
.Op Fl e , -env Ar value
.Op Fl f , -config Ar file
.It Fl H , -xidhwaddr
Use the last four bytes of the hardware address as the DHCP xid instead
of a randomly generated number.
+.It Fl J , -broadcast
+Instructs the DHCP server to broadcast replies back to the client.
+Normally this is only set for non Ethernet interfaces,
+such as FireWire and InfiniBand.
+In most instances,
+.Nm
+will set this automatically.
.It Fl K , -nolink
Don't receive link messages for carrier status.
You should only have to use this with buggy device drivers or running
static void
usage(void)
{
- printf("usage: "PACKAGE" [-dgknpqwxyADEGHKLOTV] [-c script] [-f file]"
+ printf("usage: "PACKAGE" [-dgknpqwxyADEGHJKLOTV] [-c script] [-f file]"
" [-e var=val]\n"
" [-h hostname] [-i classID ] [-l leasetime]"
" [-m metric] [-o option]\n"
if (iface->hwlen > DHCP_CHADDR_LEN)
ifo->options |= DHCPCD_CLIENTID;
+ /* Firewire and InfiniBand interfaces require ClientID and
+ * the broadcast option being set. */
+ switch (iface->family) {
+ case ARPHRD_IEEE1394: /* FALLTHROUGH */
+ case ARPHRD_INFINIBAND:
+ ifo->options |= DHCPCD_CLIENTID | DHCPCD_BROADCAST;
+ break;
+ }
+
free(iface->clientid);
if (*ifo->clientid) {
iface->clientid = xmalloc(ifo->clientid[0] + 1);
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd January 14, 2010
+.Dd January 28, 2010
.Dt DHCPCD.CONF 5 SMM
.Os
.Sh NAME
is ignored if
.Ic whitelist
is set.
+.It Ic broadcast
+Instructs the DHCP server to broadcast replies back to the client.
+Normally this is only set for non Ethernet interfaces,
+such as FireWire and InfiniBand.
+In most cases,
+.Nm dhcpcd
+will set this automatically.
.It Ic env Ar value
Push
.Ar value
{"nogateway", no_argument, NULL, 'G'},
{"xidhwaddr", no_argument, NULL, 'H'},
{"clientid", optional_argument, NULL, 'I'},
+ {"broadcast", no_argument, NULL, 'J'},
{"nolink", no_argument, NULL, 'K'},
{"noipv4ll", no_argument, NULL, 'L'},
{"destination", required_argument, NULL, 'N'},
ifo->options |= DHCPCD_CLIENTID;
ifo->clientid[0] = (uint8_t)s;
break;
+ case 'J':
+ ifo->options |= DHCPCD_BROADCAST;
+ break;
case 'K':
ifo->options &= ~DHCPCD_LINK;
break;
/* Don't set any optional arguments here so we retain POSIX
* compatibility with getopt */
-#define IF_OPTS "bc:de:f:gh:i:kl:m:no:pqr:s:t:u:v:wxy:z:ABC:DEF:GHI:KLN:O:Q:S:TVW:X:Z:"
+#define IF_OPTS "bc:de:f:gh:i:kl:m:no:pqr:s:t:u:v:wxy:z:ABC:DEF:GHI:JKLN:O:Q:S:TVW:X:Z:"
#define DEFAULT_TIMEOUT 30
#define DEFAULT_REBOOT 10
#define DHCPCD_WAITUP (1 << 26)
#define DHCPCD_CSR_WARNED (1 << 27)
#define DHCPCD_XID_HWADDR (1 << 28)
+#define DHCPCD_BROADCAST (1 << 29)
extern const struct option cf_options[];