From patchwork Tue Jun 26 18:42:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Michelson X-Patchwork-Id: 935066 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41FZfP4k7mz9ryk for ; Wed, 27 Jun 2018 04:42:37 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 31D94CCA; Tue, 26 Jun 2018 18:42:35 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 70055707 for ; Tue, 26 Jun 2018 18:42:34 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 1B3D817E for ; Tue, 26 Jun 2018 18:42:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EBA2281A4EAD for ; Tue, 26 Jun 2018 18:42:32 +0000 (UTC) Received: from monae.redhat.com (ovpn-122-23.rdu2.redhat.com [10.10.122.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id B7A032026D6A for ; Tue, 26 Jun 2018 18:42:32 +0000 (UTC) From: Mark Michelson To: dev@openvswitch.org Date: Tue, 26 Jun 2018 14:42:32 -0400 Message-Id: <20180626184232.10399-1-mmichels@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 26 Jun 2018 18:42:32 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Tue, 26 Jun 2018 18:42:32 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mmichels@redhat.com' RCPT:'' X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] ovn: Add router load balancer undnat rule for IPv6 X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org When configuring a router port to have a redirect-chassis and using an IPv6 load balancer rule that specifies a TCP/UDP port, load balancing would not work as expected. This is because a rule to un-dnat the return traffic from the load balancer destination was not installed. This is because this rule was only being installed for IPv4 load balancers. This change adds the same rule for IPv6 load balancers as well. Signed-off-by: Mark Michelson --- ovn/northd/ovn-northd.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c index 72fe4e795..2ca439b39 100644 --- a/ovn/northd/ovn-northd.c +++ b/ovn/northd/ovn-northd.c @@ -4641,8 +4641,7 @@ add_router_lb_flow(struct hmap *lflows, struct ovn_datapath *od, free(new_match); free(est_match); - if (!od->l3dgw_port || !od->l3redirect_port || !backend_ips - || addr_family != AF_INET) { + if (!od->l3dgw_port || !od->l3redirect_port || !backend_ips) { return; } @@ -4651,7 +4650,11 @@ add_router_lb_flow(struct hmap *lflows, struct ovn_datapath *od, * router has a gateway router port associated. */ struct ds undnat_match = DS_EMPTY_INITIALIZER; - ds_put_cstr(&undnat_match, "ip4 && ("); + if (addr_family == AF_INET) { + ds_put_cstr(&undnat_match, "ip4 && ("); + } else { + ds_put_cstr(&undnat_match, "ip6 && ("); + } char *start, *next, *ip_str; start = next = xstrdup(backend_ips); ip_str = strsep(&next, ","); @@ -4666,7 +4669,11 @@ add_router_lb_flow(struct hmap *lflows, struct ovn_datapath *od, break; } - ds_put_format(&undnat_match, "(ip4.src == %s", ip_address); + if (addr_family_ == AF_INET) { + ds_put_format(&undnat_match, "(ip4.src == %s", ip_address); + } else { + ds_put_format(&undnat_match, "(ip6.src == %s", ip_address); + } free(ip_address); if (port) { ds_put_format(&undnat_match, " && %s.src == %d) || ",