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

Lorenzo Bianconi lorenzo.bianconi at redhat.com
Fri Jun 11 10:17:31 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 d872f6a3c..da4ac2b32 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -8835,10 +8835,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++) {
@@ -8902,13 +8905,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