diff mbox series

[ovs-dev,v8,05/11] ovn-northd: Move ARP response for external ports to a function.

Message ID 20210105174938.23376-5-anton.ivanov@cambridgegreys.com
State Accepted
Headers show
Series [ovs-dev,v8,01/11] ovn-northd: Move lswitch ARP/ND Responder to functions | expand

Commit Message

Anton Ivanov Jan. 5, 2021, 5:49 p.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 22e6e801d..daf1db908 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -6780,21 +6780,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) {
@@ -7486,6 +7471,23 @@  build_lswitch_dns_lookup_and_response(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_external_port(struct ovn_port *op,
+                            struct hmap *lflows)
+{
+    if (op->nbsp && lsp_is_external(op->nbsp)) {
+
+        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.
  *
@@ -11376,6 +11378,7 @@  build_lswitch_and_lrouter_iterate_by_op(struct ovn_port *op,
                                              &lsi->actions,
                                              &lsi->match);
     build_lswitch_dhcp_options_and_response(op,lsi->lflows);
+    build_lswitch_external_port(op, lsi->lflows);
 
     /* Build Logical Router Flows. */
     build_adm_ctrl_flows_for_lrouter_port(op, lsi->lflows, &lsi->match,