]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Client bugs introduced in development repaired. [ISC-Bugs #17192]
authorDavid Hankins <dhankins@isc.org>
Fri, 5 Oct 2007 14:47:43 +0000 (14:47 +0000)
committerDavid Hankins <dhankins@isc.org>
Fri, 5 Oct 2007 14:47:43 +0000 (14:47 +0000)
client/clparse.c
client/dhc6.c
client/dhclient.c
common/tables.c

index d4c0b29653689250d4b4377aca0a7d5adfe7e63b..e52cea6c4069d61fe99da390a105cecda27c3c47 100644 (file)
@@ -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);
index d9c3a31f49c229170c3e9c1e5748b12b09399120..5614e2b307b6ef0e0f21c259ae97f7631d79fd20 100644 (file)
@@ -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 "
index 834849193856961c25069c0c90f86dbc52b31e95..a0c9536d4bdda0383a144194c59d42c4eb5feac4 100644 (file)
@@ -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;
index 5b9456201efb13f466b57dd86650431deef2e4d8..a11f3c6244bcfa18a9bacf3f86fca7fdf7195005 100644 (file)
@@ -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