From 79818c93448403843280bcb9b3d33f70461828c7 Mon Sep 17 00:00:00 2001 From: Shawn Routhier Date: Fri, 16 May 2014 15:24:48 -0700 Subject: [master] Add -df option to client code to help share DUIDs Add the "-df " option to the client code in order to make it easier to share DUIDs between a v4 instance and a v6 instance. This option instructs the client to search the duid file for a DUID if it didn't find one in the main lease file. In addition add the infrastructure for running ATF tests for the client and write some ATF tests for this patch. --- client/clparse.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'client/clparse.c') diff --git a/client/clparse.c b/client/clparse.c index 646229f1..320c42f5 100644 --- a/client/clparse.c +++ b/client/clparse.c @@ -244,6 +244,45 @@ int read_client_conf_file (const char *name, struct interface_info *ip, } +/* lease-file :== client-lease-statements END_OF_FILE + client-lease-statements :== + | client-lease-statements LEASE client-lease-statement + * This routine looks through a lease file and only tries to parse + * the duid statements. + */ + +void read_client_duid () +{ + int file; + isc_result_t status; + struct parse *cfile; + const char *val; + int token; + + /* Open the lease file. If we can't open it, just return - + we can safely trust the server to remember our state. */ + if ((file = open (path_dhclient_duid, O_RDONLY)) < 0) + return; + + cfile = NULL; + status = new_parse(&cfile, file, NULL, 0, path_dhclient_duid, 0); + if (status != ISC_R_SUCCESS || cfile == NULL) + return; + + while ((token = next_token(&val, NULL, cfile)) != END_OF_FILE) { + /* + * All we care about is DUIDs - if we get anything else + * just toss it and continue looking for DUIDs until we + * run out of file. + */ + if (token == DEFAULT_DUID) { + parse_client_default_duid(cfile); + } + } + + end_parse(&cfile); +} + /* lease-file :== client-lease-statements END_OF_FILE client-lease-statements :== | client-lease-statements LEASE client-lease-statement */ -- cgit v1.2.1