From patchwork Thu Oct 22 17:29:04 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: 534513 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 EC66814130F for ; Fri, 23 Oct 2015 04:30:35 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 1C97C10998; Thu, 22 Oct 2015 10:29:36 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e3.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id 5C306108EA for ; Thu, 22 Oct 2015 10:29:35 -0700 (PDT) Received: from bar5.cudamail.com (localhost [127.0.0.1]) by mx1e3.cudamail.com (Postfix) with ESMTPS id 52FB8420128 for ; Thu, 22 Oct 2015 11:29:34 -0600 (MDT) X-ASG-Debug-ID: 1445534972-09eadd4c9316d4c0001-byXFYA Received: from mx1-pf1.cudamail.com ([192.168.24.1]) by bar5.cudamail.com with ESMTP id BEQ7JkLA0peJEZpF (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 22 Oct 2015 11:29:32 -0600 (MDT) X-Barracuda-Envelope-From: cascardo@redhat.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.1 Received: from unknown (HELO mx1.redhat.com) (209.132.183.28) by mx1-pf1.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 22 Oct 2015 17:29:32 -0000 Received-SPF: pass (mx1-pf1.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-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 0C0148E23F for ; Thu, 22 Oct 2015 17:29:30 +0000 (UTC) Received: from indiana.gru.redhat.com (ovpn-113-35.phx2.redhat.com [10.3.113.35]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9MHTEAe023789 for ; Thu, 22 Oct 2015 13:29:29 -0400 X-CudaMail-Envelope-Sender: cascardo@redhat.com From: Thadeu Lima de Souza Cascardo To: dev@openvswitch.org X-CudaMail-MID: CM-E1-1021059178 X-CudaMail-DTE: 102215 X-CudaMail-Originating-IP: 209.132.183.28 Date: Thu, 22 Oct 2015 15:29:04 -0200 X-ASG-Orig-Subj: [##CM-E1-1021059178##][PATCH 11/15] ofproto-dpif-xlate: Add IPv6 ND support for XC_TNL_ARP Message-Id: <1445534948-10538-12-git-send-email-cascardo@redhat.com> In-Reply-To: <1445534948-10538-1-git-send-email-cascardo@redhat.com> References: <1445534948-10538-1-git-send-email-cascardo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-GBUdb-Analysis: 0, 209.132.183.28, Ugly c=0.385168 p=-0.0952381 Source Normal X-MessageSniffer-Rules: 0-0-0-5304-c X-Barracuda-Connect: UNKNOWN[192.168.24.1] X-Barracuda-Start-Time: 1445534972 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.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=3.0 tests=BSF_SC5_MJ1963, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.23721 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 11/15] ofproto-dpif-xlate: Add IPv6 ND support for XC_TNL_ARP 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" Use IPv4-mapped addresses and use either tnl_arp_lookup or tnl_nd_lookup. Signed-off-by: Thadeu Lima de Souza Cascardo --- ofproto/ofproto-dpif-xlate.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 07c1197..65e1e27 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -423,7 +423,7 @@ struct xc_entry { } group; struct { char br_name[IFNAMSIZ]; - ovs_be32 d_ip; + struct in6_addr d_ipv6; } tnl_arp_cache; } u; }; @@ -2774,7 +2774,7 @@ build_tunnel_send(struct xlate_ctx *ctx, const struct xport *xport, entry = xlate_cache_add_entry(ctx->xin->xcache, XC_TNL_ARP); ovs_strlcpy(entry->u.tnl_arp_cache.br_name, out_dev->xbridge->name, sizeof entry->u.tnl_arp_cache.br_name); - entry->u.tnl_arp_cache.d_ip = d_ip; + in6_addr_set_mapped_ipv4(&entry->u.tnl_arp_cache.d_ipv6, d_ip); } xlate_report(ctx, "tunneling from "ETH_ADDR_FMT" "IP_FMT @@ -5305,6 +5305,7 @@ xlate_push_stats(struct xlate_cache *xcache, struct xc_entry *entry; struct ofpbuf entries = xcache->entries; struct eth_addr dmac; + ovs_be32 d_ip; if (!stats->n_packets) { return; @@ -5348,8 +5349,13 @@ xlate_push_stats(struct xlate_cache *xcache, break; case XC_TNL_ARP: /* Lookup arp to avoid arp timeout. */ - tnl_arp_lookup(entry->u.tnl_arp_cache.br_name, - entry->u.tnl_arp_cache.d_ip, &dmac); + d_ip = in6_addr_get_mapped_ipv4(&entry->u.tnl_arp_cache.d_ipv6); + if (d_ip) { + tnl_arp_lookup(entry->u.tnl_arp_cache.br_name, d_ip, &dmac); + } else { + tnl_nd_lookup(entry->u.tnl_arp_cache.br_name, + &entry->u.tnl_arp_cache.d_ipv6, &dmac); + } break; default: OVS_NOT_REACHED();