summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2008-02-20 23:20:58 +0000
committerFrancis Dupont <fdupont@isc.org>2008-02-20 23:20:58 +0000
commitcabdb9b1c575c4d083f7178941bfd537008ad928 (patch)
tree564007cdf2f8bca70efd4a4bb2b34dd30e681824 /client
parent2b964ac0c7c1314e2bcce9da81e9af1eb4f4b1a7 (diff)
downloadisc-dhcp-cabdb9b1c575c4d083f7178941bfd537008ad928.tar.gz
DHCPv6 released resources are now marked as released by the client
Diffstat (limited to 'client')
-rw-r--r--client/clparse.c5
-rw-r--r--client/dhc6.c16
-rw-r--r--client/dhclient.c9
3 files changed, 28 insertions, 2 deletions
diff --git a/client/clparse.c b/client/clparse.c
index 01e8f288..34fa93da 100644
--- a/client/clparse.c
+++ b/client/clparse.c
@@ -1403,6 +1403,11 @@ parse_client6_lease_statement(struct parse *cfile)
no_semi = 1;
break;
+ case TOKEN_RELEASED:
+ case TOKEN_ABANDONED:
+ lease->released = ISC_TRUE;
+ break;
+
default:
parse_warn(cfile, "Unexpected token, %s.", val);
no_semi = 1;
diff --git a/client/dhc6.c b/client/dhc6.c
index 90826223..dd275847 100644
--- a/client/dhc6.c
+++ b/client/dhc6.c
@@ -519,6 +519,7 @@ dhc6_dup_addr(struct dhc6_addr *addr, const char *file, int line)
/* Form a DHCPv6 lease structure based upon packet contents. Creates and
* populates IA's and any IAADDR/IAPREFIX's they contain.
+ * Parsed options are deleted in order to not save them in the lease file.
*/
static struct dhc6_lease *
dhc6_leaseify(struct packet *packet)
@@ -557,6 +558,7 @@ dhc6_leaseify(struct packet *packet)
data_string_forget(&ds, MDL);
}
+ delete_option(&dhcpv6_universe, lease->options, D6O_PREFERENCE);
/* Dig into recursive DHCPv6 pockets for IA_NA and contained IAADDR
* options.
@@ -710,6 +712,7 @@ dhc6_parse_ia_na(struct dhc6_ia **pia, struct packet *packet,
return ISC_R_UNEXPECTED;
}
}
+ delete_option(&dhcpv6_universe, options, D6O_IA_NA);
return ISC_R_SUCCESS;
}
@@ -792,6 +795,7 @@ dhc6_parse_ia_ta(struct dhc6_ia **pia, struct packet *packet,
return ISC_R_UNEXPECTED;
}
}
+ delete_option(&dhcpv6_universe, options, D6O_IA_TA);
return ISC_R_SUCCESS;
}
@@ -892,6 +896,7 @@ dhc6_parse_ia_pd(struct dhc6_ia **pia, struct packet *packet,
return ISC_R_UNEXPECTED;
}
}
+ delete_option(&dhcpv6_universe, options, D6O_IA_PD);
return ISC_R_SUCCESS;
}
@@ -986,6 +991,7 @@ dhc6_parse_addrs(struct dhc6_addr **paddr, struct packet *packet,
return ISC_R_UNEXPECTED;
}
}
+ delete_option(&dhcpv6_universe, options, D6O_IAADDR);
return ISC_R_SUCCESS;
}
@@ -1089,6 +1095,7 @@ dhc6_parse_prefs(struct dhc6_addr **ppref, struct packet *packet,
return ISC_R_UNEXPECTED;
}
}
+ delete_option(&dhcpv6_universe, options, D6O_IAPREFIX);
return ISC_R_SUCCESS;
}
@@ -1286,7 +1293,7 @@ start_confirm6(struct client_state *client)
struct timeval tv;
/* If there is no active lease, there is nothing to check. */
- if (client->active_lease == NULL) {
+ if ((client->active_lease == NULL) || client->active_lease->released) {
start_init6(client);
return;
}
@@ -1670,6 +1677,12 @@ start_release6(struct client_state *client)
*/
unconfigure6(client, "RELEASE6");
+ /* Note this in the lease file. */
+ if (client->active_lease == NULL)
+ return;
+ client->active_lease->released = ISC_TRUE;
+ write_client6_lease(client, client->active_lease, 0, 1);
+
/* Set timers per RFC3315 section 18.1.1. */
client->IRT = REL_TIMEOUT * 100;
client->MRT = 0;
@@ -3390,6 +3403,7 @@ start_bound(struct client_state *client)
"is selected.");
return;
}
+ lease->released = ISC_FALSE;
old = client->old_lease;
client->v6_handler = bound_handler;
diff --git a/client/dhclient.c b/client/dhclient.c
index c9ba9a6b..38afe721 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -474,7 +474,8 @@ main(int argc, char **argv) {
/* If we have a previous binding, Confirm
* that we can (or can't) still use it.
*/
- if (client->active_lease != NULL)
+ if ((client->active_lease != NULL) &&
+ !client->active_lease->released)
start_confirm6(client);
else
start_init6(client);
@@ -2601,6 +2602,12 @@ write_client6_lease(struct client_state *client, struct dhc6_lease *lease,
return ISC_R_IOERROR;
}
+ if (lease->released) {
+ stat = fprintf(leaseFile, " released;\n");
+ if (stat <= 0)
+ return ISC_R_IOERROR;
+ }
+
if (lease->options != NULL)
write_options(client, lease->options, " ");