From 7e9f7a1bcfbccbb892778e0afd6d8fad19a632e8 Mon Sep 17 00:00:00 2001 From: Francis Dupont Date: Fri, 15 Feb 2008 18:18:54 +0000 Subject: [PATCH] fix DUID-LTT epoch --- RELNOTES | 3 +++ client/dhc6.c | 2 +- includes/dhcp6.h | 7 +++++++ server/dhcpv6.c | 7 ------- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/RELNOTES b/RELNOTES index 390ac2ef..70b3ad6f 100644 --- a/RELNOTES +++ b/RELNOTES @@ -156,6 +156,9 @@ work on other platforms. Please report any problems and suggested fixes to - Fix startup error messages to report a missing "subnet6 declaration", rather than a missing "subnet declaration", when running as a DHCPv6 server. +- DHCPv6 client timestamp in DUID was based on the year 1970 rather + than the year 2000. + Changes since 4.0.0b3 - The reverse dns name for PTR updates on IPv6 addresses has been fixed to diff --git a/client/dhc6.c b/client/dhc6.c index 77376e7b..37cdab61 100644 --- a/client/dhc6.c +++ b/client/dhc6.c @@ -135,7 +135,7 @@ form_duid(struct data_string *duid, const char *file, int line) /* Basic Link Local Address type of DUID. */ putUShort(duid->buffer->data, DUID_LLT); putUShort(duid->buffer->data + 2, ip->hw_address.hbuf[0]); - putULong(duid->buffer->data + 4, cur_time); + putULong(duid->buffer->data + 4, cur_time - DUID_TIME_EPOCH); memcpy(duid->buffer->data + 8, ip->hw_address.hbuf + 1, ip->hw_address.hlen - 1); } diff --git a/includes/dhcp6.h b/includes/dhcp6.h index 414f3898..c5ed02d9 100644 --- a/includes/dhcp6.h +++ b/includes/dhcp6.h @@ -195,3 +195,10 @@ struct dhcpv6_relay_packet { #define LQ6QT_BY_ADDRESS 1 #define LQ6QT_BY_CLIENTID 2 + +/* + * DUID time starts 2000-01-01. + * This constant is the number of seconds since 1970-01-01, + * when the Unix epoch began. + */ +#define DUID_TIME_EPOCH 946684800 diff --git a/server/dhcpv6.c b/server/dhcpv6.c index a4504c0e..f20f5db9 100644 --- a/server/dhcpv6.c +++ b/server/dhcpv6.c @@ -112,13 +112,6 @@ static isc_result_t reply_process_send_addr(struct reply_state *reply, struct iaddr *addr); static struct iaaddr *lease_compare(struct iaaddr *alpha, struct iaaddr *beta); -/* - * DUID time starts 2000-01-01. - * This constant is the number of seconds since 1970-01-01, - * when the Unix epoch began. - */ -#define DUID_TIME_EPOCH 946684800 - /* * This function returns the time since DUID time start for the * given time_t value.