From: Francis Dupont Date: Fri, 15 Feb 2008 18:18:54 +0000 (+0000) Subject: fix DUID-LTT epoch X-Git-Tag: v4_1_0a2~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e9f7a1bcfbccbb892778e0afd6d8fad19a632e8;p=thirdparty%2Fdhcp.git fix DUID-LTT epoch --- diff --git a/RELNOTES b/RELNOTES index 390ac2efb..70b3ad6fc 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 77376e7bb..37cdab61f 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 414f3898f..c5ed02d91 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 a4504c0e6..f20f5db95 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.