diff options
author | Hans Dedecker <dedeckeh@gmail.com> | 2019-12-31 16:30:34 +0100 |
---|---|---|
committer | Hans Dedecker <dedeckeh@gmail.com> | 2019-12-31 16:34:14 +0100 |
commit | b413d8a13ad8d8bdc2e5bc700e9bae9b31232779 (patch) | |
tree | 851c126cf611d8b30121f3cb98d5fa7af7986008 /src | |
parent | b0902af8a731179b0ab56ec32f23f2cbd9533749 (diff) |
dhcpv6-ia: cleanup prefix delegation routes
Remove prefix delegation routes as well in free_dhcpv6_assignment when
cleaning up the assignment resources
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/dhcpv6-ia.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c index e48123f..3838d54 100644 --- a/src/dhcpv6-ia.c +++ b/src/dhcpv6-ia.c @@ -40,6 +40,7 @@ (addrs)[(i)].prefix > 64) static void dhcpv6_netevent_cb(unsigned long event, struct netevent_handler_info *info); +static void apply_lease(struct dhcp_assignment *a, bool add); static void set_border_assignment_size(struct interface *iface, struct dhcp_assignment *b); static void handle_addrlist_change(struct netevent_handler_info *info); static void start_reconf(struct dhcp_assignment *a); @@ -206,6 +207,9 @@ static void dhcpv6_ia_free_assignment(struct dhcp_assignment *a) close(a->managed_sock.fd.fd); } + if (a->flags & OAF_BOUND && a->length < 128) + apply_lease(a, false); + if (a->reconf_cnt) stop_reconf(a); @@ -1370,13 +1374,13 @@ ssize_t dhcpv6_ia_handle_IAs(uint8_t *buf, size_t buflen, struct interface *ifac apply_lease(a, true); } } else if (hdr->msg_type == DHCPV6_MSG_RELEASE) { - if (!(a->flags & OAF_STATIC)) - a->valid_until = now - 1; - - if (a->flags & OAF_BOUND) { + if (a->flags & OAF_STATIC) { apply_lease(a, false); a->flags &= ~OAF_BOUND; } + else + a->valid_until = now - 1; + } else if (hdr->msg_type == DHCPV6_MSG_DECLINE && a->length == 128) { a->flags &= ~OAF_BOUND; |