Array splicing was broken when multiple elements were being moved,
resulting in the priority order being mixed.  This came up when the
highest priority rule from a subtable was removed and the subtable
needed to be moved down the priority list by more than one position.

Signed-off-by: Jarno Rajahalme <jrajaha...@nicira.com>
---
 lib/classifier.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/classifier.c b/lib/classifier.c
index a9046cd..aef57bb 100644
--- a/lib/classifier.c
+++ b/lib/classifier.c
@@ -224,12 +224,14 @@ cls_subtable_cache_splice(struct cls_subtable_entry *to,
         to = start; start = end; end = temp;
     }
     if (to < start) {
+        /* Move elements [start, end) to (to) one by one. */
         while (start != end) {
             struct cls_subtable_entry temp = *start;
 
+            /* Shift array by one, making space for the element at 'temp'. */
             memmove(to + 1, to, (start - to) * sizeof *to);
             *to = temp;
-            start++;
+            start++; to++;
         }
     } /* Else nothing to be done. */
 }
-- 
1.7.10.4

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to