summaryrefslogtreecommitdiff
path: root/client/dhc6.c
diff options
context:
space:
mode:
Diffstat (limited to 'client/dhc6.c')
-rw-r--r--client/dhc6.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/client/dhc6.c b/client/dhc6.c
index f9220486..8974e7a6 100644
--- a/client/dhc6.c
+++ b/client/dhc6.c
@@ -109,6 +109,7 @@ static void make_client6_options(struct client_state *client,
static void script_write_params6(struct client_state *client,
const char *prefix,
struct option_state *options);
+static void script_write_requested6(struct client_state *client);
static isc_boolean_t active_prefix(struct client_state *client);
static int check_timing6(struct client_state *client, u_int8_t msg_type,
@@ -4339,6 +4340,7 @@ start_bound(struct client_state *client)
dhc6_marshall_values("old_", client, old,
oldia, oldaddr);
dhc6_marshall_values("new_", client, lease, ia, addr);
+ script_write_requested6(client);
script_go(client);
}
@@ -4355,6 +4357,7 @@ start_bound(struct client_state *client)
dhc6_marshall_values("new_", client, lease, ia,
NULL);
+ script_write_requested6(client);
script_go(client);
}
@@ -4371,6 +4374,7 @@ start_bound(struct client_state *client)
old->bindings->addrs : NULL);
dhc6_marshall_values("new_", client, lease, NULL, NULL);
+ script_write_requested6(client);
script_go(client);
}
@@ -4649,6 +4653,7 @@ do_depref(void *input)
script_init(client, "DEPREF6", NULL);
dhc6_marshall_values("cur_", client, lease,
ia, addr);
+ script_write_requested6(client);
script_go(client);
addr->flags |= DHC6_ADDR_DEPREFFED;
@@ -4702,6 +4707,7 @@ do_expire(void *input)
script_init(client, "EXPIRE6", NULL);
dhc6_marshall_values("old_", client, lease,
ia, addr);
+ script_write_requested6(client);
script_go(client);
addr->flags |= DHC6_ADDR_EXPIRED;
@@ -4766,6 +4772,7 @@ unconfigure6(struct client_state *client, const char *reason)
if (client->active_lease != NULL)
script_write_params6(client, "old_",
client->active_lease->options);
+ script_write_requested6(client);
script_go(client);
return;
}
@@ -4781,6 +4788,7 @@ unconfigure6(struct client_state *client, const char *reason)
script_init(client, reason, NULL);
dhc6_marshall_values("old_", client,
client->active_lease, ia, addr);
+ script_write_requested6(client);
script_go(client);
#if defined (NSUPDATE)
@@ -4874,6 +4882,7 @@ start_informed(struct client_state *client)
script_write_params6(client, "old_",
client->old_lease->options);
script_write_params6(client, "new_", client->active_lease->options);
+ script_write_requested6(client);
script_go(client);
go_daemon();
@@ -5101,6 +5110,32 @@ script_write_params6(struct client_state *client, const char *prefix,
}
/*
+ * A clone of the DHCPv4 routine.
+ * Write out the environment variables for the objects that the
+ * client requested. If the object was requested the variable will be:
+ * requested_<option_name>=1
+ * If it wasn't requested there won't be a variable.
+ */
+static void script_write_requested6(client)
+ struct client_state *client;
+{
+ int i;
+ struct option **req;
+ char name[256];
+ req = client->config->requested_options;
+
+ if (req == NULL)
+ return;
+
+ for (i = 0 ; req[i] != NULL ; i++) {
+ if ((req[i]->universe == &dhcpv6_universe) &&
+ dhcp_option_ev_name (name, sizeof(name), req[i])) {
+ client_envadd(client, "requested_", name, "%d", 1);
+ }
+ }
+}
+
+/*
* Check if there is something not fully defined in the active lease.
*/
static isc_boolean_t