mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-31 14:25:41 +00:00
[master] Add -df option to client code to help share DUIDs
Add the "-df <duid file>" 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.
This commit is contained in:
@@ -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 :== <nil>
|
||||
| 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 :== <nil>
|
||||
| client-lease-statements LEASE client-lease-statement */
|
||||
|
Reference in New Issue
Block a user