diff mbox series

[ovs-dev,RFC,v4,21/24] Pull DNS response defaults into a separate function

Message ID 20200902145950.25875-21-anton.ivanov@cambridgegreys.com
State Superseded
Headers show
Series [ovs-dev,RFC,v4,01/24] Move out Table 0 (ingress) operations to functions | expand

Commit Message

Anton Ivanov Sept. 2, 2020, 2:59 p.m. UTC
From: Anton Ivanov <anton.ivanov@cambridgegreys.com>

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

Patch

diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index 46d56c4d2..5ce33090d 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -6932,6 +6932,25 @@  build_lswitch_flows_dns_lookup_od(
     ds_destroy(&match);
 }
 
+static void
+build_lswitch_flows_dns_response_od(
+        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). */
+    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;");
+    }
+}
+
 static void
 build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
                     struct hmap *port_groups, struct hmap *lflows,
@@ -7031,23 +7050,8 @@  build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
         build_lswitch_flows_dns_lookup_od(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_flows_dns_response_od(od, lflows);
     }
 
     HMAP_FOR_EACH (op, key_node, ports) {