summaryrefslogtreecommitdiffhomepage
path: root/src/dhcpv6-ia.c
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2019-02-05 12:09:44 +0100
committerHans Dedecker <dedeckeh@gmail.com>2019-02-05 16:38:23 +0100
commit9f25dd8af76dc30e54ddcbb4a284058e598951d5 (patch)
tree63c568f94b71069bff3e25c59eed4a148f382a59 /src/dhcpv6-ia.c
parentf21a0a7bbc31ff8b519e566087e5b425c39480c6 (diff)
treewide: use avl tree to store interfaces
Store the interfaces in an avl tree iso a linear linked list Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'src/dhcpv6-ia.c')
-rw-r--r--src/dhcpv6-ia.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c
index 06e418a..af3b720 100644
--- a/src/dhcpv6-ia.c
+++ b/src/dhcpv6-ia.c
@@ -379,7 +379,7 @@ void dhcpv6_write_statefile(void)
ctxt.buf = leasebuf;
ctxt.buf_len = sizeof(leasebuf);
- list_for_each_entry(ctxt.iface, &interfaces, head) {
+ avl_for_each_element(&interfaces, ctxt.iface, avl) {
if (ctxt.iface->dhcpv6 != MODE_SERVER &&
ctxt.iface->dhcpv4 != MODE_SERVER)
continue;
@@ -805,13 +805,15 @@ static void stop_reconf(struct dhcpv6_assignment *a)
static void valid_until_cb(struct uloop_timeout *event)
{
- time_t now = odhcpd_time();
struct interface *iface;
- list_for_each_entry(iface, &interfaces, head) {
+ time_t now = odhcpd_time();
+
+ avl_for_each_element(&interfaces, iface, avl) {
+ struct dhcpv6_assignment *a, *n;
+
if (iface->dhcpv6 != MODE_SERVER || iface->ia_assignments.next == NULL)
continue;
- struct dhcpv6_assignment *a, *n;
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) ||