From patchwork Thu Feb 18 08:50:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frode Nordahl X-Patchwork-Id: 1441574 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dh7j620F4z9sRf for ; Thu, 18 Feb 2021 19:51:06 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id AEFD1863BB; Thu, 18 Feb 2021 08:51:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eN93qHE867_P; Thu, 18 Feb 2021 08:51:00 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id F3DD68625F; Thu, 18 Feb 2021 08:50:59 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id DA8A6C0016; Thu, 18 Feb 2021 08:50:59 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 68E45C0017 for ; Thu, 18 Feb 2021 08:50:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 529B086D6F for ; Thu, 18 Feb 2021 08:50:57 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9v50SaCv-MZ8 for ; Thu, 18 Feb 2021 08:50:56 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from frode-threadripper.home (ti0189a330-0925.bb.online.no [88.88.218.161]) by whitealder.osuosl.org (Postfix) with ESMTP id 20E4586C62 for ; Thu, 18 Feb 2021 08:50:55 +0000 (UTC) From: Frode Nordahl To: dev@openvswitch.org Date: Thu, 18 Feb 2021 09:50:38 +0100 Message-Id: X-Mailer: git-send-email 2.30.0 In-Reply-To: References: MIME-Version: 1.0 Subject: [ovs-dev] [PATCH ovn branch-20.03 02/16] Revert "Manage ARP process locally in a DVR scenario" X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Lorenzo Bianconi This reverts commit c0bf32d72f8b893bbe3cb64912b0fd259d71555f. Signed-off-by: Lorenzo Bianconi Signed-off-by: Han Zhou (cherry picked from commit d9ed450713eda62af1bec5009694b2d206c9f435) Signed-off-by: Frode Nordahl --- northd/ovn-northd.8.xml | 37 ++-------------------------- northd/ovn-northd.c | 53 +---------------------------------------- tests/ovn.at | 14 ----------- 3 files changed, 3 insertions(+), 101 deletions(-) diff --git a/northd/ovn-northd.8.xml b/northd/ovn-northd.8.xml index f5a14d26e..4b8264bb4 100644 --- a/northd/ovn-northd.8.xml +++ b/northd/ovn-northd.8.xml @@ -2484,46 +2484,13 @@ output;

