[ovs-dev] [PATCH 11/15] ofproto-dpif-xlate: Add IPv6 ND support for XC_TNL_ARP
Thadeu Lima de Souza Cascardo
cascardo at redhat.com
Thu Oct 22 17:29:04 UTC 2015
Use IPv4-mapped addresses and use either tnl_arp_lookup or tnl_nd_lookup.
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo at redhat.com>
---
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();
--
2.4.3
More information about the dev
mailing list