diff mbox series

[ovs-dev,v7,07/14] ovn-northd: move arp drops on external to a function

Message ID 20201125110216.7944-8-anton.ivanov@cambridgegreys.com
State Superseded
Headers show
Series [ovs-dev,v7,01/14] ovn-libs: Add support for parallel processing | expand

Commit Message

Anton Ivanov Nov. 25, 2020, 11:02 a.m. UTC
From: Anton Ivanov <anton.ivanov@cambridgegreys.com>

Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
---
 northd/ovn-northd.c | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)
diff mbox series

Patch

diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index 9e6bc32b1..546f7bcde 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -6695,21 +6695,6 @@  build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
     struct ovn_datapath *od;
     struct ovn_port *op;
 
-    HMAP_FOR_EACH (op, key_node, ports) {
-        if (!op->nbsp || !lsp_is_external(op->nbsp)) {
-           continue;
-        }
-
-        /* Table 18: External port. Drop ARP request for router ips from
-         * external ports  on chassis not binding those ports.
-         * This makes the router pipeline to be run only on the chassis
-         * binding the external ports. */
-        for (size_t i = 0; i < op->od->n_localnet_ports; i++) {
-            build_drop_arp_nd_flows_for_unbound_router_ports(
-                op, op->od->localnet_ports[i], lflows);
-        }
-    }
-
     /* Ingress table 19: Destination lookup, broadcast and multicast handling
      * (priority 70 - 100). */
     HMAP_FOR_EACH (od, key_node, datapaths) {
@@ -7398,7 +7383,24 @@  build_lswitch_dns_and_dhcp_defaults(struct ovn_datapath *od,
     }
 }
 
+/* Table 18: External port. Drop ARP request for router ips from
+ * external ports  on chassis not binding those ports.
+ * This makes the router pipeline to be run only on the chassis
+ * binding the external ports. */
+
+static void
+build_lswitch_drop_arp_on_external(struct ovn_port *op,
+                                  struct hmap *lflows)
+{
+    if (!op->nbsp || !lsp_is_external(op->nbsp)) {
+       return;
+    }
 
+    for (size_t i = 0; i < op->od->n_localnet_ports; i++) {
+        build_drop_arp_nd_flows_for_unbound_router_ports(
+            op, op->od->localnet_ports[i], lflows);
+    }
+}
 
 /* Returns a string of the IP address of the router port 'op' that
  * overlaps with 'ip_s".  If one is not found, returns NULL.
@@ -11168,6 +11170,7 @@  build_lswitch_and_lrouter_iterate_by_op(struct ovn_port *op,
     build_lswitch_arp_nd_responder_op(op, lsi->lflows, lsi->ports,
                                       &lsi->match, &lsi->actions);
     build_lswitch_dhcp_options_and_response(op, lsi->lflows);
+    build_lswitch_drop_arp_on_external(op, lsi->lflows);
 
     /* Build Logical Router Flows. */
     build_adm_ctrl_flows_for_lrouter_port(op, lsi->lflows, &lsi->match,