From: David Hankins Date: Fri, 5 Oct 2007 14:47:43 +0000 (+0000) Subject: Client bugs introduced in development repaired. [ISC-Bugs #17192] X-Git-Tag: v4_0_0b1~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9ab0cc6a4653cd0c82073e6444505a9f9553d145;p=thirdparty%2Fdhcp.git Client bugs introduced in development repaired. [ISC-Bugs #17192] --- diff --git a/client/clparse.c b/client/clparse.c index d4c0b2965..e52cea6c4 100644 --- a/client/clparse.c +++ b/client/clparse.c @@ -242,7 +242,10 @@ void read_client_leases () if ((file = open (path_dhclient_db, O_RDONLY)) < 0) return; cfile = (struct parse *)0; - new_parse (&cfile, file, (char *)0, 0, path_dhclient_db, 0); + /* new_parse() may fail if the file is of zero length. */ + if (new_parse(&cfile, file, (char *)0, 0, + path_dhclient_db, 0) != ISC_R_SUCCESS) + return; do { token = next_token (&val, (unsigned *)0, cfile); diff --git a/client/dhc6.c b/client/dhc6.c index d9c3a31f4..5614e2b30 100644 --- a/client/dhc6.c +++ b/client/dhc6.c @@ -325,7 +325,7 @@ valid_reply(struct packet *packet, struct client_state *client) memset(&cid, 0, sizeof(cid)); if (!lookup_option(&dhcpv6_universe, packet->options, D6O_SERVERID)) { - log_error("Advertise without a server identifier received."); + log_error("Response without a server identifier received."); rval = ISC_FALSE; } @@ -334,7 +334,7 @@ valid_reply(struct packet *packet, struct client_state *client) !evaluate_option_cache(&sid, packet, NULL, client, packet->options, client->sent_options, &global_scope, oc, MDL)) { - log_error("Advertise without a client identifier."); + log_error("Response without a client identifier."); rval = ISC_FALSE; } @@ -1732,6 +1732,10 @@ dhc6_check_reply(struct client_state *client, struct dhc6_lease *new) } } + /* A Confirm->Reply is unsuitable for comparison to the old lease. */ + if (client->state == S_REBOOTING) + return rval; + switch (client->state) { case S_SELECTING: /* Compare the new lease with the selected lease to make @@ -3178,6 +3182,14 @@ make_client6_options(struct client_state *client, struct option_state **op, option_cache_dereference(&oc, MDL); } + /* Bring in any configured options to send. */ + if (client->config->on_transmission) + execute_statements_in_scope(NULL, NULL, NULL, client, + lease ? lease->options : NULL, + *op, &global_scope, + client->config->on_transmission, + NULL); + /* See if the user configured a DUID in a relevant scope. If not, * introduce our default manufactured id. */ @@ -3213,7 +3225,7 @@ make_client6_options(struct client_state *client, struct option_state **op, * deprecated by adjustments to the 'request' syntax also used for * DHCPv4. */ - if (lookup_option(&dhcpv6_universe, *op, D6O_ORO) == NULL) + if (lookup_option(&dhcpv6_universe, *op, D6O_ORO) != NULL) log_error("'send dhcp6.oro' syntax is deprecated, please " "use the 'request' syntax (\"man dhclient.conf\")."); @@ -3300,17 +3312,9 @@ make_client6_options(struct client_state *client, struct option_state **op, data_string_forget(&oro, MDL); - /* Bring in any configured options to send. */ - if (client->config->on_transmission) - execute_statements_in_scope(NULL, NULL, NULL, client, - lease ? lease->options : NULL, - *op, &global_scope, - client->config->on_transmission, - NULL); - /* RFC3315 says we MUST inclue an ORO in Requests. If we have it - * in the cache for one, we have it for both, so it's fatal either - * way (may as well fail early). + * in the cache for Requests, we have it for Solicits, so it's fatal + * either way (may as well fail early on Solicits). */ if (lookup_option(&dhcpv6_universe, *op, D6O_ORO) == NULL) log_fatal("Internal inconsistency: no dhcp6.oro in transmit " diff --git a/client/dhclient.c b/client/dhclient.c index 834849193..a0c9536d4 100644 --- a/client/dhclient.c +++ b/client/dhclient.c @@ -2511,7 +2511,7 @@ write_client6_lease(struct client_state *client, struct dhc6_lease *lease, return ISC_R_IOERROR; for (ia = lease->bindings ; ia != NULL ; ia = ia->next) { - stat = fprintf(leaseFile, " ia_na %s {\n", + stat = fprintf(leaseFile, " ia-na %s {\n", print_hex_1(4, ia->iaid, 12)); if (stat <= 0) return ISC_R_IOERROR; diff --git a/common/tables.c b/common/tables.c index 5b9456201..a11f3c624 100644 --- a/common/tables.c +++ b/common/tables.c @@ -305,7 +305,7 @@ static struct option dhcpv6_options[] = { /* Client and server DUIDs are opaque fields, but marking them * up somewhat makes configuration easier. */ - { "client-id", "Nduid-types.X", &dhcpv6_universe, 1, 1 }, + { "client-id", "X", &dhcpv6_universe, 1, 1 }, { "server-id", "X", &dhcpv6_universe, 2, 1 }, /* ia-* options actually have at their ends a space for options