summaryrefslogtreecommitdiff
path: root/src/libsystemd-dhcp/sd-dhcp-client.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsystemd-dhcp/sd-dhcp-client.c')
-rw-r--r--src/libsystemd-dhcp/sd-dhcp-client.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libsystemd-dhcp/sd-dhcp-client.c b/src/libsystemd-dhcp/sd-dhcp-client.c
index 63b7b24d87..01397cff39 100644
--- a/src/libsystemd-dhcp/sd-dhcp-client.c
+++ b/src/libsystemd-dhcp/sd-dhcp-client.c
@@ -206,11 +206,17 @@ static int client_message_init(sd_dhcp_client *client, DHCPMessage *message,
size_t *optlen) {
int r;
- r = dhcp_message_init(message, BOOTREQUEST, client->xid, type,
- secs, opt, optlen);
+ assert(secs);
+
+ r = dhcp_message_init(message, BOOTREQUEST, client->xid, type, opt,
+ optlen);
if (r < 0)
return r;
+ /* Although 'secs' field is a SHOULD in RFC 2131, certain DHCP servers
+ refuse to issue an DHCP lease if 'secs' is set to zero */
+ message->secs = htobe16(secs);
+
memcpy(&message->chaddr, &client->mac_addr, ETH_ALEN);
if (client->state == DHCP_STATE_RENEWING ||