|
|
bbaaef |
From d9ed450713eda62af1bec5009694b2d206c9f435 Mon Sep 17 00:00:00 2001
|
|
|
bbaaef |
Message-Id: <d9ed450713eda62af1bec5009694b2d206c9f435.1590585469.git.lorenzo.bianconi@redhat.com>
|
|
|
bbaaef |
From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
|
|
|
bbaaef |
Date: Mon, 25 May 2020 23:55:06 +0200
|
|
|
bbaaef |
Subject: [PATCH ovn 1/3] Revert "Manage ARP process locally in a DVR scenario"
|
|
|
bbaaef |
|
|
|
bbaaef |
This reverts commit c0bf32d72f8b893bbe3cb64912b0fd259d71555f.
|
|
|
bbaaef |
|
|
|
bbaaef |
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
|
|
|
bbaaef |
Signed-off-by: Han Zhou <hzhou@ovn.org>
|
|
|
bbaaef |
---
|
|
|
bbaaef |
northd/ovn-northd.8.xml | 37 ++--------------------------
|
|
|
bbaaef |
northd/ovn-northd.c | 53 +----------------------------------------
|
|
|
bbaaef |
tests/ovn.at | 14 -----------
|
|
|
bbaaef |
3 files changed, 3 insertions(+), 101 deletions(-)
|
|
|
bbaaef |
|
|
|
bbaaef |
--- a/ovn/northd/ovn-northd.8.xml
|
|
|
bbaaef |
+++ b/ovn/northd/ovn-northd.8.xml
|
|
|
bbaaef |
@@ -2311,44 +2311,11 @@ output;
|
|
|
bbaaef |
|
|
|
bbaaef |
|
|
|
bbaaef |
|
|
|
bbaaef |
- For distributed logical routers where one of the logical router ports
|
|
|
bbaaef |
- specifies a redirect-chassis , a priority-400 logical
|
|
|
bbaaef |
- flow for each dnat_and_snat NAT rules configured.
|
|
|
bbaaef |
- These flows will allow to properly forward traffic to the external
|
|
|
bbaaef |
- connections if available and avoid sending it through the tunnel.
|
|
|
bbaaef |
- Assuming the following NAT rule has been configured:
|
|
|
bbaaef |
-
|
|
|
bbaaef |
-
|
|
|
bbaaef |
-
|
|
|
bbaaef |
-external_ip = A;
|
|
|
bbaaef |
-external_mac = B;
|
|
|
bbaaef |
-logical_ip = C;
|
|
|
bbaaef |
-
|
|
|
bbaaef |
-
|
|
|
bbaaef |
-
|
|
|
bbaaef |
- the following action will be applied:
|
|
|
bbaaef |
-
|
|
|
bbaaef |
-
|
|
|
bbaaef |
-
|
|
|
bbaaef |
-ip.ttl--;
|
|
|
bbaaef |
-reg0 = ip.dst;
|
|
|
bbaaef |
-reg1 = A;
|
|
|
bbaaef |
-eth.src = B;
|
|
|
bbaaef |
-outport = router-port;
|
|
|
bbaaef |
-next;
|
|
|
bbaaef |
-
|
|
|
bbaaef |
-
|
|
|
bbaaef |
-
|
|
|
bbaaef |
-
|
|
|
bbaaef |
-
|
|
|
bbaaef |
-
|
|
|
bbaaef |
IPv4 routing table. For each route to IPv4 network N with
|
|
|
bbaaef |
netmask M, on router port P with IP address
|
|
|
bbaaef |
A and Ethernet
|
|
|
bbaaef |
address E, a logical flow with match ip4.dst ==
|
|
|
bbaaef |
- N/M, whose priority is 400
|
|
|
bbaaef |
- + the number of 1-bits in M if the router port is not a
|
|
|
bbaaef |
- distributed gateway port, else the priority is the number of
|
|
|
bbaaef |
+ N/M, whose priority is the number of
|
|
|
bbaaef |
1-bits in M, has the following actions:
|
|
|
bbaaef |
|
|
|
bbaaef |
|
|
|
bbaaef |
@@ -2663,7 +2630,7 @@ icmp4 {
|
|
|
bbaaef |
|
|
|
bbaaef |
|
|
|
bbaaef |
For each NAT rule in the OVN Northbound database that can
|
|
|
bbaaef |
- be handled in a distributed manner, a priority-200 logical
|
|
|
bbaaef |
+ be handled in a distributed manner, a priority-100 logical
|
|
|
bbaaef |
flow with match ip4.src == B &&
|
|
|
bbaaef |
outport == GW, where GW is
|
|
|
bbaaef |
the logical router distributed gateway port, with actions
|
|
|
bbaaef |
--- a/ovn/northd/ovn-northd.c
|
|
|
bbaaef |
+++ b/ovn/northd/ovn-northd.c
|
|
|
bbaaef |
@@ -6655,43 +6655,6 @@ build_routing_policy_flow(struct hmap *l
|
|
|
bbaaef |
ds_destroy(&actions);
|
|
|
bbaaef |
}
|
|
|
bbaaef |
|
|
|
bbaaef |
-/* default logical flow prioriry for distributed routes */
|
|
|
bbaaef |
-#define DROUTE_PRIO 400
|
|
|
bbaaef |
-
|
|
|
bbaaef |
-static void
|
|
|
bbaaef |
-add_distributed_routes(struct hmap *lflows, struct ovn_datapath *od)
|
|
|
bbaaef |
-{
|
|
|
bbaaef |
- struct ds actions = DS_EMPTY_INITIALIZER;
|
|
|
bbaaef |
- struct ds match = DS_EMPTY_INITIALIZER;
|
|
|
bbaaef |
-
|
|
|
bbaaef |
- for (size_t i = 0; i < od->nbr->n_nat; i++) {
|
|
|
bbaaef |
- const struct nbrec_nat *nat = od->nbr->nat[i];
|
|
|
bbaaef |
-
|
|
|
bbaaef |
- if (strcmp(nat->type, "dnat_and_snat") ||
|
|
|
bbaaef |
- !nat->external_mac) {
|
|
|
bbaaef |
- continue;
|
|
|
bbaaef |
- }
|
|
|
bbaaef |
-
|
|
|
bbaaef |
- bool is_ipv4 = strchr(nat->logical_ip, '.') ? true : false;
|
|
|
bbaaef |
- ds_put_format(&match, "ip%s.src == %s && is_chassis_resident(\"%s\")",
|
|
|
bbaaef |
- is_ipv4 ? "4" : "6", nat->logical_ip,
|
|
|
bbaaef |
- nat->logical_port);
|
|
|
bbaaef |
- char *prefix = is_ipv4 ? "" : "xx";
|
|
|
bbaaef |
- ds_put_format(&actions, "outport = %s; eth.src = %s; "
|
|
|
bbaaef |
- "%sreg0 = ip%s.dst; %sreg1 = %s; next;",
|
|
|
bbaaef |
- od->l3dgw_port->json_key, nat->external_mac,
|
|
|
bbaaef |
- prefix, is_ipv4 ? "4" : "6",
|
|
|
bbaaef |
- prefix, nat->external_ip);
|
|
|
bbaaef |
- ovn_lflow_add(lflows, od, S_ROUTER_IN_IP_ROUTING, DROUTE_PRIO,
|
|
|
bbaaef |
- ds_cstr(&match), ds_cstr(&actions));
|
|
|
bbaaef |
- ds_clear(&match);
|
|
|
bbaaef |
- ds_clear(&actions);
|
|
|
bbaaef |
- }
|
|
|
bbaaef |
-
|
|
|
bbaaef |
- ds_destroy(&actions);
|
|
|
bbaaef |
- ds_destroy(&match);
|
|
|
bbaaef |
-}
|
|
|
bbaaef |
-
|
|
|
bbaaef |
static void
|
|
|
bbaaef |
add_route(struct hmap *lflows, const struct ovn_port *op,
|
|
|
bbaaef |
const char *lrp_addr_s, const char *network_s, int plen,
|
|
|
bbaaef |
@@ -6710,13 +6673,6 @@ add_route(struct hmap *lflows, const str
|
|
|
bbaaef |
priority = (plen * 2) + 1;
|
|
|
bbaaef |
}
|
|
|
bbaaef |
|
|
|
bbaaef |
- /* traffic for internal IPs of logical switch ports must be sent to
|
|
|
bbaaef |
- * the gw controller through the overlay tunnels
|
|
|
bbaaef |
- */
|
|
|
bbaaef |
- if (op->nbrp && !op->nbrp->n_gateway_chassis) {
|
|
|
bbaaef |
- priority += DROUTE_PRIO;
|
|
|
bbaaef |
- }
|
|
|
bbaaef |
-
|
|
|
bbaaef |
/* IPv6 link-local addresses must be scoped to the local router port. */
|
|
|
bbaaef |
if (!is_ipv4) {
|
|
|
bbaaef |
struct in6_addr network;
|
|
|
bbaaef |
@@ -8357,7 +8313,7 @@ build_lrouter_flows(struct hmap *datapat
|
|
|
bbaaef |
is_v6 ? "6" : "4",
|
|
|
bbaaef |
nat->logical_ip,
|
|
|
bbaaef |
od->l3dgw_port->json_key);
|
|
|
bbaaef |
- ovn_lflow_add(lflows, od, S_ROUTER_IN_GW_REDIRECT, 200,
|
|
|
bbaaef |
+ ovn_lflow_add(lflows, od, S_ROUTER_IN_GW_REDIRECT, 100,
|
|
|
bbaaef |
ds_cstr(&match), "next;");
|
|
|
bbaaef |
}
|
|
|
bbaaef |
|
|
|
bbaaef |
@@ -8633,15 +8589,6 @@ build_lrouter_flows(struct hmap *datapat
|
|
|
bbaaef |
ovn_lflow_add(lflows, od, S_ROUTER_IN_ND_RA_RESPONSE, 0, "1", "next;");
|
|
|
bbaaef |
}
|
|
|
bbaaef |
|
|
|
bbaaef |
- /* Logical router ingress table IP_ROUTING - IP routing for distributed
|
|
|
bbaaef |
- * logical router
|
|
|
bbaaef |
- */
|
|
|
bbaaef |
- HMAP_FOR_EACH (od, key_node, datapaths) {
|
|
|
bbaaef |
- if (od->nbr && od->l3dgw_port) {
|
|
|
bbaaef |
- add_distributed_routes(lflows, od);
|
|
|
bbaaef |
- }
|
|
|
bbaaef |
- }
|
|
|
bbaaef |
-
|
|
|
bbaaef |
/* Logical router ingress table 7: IP Routing.
|
|
|
bbaaef |
*
|
|
|
bbaaef |
* A packet that arrives at this table is an IP packet that should be
|
|
|
bbaaef |
--- a/tests/ovn.at
|
|
|
bbaaef |
+++ b/tests/ovn.at
|
|
|
bbaaef |
@@ -9482,20 +9482,6 @@ AT_CHECK([as hv3 ovs-vsctl set Open_vSwi
|
|
|
bbaaef |
OVS_WAIT_UNTIL([test 1 = `as hv3 ovs-vsctl show | \
|
|
|
bbaaef |
grep "Port patch-br-int-to-ln_port" | wc -l`])
|
|
|
bbaaef |
|
|
|
bbaaef |
-AT_CHECK([test 1 = `ovn-sbctl dump-flows lr0 | grep lr_in_ip_routing | \
|
|
|
bbaaef |
-grep "ip4.src == 10.0.0.3 && is_chassis_resident(\"foo1\")" -c`])
|
|
|
bbaaef |
-AT_CHECK([test 1 = `ovn-sbctl dump-flows lr0 | grep lr_in_ip_routing | \
|
|
|
bbaaef |
-grep "ip4.src == 10.0.0.4 && is_chassis_resident(\"foo2\")" -c`])
|
|
|
bbaaef |
-
|
|
|
bbaaef |
-key=`ovn-sbctl --bare --columns tunnel_key list datapath_Binding lr0`
|
|
|
bbaaef |
-# Check that the OVS flows appear for the dnat_and_snat entries in
|
|
|
bbaaef |
-# lr_in_ip_routing table.
|
|
|
bbaaef |
-OVS_WAIT_UNTIL([test 1 = `as hv3 ovs-ofctl dump-flows br-int table=17 | \
|
|
|
bbaaef |
-grep "priority=400,ip,metadata=0x$key,nw_src=10.0.0.3" -c`])
|
|
|
bbaaef |
-
|
|
|
bbaaef |
-OVS_WAIT_UNTIL([test 1 = `as hv3 ovs-ofctl dump-flows br-int table=17 | \
|
|
|
bbaaef |
-grep "priority=400,ip,metadata=0x$key,nw_src=10.0.0.4" -c`])
|
|
|
bbaaef |
-
|
|
|
bbaaef |
# Re-add nat-addresses option
|
|
|
bbaaef |
ovn-nbctl lsp-set-options lrp0-rp router-port=lrp0 nat-addresses="router"
|
|
|
bbaaef |
|