IPv6: Try harder to assign prefix parts
authorSteven Barth <steven@midlink.org>
Fri, 19 Apr 2013 13:36:19 +0000 (15:36 +0200)
committerSteven Barth <steven@midlink.org>
Fri, 19 Apr 2013 13:36:19 +0000 (15:36 +0200)
interface-ip.c

index d18fa742d2ee2a47f7b2d4f1fee247517a0612d3..afdf67b0d7cc2853d21d5902863d7ac78343381c 100644 (file)
@@ -640,7 +640,13 @@ static void interface_update_prefix_assignments(struct device_prefix *prefix, bo
        while (!list_empty(&assign_later)) {
                c = list_first_entry(&assign_later, struct device_prefix_assignment, head);
                list_del(&c->head);
-               if (!interface_prefix_assign(&prefix->assignments, c)) {
+
+               bool assigned = false;
+               do {
+                       assigned = interface_prefix_assign(&prefix->assignments, c);
+               } while (!assigned && ++c->length <= 64);
+
+               if (!assigned) {
                        netifd_log_message(L_WARNING, "Failed to assign subprefix "
                                        "of size %hhu for %s\n", c->length, c->name);
                        free(c);