summaryrefslogtreecommitdiff
path: root/server/mdb6.c
diff options
context:
space:
mode:
authorShawn Routhier <sar@isc.org>2013-08-27 13:40:47 -0700
committerShawn Routhier <sar@isc.org>2013-08-27 13:40:47 -0700
commita7341359cc45bf965e3b11e0b22a4a06f335d6a7 (patch)
treee17e1f70850dd009dc20efd2c852424cc617038e /server/mdb6.c
parent8cd88e202bd734e40e006808311fb6688e9f0b47 (diff)
downloadisc-dhcp-a7341359cc45bf965e3b11e0b22a4a06f335d6a7.tar.gz
-n [master]
[rt27912] Add code to suppor on {commit expiry release} statements for DHCPv6. There are several pieces to this change 1) Add space in the iasubopt structure to hold the statement pointers 2) Update the execute code to fill in the structures as necessary 3) Execute the statements when appropriate Many of the changes in the non-v6 code are to pass the v6 structures around to the execute code.
Diffstat (limited to 'server/mdb6.c')
-rw-r--r--server/mdb6.c48
1 files changed, 47 insertions, 1 deletions
diff --git a/server/mdb6.c b/server/mdb6.c
index 0e76264c..b98db428 100644
--- a/server/mdb6.c
+++ b/server/mdb6.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2012 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2007-2013 by Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -197,6 +197,20 @@ iasubopt_dereference(struct iasubopt **iasubopt, const char *file, int line) {
if (tmp->scope != NULL) {
binding_scope_dereference(&tmp->scope, file, line);
}
+
+ if (tmp->on_star.on_expiry != NULL) {
+ executable_statement_dereference
+ (&tmp->on_star.on_expiry, MDL);
+ }
+ if (tmp->on_star.on_commit != NULL) {
+ executable_statement_dereference
+ (&tmp->on_star.on_commit, MDL);
+ }
+ if (tmp->on_star.on_release != NULL) {
+ executable_statement_dereference
+ (&tmp->on_star.on_release, MDL);
+ }
+
dfree(tmp, file, line);
}
@@ -1309,6 +1323,38 @@ move_lease_to_inactive(struct ipv6_pool *pool, struct iasubopt *lease,
old_heap_index = lease->heap_index;
insert_result = isc_heap_insert(pool->inactive_timeouts, lease);
if (insert_result == ISC_R_SUCCESS) {
+ /*
+ * Handle expire and release statements
+ * To get here we must be active and have done a commit so
+ * we should run the proper statements if they exist, though
+ * that will change when we remove the inactive heap.
+ * In addition we get rid of the references for both as we
+ * can only do one (expire or release) on a lease
+ */
+ if (lease->on_star.on_expiry != NULL) {
+ if (state == FTS_EXPIRED) {
+ execute_statements(NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ &lease->scope,
+ lease->on_star.on_expiry,
+ &lease->on_star);
+ }
+ executable_statement_dereference
+ (&lease->on_star.on_expiry, MDL);
+ }
+
+ if (lease->on_star.on_release != NULL) {
+ if (state == FTS_RELEASED) {
+ execute_statements(NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ &lease->scope,
+ lease->on_star.on_release,
+ &lease->on_star);
+ }
+ executable_statement_dereference
+ (&lease->on_star.on_release, MDL);
+ }
+
#if defined (NSUPDATE)
/* Process events upon expiration. */
if (pool->pool_type != D6O_IA_PD) {