From: Shawn Routhier Date: Thu, 16 Apr 2015 02:47:03 +0000 (-0700) Subject: [v4_1_esv] Always write the DUID to the lease file during startup X-Git-Tag: v4_1_esv_r12b1~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2fb0e10fedd4e46502658bc643e9db160f6bc0c5;p=thirdparty%2Fdhcp.git [v4_1_esv] Always write the DUID to the lease file during startup --- diff --git a/RELNOTES b/RELNOTES index a75bdff8b..7aa073ab1 100644 --- a/RELNOTES +++ b/RELNOTES @@ -80,6 +80,11 @@ by Eric Young (eay@cryptsoft.com). and look for the presence of the unicast option there and then globally. [ISC-Bugs #21235] +- Write out the DUID server id on startup in all cases, previously if it + was read in from server-duid option in the config or lease files for + DHCPv4 it would not be written to the new lease file. + [ISC-Bugs #37791] + Changes since 4.1-ESV-R11rc2 - None diff --git a/server/dhcpd.c b/server/dhcpd.c index 50d721eb2..991c3688f 100644 --- a/server/dhcpd.c +++ b/server/dhcpd.c @@ -762,19 +762,21 @@ main(int argc, char **argv) { #ifdef DHCPv6 /* - * Set server DHCPv6 identifier. + * Set server DHCPv6 identifier - we go in order: + * dhcp6.server-id in the config file + * server-duid from the lease file + * server-duid from the config file (the config file is read first + * and the lease file overwrites the config file information) + * genrate a new one + * In all cases we write it out to the lease file. * See dhcpv6.c for discussion of setting DUID. */ - if (set_server_duid_from_option() == ISC_R_SUCCESS) { - write_server_duid(); - } else { - if (!server_duid_isset()) { - if (generate_new_server_duid() != ISC_R_SUCCESS) { - log_fatal("Unable to set server identifier."); - } - write_server_duid(); - } + if ((set_server_duid_from_option() != ISC_R_SUCCESS) && + (!server_duid_isset()) && + (generate_new_server_duid() != ISC_R_SUCCESS)) { + log_fatal("Unable to set server identifier."); } + write_server_duid(); #endif /* DHCPv6 */ #ifndef DEBUG diff --git a/server/dhcpd.conf.5 b/server/dhcpd.conf.5 index b831a5b0e..0514024b0 100644 --- a/server/dhcpd.conf.5 +++ b/server/dhcpd.conf.5 @@ -2728,6 +2728,10 @@ Otherwise the server will generate a DUID of the specified type. If you choose EN, you must include the enterprise number and the enterprise-identifier. .PP +If there is a server-duid statement in the lease file it will take precedence +over the server-duid statement from the config file and a +dhcp6.server-id option in the config file will override both. +.PP The default server-duid type is LLT. .RE .PP