Blob Blame History Raw
From 0afd3b65ca88329666f27d9597fe4f656fc531a4 Mon Sep 17 00:00:00 2001
Message-Id: <0afd3b65ca88329666f27d9597fe4f656fc531a4.1607427106.git.lorenzo.bianconi@redhat.com>
From: Ilya Maximets <i.maximets@ovn.org>
Date: Fri, 4 Dec 2020 19:50:30 +0100
Subject: [PATCH] northd: Fix iteration over vip backends.

During refactoring, direct access such as 'lb->vips[i].backends[j].op'
was simplified by the presence of the 'backend_nb' pointer. But instead
of the inner one, the index of the outer loop was used.  This forces
northd to only use one backend per vip, and can also lead to invalid
memory accesses.

This change fixes system test:
  24. ovn -- Load balancer health checks

Fixes: f1119c125765 ("northd: Refactor load balancer vip parsing.")
Tested-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Numan Siddique <numans@ovn.org>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
 northd/ovn-northd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -6895,7 +6895,7 @@ build_lswitch_flows(struct hmap *datapat
 
             for (size_t j = 0; j < lb_vip_nb->n_backends; j++) {
                 struct ovn_northd_lb_backend *backend_nb =
-                    &lb_vip_nb->backends_nb[i];
+                    &lb_vip_nb->backends_nb[j];
                 if (!backend_nb->op || !backend_nb->svc_mon_src_ip) {
                     continue;
                 }