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