-
  • -

    - For distributed logical routers where one of the logical router ports - specifies a redirect-chassis, a priority-400 logical - flow for each dnat_and_snat NAT rules configured. - These flows will allow to properly forward traffic to the external - connections if available and avoid sending it through the tunnel. - Assuming the following NAT rule has been configured: -

    - -
    -external_ip = A;
    -external_mac = B;
    -logical_ip = C;
    -        
    - -

    - the following action will be applied: -

    - -
    -ip.ttl--;
    -reg0 = ip.dst;
    -reg1 = A;
    -eth.src = B;
    -outport = router-port;
    -next;
    -        
    - -
  • -
  • IPv4 routing table. For each route to IPv4 network N with netmask M, on router port P with IP address A and Ethernet address E, a logical flow with match ip4.dst == - N/M, whose priority is 400 - + the number of 1-bits in M if the router port is not a - distributed gateway port, else the priority is the number of + N/M, whose priority is the number of 1-bits in M, has the following actions:

    @@ -2922,7 +2889,7 @@ icmp4 {
  • For each NAT rule in the OVN Northbound database that can - be handled in a distributed manner, a priority-200 logical + be handled in a distributed manner, a priority-100 logical flow with match ip4.src == B && outport == GW, where GW is the logical router distributed gateway port, with actions diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index 62911986b..2453dca08 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -7060,8 +7060,6 @@ build_routing_policy_flow(struct hmap *lflows, struct ovn_datapath *od, ds_destroy(&actions); } -/* default logical flow prioriry for distributed routes */ -#define DROUTE_PRIO 400 struct parsed_route { struct ovs_list list_node; struct v46_ip prefix; @@ -7449,40 +7447,6 @@ build_ecmp_route_flow(struct hmap *lflows, struct ovn_datapath *od, ds_destroy(&actions); } -static void -add_distributed_routes(struct hmap *lflows, struct ovn_datapath *od) -{ - struct ds actions = DS_EMPTY_INITIALIZER; - struct ds match = DS_EMPTY_INITIALIZER; - - for (size_t i = 0; i < od->nbr->n_nat; i++) { - const struct nbrec_nat *nat = od->nbr->nat[i]; - - if (strcmp(nat->type, "dnat_and_snat") || - !nat->external_mac) { - continue; - } - - bool is_ipv4 = strchr(nat->logical_ip, '.') ? true : false; - ds_put_format(&match, "ip%s.src == %s && is_chassis_resident(\"%s\")", - is_ipv4 ? "4" : "6", nat->logical_ip, - nat->logical_port); - char *prefix = is_ipv4 ? "" : "xx"; - ds_put_format(&actions, "outport = %s; eth.src = %s; " - "%sreg0 = ip%s.dst; %sreg1 = %s; next;", - od->l3dgw_port->json_key, nat->external_mac, - prefix, is_ipv4 ? "4" : "6", - prefix, nat->external_ip); - ovn_lflow_add(lflows, od, S_ROUTER_IN_IP_ROUTING, DROUTE_PRIO, - ds_cstr(&match), ds_cstr(&actions)); - ds_clear(&match); - ds_clear(&actions); - } - - ds_destroy(&actions); - ds_destroy(&match); -} - static void add_route(struct hmap *lflows, const struct ovn_port *op, const char *lrp_addr_s, const char *network_s, int plen, @@ -7504,12 +7468,6 @@ add_route(struct hmap *lflows, const struct ovn_port *op, } build_route_match(op_inport, network_s, plen, is_src_route, is_ipv4, &match, &priority); - /* traffic for internal IPs of logical switch ports must be sent to - * the gw controller through the overlay tunnels - */ - if (op->nbrp && !op->nbrp->n_gateway_chassis) { - priority += DROUTE_PRIO; - } struct ds actions = DS_EMPTY_INITIALIZER; ds_put_format(&actions, "ip.ttl--; "REG_ECMP_GROUP_ID" = 0; %sreg0 = ", @@ -9119,7 +9077,7 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, nat->logical_ip, od->l3dgw_port->json_key); ovn_lflow_add_with_hint(lflows, od, S_ROUTER_IN_GW_REDIRECT, - 200, ds_cstr(&match), "next;", + 100, ds_cstr(&match), "next;", &nat->header_); } @@ -9408,15 +9366,6 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, ovn_lflow_add(lflows, od, S_ROUTER_IN_ND_RA_RESPONSE, 0, "1", "next;"); } - /* Logical router ingress table IP_ROUTING - IP routing for distributed - * logical router - */ - HMAP_FOR_EACH (od, key_node, datapaths) { - if (od->nbr && od->l3dgw_port) { - add_distributed_routes(lflows, od); - } - } - /* Logical router ingress table IP_ROUTING & IP_ROUTING_ECMP: IP Routing. * * A packet that arrives at this table is an IP packet that should be diff --git a/tests/ovn.at b/tests/ovn.at index 7d513937a..a0946d195 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -9531,20 +9531,6 @@ AT_CHECK([as hv3 ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=p OVS_WAIT_UNTIL([test 1 = `as hv3 ovs-vsctl show | \ grep "Port patch-br-int-to-ln_port" | wc -l`]) -AT_CHECK([test 1 = `ovn-sbctl dump-flows lr0 | grep lr_in_ip_routing | \ -grep "ip4.src == 10.0.0.3 && is_chassis_resident(\"foo1\")" -c`]) -AT_CHECK([test 1 = `ovn-sbctl dump-flows lr0 | grep lr_in_ip_routing | \ -grep "ip4.src == 10.0.0.4 && is_chassis_resident(\"foo2\")" -c`]) - -key=`ovn-sbctl --bare --columns tunnel_key list datapath_Binding lr0` -# Check that the OVS flows appear for the dnat_and_snat entries in -# lr_in_ip_routing table. -OVS_WAIT_UNTIL([test 1 = `as hv3 ovs-ofctl dump-flows br-int table=17 | \ -grep "priority=400,ip,metadata=0x$key,nw_src=10.0.0.3" -c`]) - -OVS_WAIT_UNTIL([test 1 = `as hv3 ovs-ofctl dump-flows br-int table=17 | \ -grep "priority=400,ip,metadata=0x$key,nw_src=10.0.0.4" -c`]) - # Re-add nat-addresses option ovn-nbctl lsp-set-options lrp0-rp router-port=lrp0 nat-addresses="router"