dhcpv6-ia: free assignment when validity timer expires
authorHans Dedecker <dedeckeh@gmail.com>
Tue, 27 Aug 2019 20:00:26 +0000 (22:00 +0200)
committerHans Dedecker <dedeckeh@gmail.com>
Wed, 28 Aug 2019 17:35:14 +0000 (19:35 +0200)
In case clid_len is set free assignment when validity timer expires

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
src/dhcpv6-ia.c

index c0dfa2d7d18cf3b05ce98742fe310fae5b9736f2..084683665cff3fd2de5915d2fbc1761c7b30029f 100644 (file)
@@ -772,12 +772,8 @@ static void valid_until_cb(struct uloop_timeout *event)
                        continue;
 
                list_for_each_entry_safe(a, n, &iface->ia_assignments, head) {
-                       if (!INFINITE_VALID(a->valid_until) && a->valid_until < now) {
-                               if ((a->length < 128 && a->clid_len > 0) ||
-                                               (a->length == 128 && a->clid_len == 0))
-                                       free_assignment(a);
-
-                       }
+                       if (a->clid_len > 0 && !INFINITE_VALID(a->valid_until) && a->valid_until < now)
+                               free_assignment(a);
                }
        }
        uloop_timeout_set(event, 1000);
@@ -1384,7 +1380,7 @@ ssize_t dhcpv6_ia_handle_IAs(uint8_t *buf, size_t buflen, struct interface *ifac
                                a->flags &= ~OAF_BOUND;
 
                                if (!(a->flags & OAF_STATIC)) {
-                                       a->clid_len = 0;
+                                       memset(a->clid_data, 0, a->clid_len);
                                        a->valid_until = now + 3600; /* Block address for 1h */
                                }
                        }