summaryrefslogtreecommitdiff
path: root/src/libsystemd-dhcp/sd-dhcp-client.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-02-23 22:07:07 +0100
committerTom Gundersen <teg@jklm.no>2014-02-23 23:00:18 +0100
commit0a1b6da82109c3b08b1f966a1625a77cc312135a (patch)
tree5a0d4f60de3dbe8adffc4c46511393a35e038a28 /src/libsystemd-dhcp/sd-dhcp-client.c
parent8fa2eeace7beecedb01c82811e28949cacec1236 (diff)
sd-dhcp: message_init - only set secs in the client
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 ||