|
|
5f9769 |
From e513bafe5718f42844f41d248ddf1777b71aaa50 Mon Sep 17 00:00:00 2001
|
|
|
5f9769 |
Message-Id: <e513bafe5718f42844f41d248ddf1777b71aaa50.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:29 +0000
|
|
|
5f9769 |
Subject: [PATCH 02/16] ovn-northd: Move DHCP Options and Response to a
|
|
|
5f9769 |
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 | 100 ++++++++++++++++++++++----------------------
|
|
|
5f9769 |
1 file changed, 51 insertions(+), 49 deletions(-)
|
|
|
5f9769 |
|
|
|
5f9769 |
diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
|
|
|
5f9769 |
index d17cc55ac..a5b28584f 100644
|
|
|
5f9769 |
--- a/northd/ovn-northd.c
|
|
|
5f9769 |
+++ b/northd/ovn-northd.c
|
|
|
5f9769 |
@@ -6780,55 +6780,6 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
|
|
|
5f9769 |
struct ovn_datapath *od;
|
|
|
5f9769 |
struct ovn_port *op;
|
|
|
5f9769 |
|
|
|
5f9769 |
-
|
|
|
5f9769 |
- /* Logical switch ingress table 14 and 15: DHCP options and response
|
|
|
5f9769 |
- * priority 100 flows. */
|
|
|
5f9769 |
- HMAP_FOR_EACH (op, key_node, ports) {
|
|
|
5f9769 |
- if (!op->nbsp) {
|
|
|
5f9769 |
- continue;
|
|
|
5f9769 |
- }
|
|
|
5f9769 |
-
|
|
|
5f9769 |
- if (!lsp_is_enabled(op->nbsp) || lsp_is_router(op->nbsp)) {
|
|
|
5f9769 |
- /* Don't add the DHCP flows if the port is not enabled or if the
|
|
|
5f9769 |
- * port is a router port. */
|
|
|
5f9769 |
- continue;
|
|
|
5f9769 |
- }
|
|
|
5f9769 |
-
|
|
|
5f9769 |
- if (!op->nbsp->dhcpv4_options && !op->nbsp->dhcpv6_options) {
|
|
|
5f9769 |
- /* CMS has disabled both native DHCPv4 and DHCPv6 for this lport.
|
|
|
5f9769 |
- */
|
|
|
5f9769 |
- continue;
|
|
|
5f9769 |
- }
|
|
|
5f9769 |
-
|
|
|
5f9769 |
- bool is_external = lsp_is_external(op->nbsp);
|
|
|
5f9769 |
- if (is_external && (!op->od->n_localnet_ports ||
|
|
|
5f9769 |
- !op->nbsp->ha_chassis_group)) {
|
|
|
5f9769 |
- /* If it's an external port and there are no localnet ports
|
|
|
5f9769 |
- * and if it doesn't belong to an HA chassis group ignore it. */
|
|
|
5f9769 |
- continue;
|
|
|
5f9769 |
- }
|
|
|
5f9769 |
-
|
|
|
5f9769 |
- for (size_t i = 0; i < op->n_lsp_addrs; i++) {
|
|
|
5f9769 |
- if (is_external) {
|
|
|
5f9769 |
- for (size_t j = 0; j < op->od->n_localnet_ports; j++) {
|
|
|
5f9769 |
- build_dhcpv4_options_flows(
|
|
|
5f9769 |
- op, &op->lsp_addrs[i],
|
|
|
5f9769 |
- op->od->localnet_ports[j]->json_key, is_external,
|
|
|
5f9769 |
- lflows);
|
|
|
5f9769 |
- build_dhcpv6_options_flows(
|
|
|
5f9769 |
- op, &op->lsp_addrs[i],
|
|
|
5f9769 |
- op->od->localnet_ports[j]->json_key, is_external,
|
|
|
5f9769 |
- lflows);
|
|
|
5f9769 |
- }
|
|
|
5f9769 |
- } else {
|
|
|
5f9769 |
- build_dhcpv4_options_flows(op, &op->lsp_addrs[i], op->json_key,
|
|
|
5f9769 |
- is_external, lflows);
|
|
|
5f9769 |
- build_dhcpv6_options_flows(op, &op->lsp_addrs[i], op->json_key,
|
|
|
5f9769 |
- is_external, lflows);
|
|
|
5f9769 |
- }
|
|
|
5f9769 |
- }
|
|
|
5f9769 |
- }
|
|
|
5f9769 |
-
|
|
|
5f9769 |
/* Logical switch ingress table 17 and 18: DNS lookup and response
|
|
|
5f9769 |
* priority 100 flows.
|
|
|
5f9769 |
*/
|
|
|
5f9769 |
@@ -7484,6 +7435,55 @@ build_lswitch_arp_nd_service_monitor(struct ovn_northd_lb *lb,
|
|
|
5f9769 |
}
|
|
|
5f9769 |
|
|
|
5f9769 |
|
|
|
5f9769 |
+/* Logical switch ingress table 14 and 15: DHCP options and response
|
|
|
5f9769 |
+ * priority 100 flows. */
|
|
|
5f9769 |
+static void
|
|
|
5f9769 |
+build_lswitch_dhcp_options_and_response(struct ovn_port *op,
|
|
|
5f9769 |
+ struct hmap *lflows)
|
|
|
5f9769 |
+{
|
|
|
5f9769 |
+ if (op->nbsp) {
|
|
|
5f9769 |
+ if (!lsp_is_enabled(op->nbsp) || lsp_is_router(op->nbsp)) {
|
|
|
5f9769 |
+ /* Don't add the DHCP flows if the port is not enabled or if the
|
|
|
5f9769 |
+ * port is a router port. */
|
|
|
5f9769 |
+ return;
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ if (!op->nbsp->dhcpv4_options && !op->nbsp->dhcpv6_options) {
|
|
|
5f9769 |
+ /* CMS has disabled both native DHCPv4 and DHCPv6 for this lport.
|
|
|
5f9769 |
+ */
|
|
|
5f9769 |
+ return;
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ bool is_external = lsp_is_external(op->nbsp);
|
|
|
5f9769 |
+ if (is_external && (!op->od->n_localnet_ports ||
|
|
|
5f9769 |
+ !op->nbsp->ha_chassis_group)) {
|
|
|
5f9769 |
+ /* If it's an external port and there are no localnet ports
|
|
|
5f9769 |
+ * and if it doesn't belong to an HA chassis group ignore it. */
|
|
|
5f9769 |
+ return;
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+
|
|
|
5f9769 |
+ for (size_t i = 0; i < op->n_lsp_addrs; i++) {
|
|
|
5f9769 |
+ if (is_external) {
|
|
|
5f9769 |
+ for (size_t j = 0; j < op->od->n_localnet_ports; j++) {
|
|
|
5f9769 |
+ build_dhcpv4_options_flows(
|
|
|
5f9769 |
+ op, &op->lsp_addrs[i],
|
|
|
5f9769 |
+ op->od->localnet_ports[j]->json_key, is_external,
|
|
|
5f9769 |
+ lflows);
|
|
|
5f9769 |
+ build_dhcpv6_options_flows(
|
|
|
5f9769 |
+ op, &op->lsp_addrs[i],
|
|
|
5f9769 |
+ op->od->localnet_ports[j]->json_key, is_external,
|
|
|
5f9769 |
+ lflows);
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+ } else {
|
|
|
5f9769 |
+ build_dhcpv4_options_flows(op, &op->lsp_addrs[i], op->json_key,
|
|
|
5f9769 |
+ is_external, lflows);
|
|
|
5f9769 |
+ build_dhcpv6_options_flows(op, &op->lsp_addrs[i], op->json_key,
|
|
|
5f9769 |
+ is_external, lflows);
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+ }
|
|
|
5f9769 |
+}
|
|
|
5f9769 |
+
|
|
|
5f9769 |
/* Returns a string of the IP address of the router port 'op' that
|
|
|
5f9769 |
* overlaps with 'ip_s". If one is not found, returns NULL.
|
|
|
5f9769 |
*
|
|
|
5f9769 |
@@ -11371,6 +11371,8 @@ build_lswitch_and_lrouter_iterate_by_op(struct ovn_port *op,
|
|
|
5f9769 |
lsi->ports,
|
|
|
5f9769 |
&lsi->actions,
|
|
|
5f9769 |
&lsi->match);
|
|
|
5f9769 |
+ build_lswitch_dhcp_options_and_response(op,lsi->lflows);
|
|
|
5f9769 |
+
|
|
|
5f9769 |
/* Build Logical Router Flows. */
|
|
|
5f9769 |
build_adm_ctrl_flows_for_lrouter_port(op, lsi->lflows, &lsi->match,
|
|
|
5f9769 |
&lsi->actions);
|
|
|
5f9769 |
--
|
|
|
5f9769 |
2.29.2
|
|
|
5f9769 |
|