5f9769
From d63444b7fcdcc2c68b7af94090410bc3e40e574b Mon Sep 17 00:00:00 2001
5f9769
Message-Id: <d63444b7fcdcc2c68b7af94090410bc3e40e574b.1610458802.git.lorenzo.bianconi@redhat.com>
5f9769
In-Reply-To: <f21c1b7a467a691847b5552d4570af706fcc5bb0.1610458802.git.lorenzo.bianconi@redhat.com>
5f9769
References: <f21c1b7a467a691847b5552d4570af706fcc5bb0.1610458802.git.lorenzo.bianconi@redhat.com>
5f9769
From: Anton Ivanov <anton.ivanov@cambridgegreys.com>
5f9769
Date: Tue, 5 Jan 2021 17:49:32 +0000
5f9769
Subject: [PATCH 05/16] ovn-northd: Move ARP response for external ports to a
5f9769
 function.
5f9769
5f9769
Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
5f9769
Signed-off-by: Numan Siddique <numans@ovn.org>
5f9769
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
5f9769
---
5f9769
 northd/ovn-northd.c | 33 ++++++++++++++++++---------------
5f9769
 1 file changed, 18 insertions(+), 15 deletions(-)
5f9769
5f9769
diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
5f9769
index 45d6a6a2e..09bfaae5e 100644
5f9769
--- a/northd/ovn-northd.c
5f9769
+++ b/northd/ovn-northd.c
5f9769
@@ -6780,21 +6780,6 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
5f9769
     struct ovn_datapath *od;
5f9769
     struct ovn_port *op;
5f9769
 
5f9769
-    HMAP_FOR_EACH (op, key_node, ports) {
5f9769
-        if (!op->nbsp || !lsp_is_external(op->nbsp)) {
5f9769
-           continue;
5f9769
-        }
5f9769
-
5f9769
-        /* Table 18: External port. Drop ARP request for router ips from
5f9769
-         * external ports  on chassis not binding those ports.
5f9769
-         * This makes the router pipeline to be run only on the chassis
5f9769
-         * binding the external ports. */
5f9769
-        for (size_t i = 0; i < op->od->n_localnet_ports; i++) {
5f9769
-            build_drop_arp_nd_flows_for_unbound_router_ports(
5f9769
-                op, op->od->localnet_ports[i], lflows);
5f9769
-        }
5f9769
-    }
5f9769
-
5f9769
     /* Ingress table 19: Destination lookup, broadcast and multicast handling
5f9769
      * (priority 70 - 100). */
5f9769
     HMAP_FOR_EACH (od, key_node, datapaths) {
5f9769
@@ -7486,6 +7471,23 @@ build_lswitch_dns_lookup_and_response(struct ovn_datapath *od,
5f9769
     }
5f9769
 }
5f9769
 
5f9769
+/* Table 18: External port. Drop ARP request for router ips from
5f9769
+ * external ports  on chassis not binding those ports.
5f9769
+ * This makes the router pipeline to be run only on the chassis
5f9769
+ * binding the external ports. */
5f9769
+static void
5f9769
+build_lswitch_external_port(struct ovn_port *op,
5f9769
+                            struct hmap *lflows)
5f9769
+{
5f9769
+    if (op->nbsp && lsp_is_external(op->nbsp)) {
5f9769
+
5f9769
+        for (size_t i = 0; i < op->od->n_localnet_ports; i++) {
5f9769
+            build_drop_arp_nd_flows_for_unbound_router_ports(
5f9769
+                op, op->od->localnet_ports[i], lflows);
5f9769
+        }
5f9769
+    }
5f9769
+}
5f9769
+
5f9769
 /* Returns a string of the IP address of the router port 'op' that
5f9769
  * overlaps with 'ip_s".  If one is not found, returns NULL.
5f9769
  *
5f9769
@@ -11376,6 +11378,7 @@ build_lswitch_and_lrouter_iterate_by_op(struct ovn_port *op,
5f9769
                                              &lsi->actions,
5f9769
                                              &lsi->match);
5f9769
     build_lswitch_dhcp_options_and_response(op,lsi->lflows);
5f9769
+    build_lswitch_external_port(op, lsi->lflows);
5f9769
 
5f9769
     /* Build Logical Router Flows. */
5f9769
     build_adm_ctrl_flows_for_lrouter_port(op, lsi->lflows, &lsi->match,
5f9769
-- 
5f9769
2.29.2
5f9769