summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/sd-dhcp-client.c
diff options
context:
space:
mode:
authorCamilo Aguilar <camilo.aguilar@gmail.com>2014-05-28 14:43:37 -0400
committerTom Gundersen <teg@jklm.no>2014-06-03 10:55:46 +0200
commit63a070415db09f5b5bcc5c487bfc85dabe443dde (patch)
tree40a0d539896f35bda5a8ea9a945cce457c7ef361 /src/libsystemd-network/sd-dhcp-client.c
parent682265d5e2157882861b0091c6b81fa92699b72a (diff)
sd-dhcp-client: allways request broadcast
On systems which cannot receive unicast packets until its IP stack has been configured we need to request broadcast packets. We are currently not able to reliably detect when this is necessary, so set it unconditionally for now. This is set on all packets, but the DHCP server will only broadcast the packets that are necessary, and unicast the rest. For more information please refer to this thread in CoreOS: https://github.com/coreos/bugs/issues/12 [tomegun: rephrased commit message]
Diffstat (limited to 'src/libsystemd-network/sd-dhcp-client.c')
-rw-r--r--src/libsystemd-network/sd-dhcp-client.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c
index 0300a6be93..8f549060bf 100644
--- a/src/libsystemd-network/sd-dhcp-client.c
+++ b/src/libsystemd-network/sd-dhcp-client.c
@@ -286,6 +286,15 @@ static int client_message_init(sd_dhcp_client *client, DHCPPacket **ret,
refuse to issue an DHCP lease if 'secs' is set to zero */
packet->dhcp.secs = htobe16(client->secs);
+ /* RFC2132 section 4.1
+ A client that cannot receive unicast IP datagrams until its protocol
+ software has been configured with an IP address SHOULD set the
+ BROADCAST bit in the 'flags' field to 1 in any DHCPDISCOVER or
+ DHCPREQUEST messages that client sends. The BROADCAST bit will
+ provide a hint to the DHCP server and BOOTP relay agent to broadcast
+ any messages to the client on the client's subnet. */
+ packet->dhcp.flags = htobe16(0x8000);
+
/* RFC2132 section 4.1.1:
The client MUST include its hardware address in the ’chaddr’ field, if
necessary for delivery of DHCP reply messages.