From patchwork Wed Nov 25 13:31:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thadeu Lima de Souza Cascardo X-Patchwork-Id: 548554 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (li376-54.members.linode.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id DC5481402E2 for ; Thu, 26 Nov 2015 00:32:06 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 48A3F10B11; Wed, 25 Nov 2015 05:31:43 -0800 (PST) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e4.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id E4D5910B0D for ; Wed, 25 Nov 2015 05:31:41 -0800 (PST) Received: from bar2.cudamail.com (unknown [192.168.21.12]) by mx1e4.cudamail.com (Postfix) with ESMTPS id 6FEE21E0095 for ; Wed, 25 Nov 2015 06:31:41 -0700 (MST) X-ASG-Debug-ID: 1448458300-03dc5332c8151cd0001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar2.cudamail.com with ESMTP id UpGnkxebWHNC51d1 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 25 Nov 2015 06:31:40 -0700 (MST) X-Barracuda-Envelope-From: cascardo@redhat.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO mx1.redhat.com) (209.132.183.28) by mx1-pf2.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 25 Nov 2015 13:31:40 -0000 Received-SPF: pass (mx1-pf2.cudamail.com: SPF record at _spf1.redhat.com designates 209.132.183.28 as permitted sender) X-Barracuda-Apparent-Source-IP: 209.132.183.28 X-Barracuda-RBL-IP: 209.132.183.28 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id BEA3A96D0 for ; Wed, 25 Nov 2015 13:31:39 +0000 (UTC) Received: from indiana.gru.redhat.com (ovpn-113-86.phx2.redhat.com [10.3.113.86]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tAPDVRE7029492 for ; Wed, 25 Nov 2015 08:31:38 -0500 X-CudaMail-Envelope-Sender: cascardo@redhat.com From: Thadeu Lima de Souza Cascardo To: dev@openvswitch.org X-CudaMail-MID: CM-E2-1124016376 X-CudaMail-DTE: 112515 X-CudaMail-Originating-IP: 209.132.183.28 Date: Wed, 25 Nov 2015 11:31:09 -0200 X-ASG-Orig-Subj: [##CM-E2-1124016376##][PATCH v2 06/14] ofproto-dpif-xlate: use IPv6 for orig_tunnel_ip_dst Message-Id: <1448458277-28154-7-git-send-email-cascardo@redhat.com> In-Reply-To: <1448458277-28154-1-git-send-email-cascardo@redhat.com> References: <1448458277-28154-1-git-send-email-cascardo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-GBUdb-Analysis: 0, 209.132.183.28, Ugly c=0.271956 p=-0.142857 Source Normal X-MessageSniffer-Rules: 0-0-0-6442-c X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1448458300 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.60 X-Barracuda-Spam-Status: No, SCORE=0.60 using per-user scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=4.0 tests=BSF_SC5_MJ1963, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.24709 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 0.50 BSF_SC5_MJ1963 Custom Rule MJ1963 Subject: [ovs-dev] [PATCH v2 06/14] ofproto-dpif-xlate: use IPv6 for orig_tunnel_ip_dst X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" orig_tunnel_ip_dst is replaced by orig_tunnel_ipv6_dst and represents IPv4 addresses as IPv4-mapped IPv6 addresses. Since this is only used in ofproto-dpif-xlate, this change is well contained. Signed-off-by: Thadeu Lima de Souza Cascardo Acked-by: Ben Pfaff --- ofproto/ofproto-dpif-xlate.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 31da161..3b8d1b8 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -171,7 +171,7 @@ struct xlate_ctx { * which might lead to an infinite loop. This could happen easily * if a tunnel is marked as 'ip_remote=flow', and the flow does not * actually set the tun_dst field. */ - ovs_be32 orig_tunnel_ip_dst; + struct in6_addr orig_tunnel_ipv6_dst; /* Stack for the push and pop actions. Each stack element is of type * "union mf_subvalue". */ @@ -2981,6 +2981,7 @@ compose_output_action__(struct xlate_ctx *ctx, ofp_port_t ofp_port, } if (xport->is_tunnel) { + ovs_be32 dst; /* Save tunnel metadata so that changes made due to * the Logical (tunnel) Port are not visible for any further * matches, while explicit set actions on tunnel metadata are. @@ -2991,7 +2992,8 @@ compose_output_action__(struct xlate_ctx *ctx, ofp_port_t ofp_port, xlate_report(ctx, "Tunneling decided against output"); goto out; /* restore flow_nw_tos */ } - if (flow->tunnel.ip_dst == ctx->orig_tunnel_ip_dst) { + dst = in6_addr_get_mapped_ipv4(&ctx->orig_tunnel_ipv6_dst); + if (flow->tunnel.ip_dst == dst) { xlate_report(ctx, "Not tunneling to our own address"); goto out; /* restore flow_nw_tos */ } @@ -4904,7 +4906,6 @@ xlate_actions(struct xlate_in *xin, struct xlate_out *xout) .xin = xin, .xout = xout, .base_flow = *flow, - .orig_tunnel_ip_dst = flow->tunnel.ip_dst, .xbridge = xbridge, .stack = OFPBUF_STUB_INITIALIZER(stack_stub), .rule = xin->rule, @@ -4934,6 +4935,7 @@ xlate_actions(struct xlate_in *xin, struct xlate_out *xout) .action_set_has_group = false, .action_set = OFPBUF_STUB_INITIALIZER(action_set_stub), }; + in6_addr_set_mapped_ipv4(&ctx.orig_tunnel_ipv6_dst, flow->tunnel.ip_dst); /* 'base_flow' reflects the packet as it came in, but we need it to reflect * the packet as the datapath will treat it for output actions: