Blob Blame History Raw
From 61fa3dd9e789997f66e848c7e3fb2f554ee374e2 Mon Sep 17 00:00:00 2001
From: Jiri Popelka <jpopelka@redhat.com>
Date: Thu, 18 Dec 2014 11:53:26 +0100
Subject: [PATCH] Write DUID_LLT even in stateless mode.

By default, DHCPv6 dhclient creates DUID-LL
if it is running in stateless mode (-6 -S) and
doesn't write it into leases file, most likely
because the DUID-LL is always generated the same.

It's however possible to specify DUID to be of type LLT instead of LL
with '-D LLT'. Rfc 3315 says that:
'Clients and servers using this type of DUID MUST
store the DUID-LLT in stable storage.'
That's not fulfiled in this case (-6 -S -D LLT),
because it's generated each time again.

It's not a big deal because the server doesn't store any
info about 'stateless' clients, so it doesn't matter
that the DUID-LLT is different each time.
But there's a TAHI test which tests this, i.e. that
DUID-LLT is still the same even in stateless mode.
It's a test DHCP_CONF.7.1.9, part B.
https://www.ipv6ready.org/docs/Phase2_DHCPv6_Conformance_Latest.pdf

Signed-off-by: Jiri Popelka <jpopelka@redhat.com>
---
 client/dhclient.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/client/dhclient.c b/client/dhclient.c
index 5ef59cd..026e3fe 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -788,7 +788,9 @@ void run_stateless(int exit_mode)
 		if (default_duid.buffer != NULL)
 			data_string_forget(&default_duid, MDL);
 
-		form_duid(&default_duid, MDL);
+		if (form_duid(&default_duid, MDL) == ISC_R_SUCCESS &&
+		    duid_type == DUID_LLT)
+			write_duid(&default_duid);
 	}
 
 	/* Start a configuration state machine. */
-- 
2.1.0