summaryrefslogtreecommitdiffhomepage
path: root/src/dhcpv6-ia.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dhcpv6-ia.c')
-rw-r--r--src/dhcpv6-ia.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c
index 1fbed44..03656ae 100644
--- a/src/dhcpv6-ia.c
+++ b/src/dhcpv6-ia.c
@@ -208,7 +208,7 @@ static void dhcpv6_ia_free_assignment(struct dhcp_assignment *a)
close(a->managed_sock.fd.fd);
}
- if ((a->flags & OAF_BOUND) && (a->flags & OAF_DHCPV6_PD))
+ if (a->flags & OAF_BOUND)
apply_lease(a, false);
if (a->reconf_cnt)
@@ -591,6 +591,10 @@ void dhcpv6_ia_write_statefile(void)
static void __apply_lease(struct dhcp_assignment *a,
struct odhcpd_ipaddr *addrs, ssize_t addr_len, bool add)
{
+#ifdef WITH_UBUS
+ ubus_bcast_dhcpv6_event(add?"dhcpv6.ack":"dhcpv6.release", a, addrs, addr_len);
+#endif
+
if (a->flags & OAF_DHCPV6_NA)
return;
@@ -842,6 +846,10 @@ static bool assign_na(struct interface *iface, struct dhcp_assignment *a)
list_for_each_entry(c, &iface->ia_assignments, head) {
if (!(c->flags & OAF_DHCPV6_NA) || c->assigned_host_id > a->assigned_host_id ) {
list_add_tail(&a->head, &c->head);
+
+ if (a->flags & OAF_BOUND)
+ apply_lease(a, true);
+
return true;
} else if (c->assigned_host_id == a->assigned_host_id)
return false;
@@ -889,6 +897,10 @@ static bool assign_na(struct interface *iface, struct dhcp_assignment *a)
if (!(c->flags & OAF_DHCPV6_NA) || c->assigned_host_id > try) {
a->assigned_host_id = try;
list_add_tail(&a->head, &c->head);
+
+ if (a->flags & OAF_BOUND)
+ apply_lease(a, true);
+
return true;
} else if (c->assigned_host_id == try)
break;