]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: labelmanager could return reserved labels
authorPat Ruddy <pat@voltanet.io>
Wed, 9 Dec 2020 10:25:38 +0000 (10:25 +0000)
committerPat Ruddy <pat@voltanet.io>
Mon, 4 Jan 2021 14:29:44 +0000 (14:29 +0000)
when checking if there is a "hole" behind the current reservation
marker the calculation of whether the hole is big enough to satisfy
the requested chunk is out by 1. This could result in returning a label
which has already been allocated.

Signed-off-by: Pat Ruddy <pat@voltanet.io>
zebra/label_manager.c

index b393e656d4c3e9603032618eed403670ac0f3ecf..e642e22c95b92dad8cc0cde153d8603a3a51448d 100644 (file)
@@ -335,8 +335,7 @@ static struct label_manager_chunk *assign_label_chunk(uint8_t proto,
                }
                /* check if we hadve a "hole" behind us that we can squeeze into
                 */
-               if ((lmc->start > prev_end)
-                   && (lmc->start - prev_end >= size)) {
+               if ((lmc->start > prev_end) && (lmc->start - prev_end > size)) {
                        lmc = create_label_chunk(proto, instance, session_id,
                                                 keep, prev_end + 1,
                                                 prev_end + size);