From d63444b7fcdcc2c68b7af94090410bc3e40e574b Mon Sep 17 00:00:00 2001
Message-Id: <d63444b7fcdcc2c68b7af94090410bc3e40e574b.1610458802.git.lorenzo.bianconi@redhat.com>
In-Reply-To: <f21c1b7a467a691847b5552d4570af706fcc5bb0.1610458802.git.lorenzo.bianconi@redhat.com>
References: <f21c1b7a467a691847b5552d4570af706fcc5bb0.1610458802.git.lorenzo.bianconi@redhat.com>
From: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Date: Tue, 5 Jan 2021 17:49:32 +0000
Subject: [PATCH 05/16] ovn-northd: Move ARP response for external ports to a
function.
Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Signed-off-by: Numan Siddique <numans@ovn.org>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
northd/ovn-northd.c | 33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index 45d6a6a2e..09bfaae5e 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,
--
2.29.2