diff mbox series

[ovs-dev,v2,09/14] ovn-northd: move per datapath dhcp response to a function

Message ID 20200918150756.3414-10-anton.ivanov@cambridgegreys.com
State Superseded
Headers show
Series [ovs-dev,v2,01/14] ovn-northd: add marker for ovn-northd changes | expand

Commit Message

Anton Ivanov Sept. 18, 2020, 3:07 p.m. UTC
From: Anton Ivanov <anton.ivanov@cambridgegreys.com>

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

Patch

diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index e9a3a0fc9..afc35624d 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -6785,6 +6785,17 @@  build_lswitch_dhcp_response(
 static void
 build_lswitch_dns_lookup_response(
                     struct ovn_datapath *od, struct hmap *lflows);
+
+/* Ingress table 14 and 15: DHCP options and response, by default goto
+ * next. (priority 0).
+ * Ingress table 16 and 17: DNS lookup and response, by default goto next.
+ * (priority 0).
+ * Ingress table 18 - External port handling, by default goto next.
+ * (priority 0). */
+static void
+build_lswitch_dhcp_and_dns_response(
+                    struct ovn_datapath *od, struct hmap *lflows);
+
 /*
 * Do not remove this comment - it is here as a marker to
 * make diffs readable.
@@ -6857,23 +6868,8 @@  build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
         build_lswitch_dns_lookup_response(od, lflows);
     }
 
-    /* Ingress table 14 and 15: DHCP options and response, by default goto
-     * next. (priority 0).
-     * Ingress table 16 and 17: DNS lookup and response, by default goto next.
-     * (priority 0).
-     * Ingress table 18 - External port handling, by default goto next.
-     * (priority 0). */
-
     HMAP_FOR_EACH (od, key_node, datapaths) {
-        if (!od->nbs) {
-            continue;
-        }
-
-        ovn_lflow_add(lflows, od, S_SWITCH_IN_DHCP_OPTIONS, 0, "1", "next;");
-        ovn_lflow_add(lflows, od, S_SWITCH_IN_DHCP_RESPONSE, 0, "1", "next;");
-        ovn_lflow_add(lflows, od, S_SWITCH_IN_DNS_LOOKUP, 0, "1", "next;");
-        ovn_lflow_add(lflows, od, S_SWITCH_IN_DNS_RESPONSE, 0, "1", "next;");
-        ovn_lflow_add(lflows, od, S_SWITCH_IN_EXTERNAL_PORT, 0, "1", "next;");
+        build_lswitch_dhcp_and_dns_response(od, lflows);
     }
 
     HMAP_FOR_EACH (op, key_node, ports) {
@@ -7535,6 +7531,20 @@  build_lswitch_dns_lookup_response(
                       dns_match, dns_action);
     }
 }
+
+static void
+build_lswitch_dhcp_and_dns_response(
+                    struct ovn_datapath *od, struct hmap *lflows)
+{
+    if (od->nbs) {
+        ovn_lflow_add(lflows, od, S_SWITCH_IN_DHCP_OPTIONS, 0, "1", "next;");
+        ovn_lflow_add(lflows, od, S_SWITCH_IN_DHCP_RESPONSE, 0, "1", "next;");
+        ovn_lflow_add(lflows, od, S_SWITCH_IN_DNS_LOOKUP, 0, "1", "next;");
+        ovn_lflow_add(lflows, od, S_SWITCH_IN_DNS_RESPONSE, 0, "1", "next;");
+        ovn_lflow_add(lflows, od, S_SWITCH_IN_EXTERNAL_PORT, 0, "1", "next;");
+    }
+
+}
 /* Returns a string of the IP address of the router port 'op' that
  * overlaps with 'ip_s".  If one is not found, returns NULL.
  *