summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2013-06-17 23:15:02 +0200
committerSteven Barth <steven@midlink.org>2013-06-17 23:15:02 +0200
commit3c2c1bd38a577130848167093bf45eee0535f32a (patch)
treeea36770f4f61e105ec73172c7626e32c68b52d4f
parentd095bf24cf7879150d008c23998676bfedebbde6 (diff)
downloadnetifd-3c2c1bd38a577130848167093bf45eee0535f32a.tar.gz
IPv6: Satisfy unhinted assignments ordered by prefix length
-rw-r--r--interface-ip.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/interface-ip.c b/interface-ip.c
index 44dd63d..3b6be6b 100644
--- a/interface-ip.c
+++ b/interface-ip.c
@@ -729,7 +729,16 @@ static void interface_update_prefix_assignments(struct device_prefix *prefix, bo
netifd_log_message(L_WARNING, "Failed to assign requested subprefix "
"of size %hhu for %s, trying other\n", c->length, c->name);
}
- list_add_tail(&c->head, &assign_later);
+
+ struct list_head *next = &assign_later;
+ struct device_prefix_assignment *n;
+ list_for_each_entry(n, &assign_later, head) {
+ if (n->length > c->length) {
+ next = &n->head;
+ break;
+ }
+ }
+ list_add_tail(&c->head, next);
}
if (c->assigned != -1)