[ovs-dev] [PATCH v3 ovn 1/9] northd: move snat_type out of vip loop

Lorenzo Bianconi lorenzo.bianconi at redhat.com
Wed Jun 30 09:33:57 UTC 2021


Move snat_type out of vip loop in build_lrouter_lb_flows() since there
is not vip dependency

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi at redhat.com>
---
 northd/ovn-northd.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index e96494ba3..6e182b1cb 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -8867,10 +8867,13 @@ build_lrouter_lb_flows(struct hmap *lflows, struct ovn_datapath *od,
             ovn_northd_lb_find(lbs, &nb_lb->header_.uuid);
         ovs_assert(lb);
 
-        bool lb_skip_snat = smap_get_bool(&nb_lb->options, "skip_snat", false);
-        if (lb_skip_snat) {
+        enum lb_snat_type snat_type = NO_FORCE_SNAT;
+        if (smap_get_bool(&nb_lb->options, "skip_snat", false)) {
             ovn_lflow_add(lflows, od, S_ROUTER_OUT_SNAT, 120,
                           "flags.skip_snat_for_lb == 1 && ip", "next;");
+            snat_type = SKIP_SNAT;
+        } else if (lb_force_snat_ip || od->lb_force_snat_router_ip) {
+            snat_type = FORCE_SNAT;
         }
 
         for (size_t j = 0; j < lb->n_vips; j++) {
@@ -8934,13 +8937,6 @@ build_lrouter_lb_flows(struct hmap *lflows, struct ovn_datapath *od,
                 ds_put_format(match, " && is_chassis_resident(%s)",
                               od->l3redirect_port->json_key);
             }
-
-            enum lb_snat_type snat_type = NO_FORCE_SNAT;
-            if (lb_skip_snat) {
-                snat_type = SKIP_SNAT;
-            } else if (lb_force_snat_ip || od->lb_force_snat_router_ip) {
-                snat_type = FORCE_SNAT;
-            }
             add_router_lb_flow(lflows, od, match, actions, prio,
                                snat_type, lb_vip, proto, nb_lb,
                                meter_groups, nat_entries);
-- 
2.31.1



More information about the dev mailing list