5f9769
From 502d52712bca01f237aa15e5853bc3090e6034e5 Mon Sep 17 00:00:00 2001
5f9769
Message-Id: <502d52712bca01f237aa15e5853bc3090e6034e5.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:31 +0000
5f9769
Subject: [PATCH 04/16] ovn-northd: Move DNS and DHCP defaults to a 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 | 40 ++++++++++++++++++++--------------------
5f9769
 1 file changed, 20 insertions(+), 20 deletions(-)
5f9769
5f9769
diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
5f9769
index be98a6013..45d6a6a2e 100644
5f9769
--- a/northd/ovn-northd.c
5f9769
+++ b/northd/ovn-northd.c
5f9769
@@ -6780,26 +6780,6 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
5f9769
     struct ovn_datapath *od;
5f9769
     struct ovn_port *op;
5f9769
 
5f9769
-
5f9769
-    /* Ingress table 14 and 15: DHCP options and response, by default goto
5f9769
-     * next. (priority 0).
5f9769
-     * Ingress table 16 and 17: DNS lookup and response, by default goto next.
5f9769
-     * (priority 0).
5f9769
-     * Ingress table 18 - External port handling, by default goto next.
5f9769
-     * (priority 0). */
5f9769
-
5f9769
-    HMAP_FOR_EACH (od, key_node, datapaths) {
5f9769
-        if (!od->nbs) {
5f9769
-            continue;
5f9769
-        }
5f9769
-
5f9769
-        ovn_lflow_add(lflows, od, S_SWITCH_IN_DHCP_OPTIONS, 0, "1", "next;");
5f9769
-        ovn_lflow_add(lflows, od, S_SWITCH_IN_DHCP_RESPONSE, 0, "1", "next;");
5f9769
-        ovn_lflow_add(lflows, od, S_SWITCH_IN_DNS_LOOKUP, 0, "1", "next;");
5f9769
-        ovn_lflow_add(lflows, od, S_SWITCH_IN_DNS_RESPONSE, 0, "1", "next;");
5f9769
-        ovn_lflow_add(lflows, od, S_SWITCH_IN_EXTERNAL_PORT, 0, "1", "next;");
5f9769
-    }
5f9769
-
5f9769
     HMAP_FOR_EACH (op, key_node, ports) {
5f9769
         if (!op->nbsp || !lsp_is_external(op->nbsp)) {
5f9769
            continue;
5f9769
@@ -7461,6 +7441,25 @@ build_lswitch_dhcp_options_and_response(struct ovn_port *op,
5f9769
     }
5f9769
 }
5f9769
 
5f9769
+/* Ingress table 14 and 15: DHCP options and response, by default goto
5f9769
+ * next. (priority 0).
5f9769
+ * Ingress table 16 and 17: DNS lookup and response, by default goto next.
5f9769
+ * (priority 0).
5f9769
+ * Ingress table 18 - External port handling, by default goto next.
5f9769
+ * (priority 0). */
5f9769
+static void
5f9769
+build_lswitch_dhcp_and_dns_defaults(struct ovn_datapath *od,
5f9769
+                                        struct hmap *lflows)
5f9769
+{
5f9769
+    if (od->nbs) {
5f9769
+        ovn_lflow_add(lflows, od, S_SWITCH_IN_DHCP_OPTIONS, 0, "1", "next;");
5f9769
+        ovn_lflow_add(lflows, od, S_SWITCH_IN_DHCP_RESPONSE, 0, "1", "next;");
5f9769
+        ovn_lflow_add(lflows, od, S_SWITCH_IN_DNS_LOOKUP, 0, "1", "next;");
5f9769
+        ovn_lflow_add(lflows, od, S_SWITCH_IN_DNS_RESPONSE, 0, "1", "next;");
5f9769
+        ovn_lflow_add(lflows, od, S_SWITCH_IN_EXTERNAL_PORT, 0, "1", "next;");
5f9769
+    }
5f9769
+}
5f9769
+
5f9769
 /* Logical switch ingress table 17 and 18: DNS lookup and response
5f9769
 * priority 100 flows.
5f9769
 */
5f9769
@@ -11339,6 +11338,7 @@ build_lswitch_and_lrouter_iterate_by_od(struct ovn_datapath *od,
5f9769
     build_lswitch_input_port_sec_od(od, lsi->lflows);
5f9769
     build_lswitch_arp_nd_responder_default(od, lsi->lflows);
5f9769
     build_lswitch_dns_lookup_and_response(od, lsi->lflows);
5f9769
+    build_lswitch_dhcp_and_dns_defaults(od, lsi->lflows);
5f9769
 
5f9769
     /* Build Logical Router Flows. */
5f9769
     build_adm_ctrl_flows_for_lrouter(od, lsi->lflows);
5f9769
-- 
5f9769
2.29.2
5f9769