IPv6: fix prefix assignment with continuous hints
[project/netifd.git] / interface-ip.c
index 3b6be6b..29db745 100644 (file)
@@ -639,7 +639,7 @@ static bool interface_prefix_assign(struct list_head *list,
        struct device_prefix_assignment *c;
        list_for_each_entry(c, list, head) {
                if (assign->assigned != -1) {
-                       if (assign->assigned > current && assign->assigned + asize < c->assigned) {
+                       if (assign->assigned >= current && assign->assigned + asize < c->assigned) {
                                list_add_tail(&assign->head, &c->head);
                                return true;
                        }
@@ -733,7 +733,7 @@ static void interface_update_prefix_assignments(struct device_prefix *prefix, bo
                        struct list_head *next = &assign_later;
                        struct device_prefix_assignment *n;
                        list_for_each_entry(n, &assign_later, head) {
-                               if (n->length > c->length) {
+                               if (n->length < c->length) {
                                        next = &n->head;
                                        break;
                                }