7df69f
From 61fa3dd9e789997f66e848c7e3fb2f554ee374e2 Mon Sep 17 00:00:00 2001
7df69f
From: Jiri Popelka <jpopelka@redhat.com>
7df69f
Date: Thu, 18 Dec 2014 11:53:26 +0100
7df69f
Subject: [PATCH] Write DUID_LLT even in stateless mode.
7df69f
7df69f
By default, DHCPv6 dhclient creates DUID-LL
7df69f
if it is running in stateless mode (-6 -S) and
7df69f
doesn't write it into leases file, most likely
7df69f
because the DUID-LL is always generated the same.
7df69f
7df69f
It's however possible to specify DUID to be of type LLT instead of LL
7df69f
with '-D LLT'. Rfc 3315 says that:
7df69f
'Clients and servers using this type of DUID MUST
7df69f
store the DUID-LLT in stable storage.'
7df69f
That's not fulfiled in this case (-6 -S -D LLT),
7df69f
because it's generated each time again.
7df69f
7df69f
It's not a big deal because the server doesn't store any
7df69f
info about 'stateless' clients, so it doesn't matter
7df69f
that the DUID-LLT is different each time.
7df69f
But there's a TAHI test which tests this, i.e. that
7df69f
DUID-LLT is still the same even in stateless mode.
7df69f
It's a test DHCP_CONF.7.1.9, part B.
7df69f
https://www.ipv6ready.org/docs/Phase2_DHCPv6_Conformance_Latest.pdf
7df69f
7df69f
Signed-off-by: Jiri Popelka <jpopelka@redhat.com>
7df69f
---
7df69f
 client/dhclient.c | 4 +++-
7df69f
 1 file changed, 3 insertions(+), 1 deletion(-)
7df69f
7df69f
diff --git a/client/dhclient.c b/client/dhclient.c
7df69f
index 5ef59cd..026e3fe 100644
7df69f
--- a/client/dhclient.c
7df69f
+++ b/client/dhclient.c
7df69f
@@ -788,7 +788,9 @@ void run_stateless(int exit_mode)
7df69f
 		if (default_duid.buffer != NULL)
7df69f
 			data_string_forget(&default_duid, MDL);
7df69f
 
7df69f
-		form_duid(&default_duid, MDL);
7df69f
+		if (form_duid(&default_duid, MDL) == ISC_R_SUCCESS &&
7df69f
+		    duid_type == DUID_LLT)
7df69f
+			write_duid(&default_duid);
7df69f
 	}
7df69f
 
7df69f
 	/* Start a configuration state machine. */
7df69f
-- 
7df69f
2.1.0
7df69f