aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/dhcpc.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2019-09-24 14:01:00 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2019-09-24 14:01:00 +0200
commit11e024aa86f23a6dd86cdd58b8890756708cd708 (patch)
tree818fcf800385a218fab7175dd3e89c1d076c5b18 /networking/udhcp/dhcpc.c
parentc58d785b9d0a337ff884002c4cef5283f901c9e4 (diff)
downloadbusybox-11e024aa86f23a6dd86cdd58b8890756708cd708.tar.gz
udhcpc6: add ELAPSED_TIME option to outgoing packets
function old new delta init_d6_packet 53 121 +68 udhcpc_main 2577 2582 +5 udhcpc6_main 2593 2597 +4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 77/0) Total: 77 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/udhcp/dhcpc.c')
-rw-r--r--networking/udhcp/dhcpc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c
index 656295ff7..5a1f8fd7a 100644
--- a/networking/udhcp/dhcpc.c
+++ b/networking/udhcp/dhcpc.c
@@ -606,7 +606,7 @@ static ALWAYS_INLINE uint32_t random_xid(void)
/* Initialize the packet with the proper defaults */
static void init_packet(struct dhcp_packet *packet, char type)
{
- uint16_t secs;
+ unsigned secs;
/* Fill in: op, htype, hlen, cookie fields; message type option: */
udhcp_init_header(packet, type);
@@ -617,7 +617,7 @@ static void init_packet(struct dhcp_packet *packet, char type)
if (client_data.first_secs == 0)
client_data.first_secs = client_data.last_secs;
secs = client_data.last_secs - client_data.first_secs;
- packet->secs = htons(secs);
+ packet->secs = (secs < 0xffff) ? htons(secs) : 0xffff;
memcpy(packet->chaddr, client_data.client_mac, 6);
if (client_data.clientid)