diff mbox

[ovs-dev,06/15] ofproto-dpif-xlate: use IPv6 for orig_tunnel_ip_dst

Message ID 1445534948-10538-7-git-send-email-cascardo@redhat.com
State Changes Requested
Headers show

Commit Message

Thadeu Lima de Souza Cascardo Oct. 22, 2015, 5:28 p.m. UTC
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 <cascardo@redhat.com>
---
 ofproto/ofproto-dpif-xlate.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Ben Pfaff Nov. 10, 2015, 10:29 p.m. UTC | #1
On Thu, Oct 22, 2015 at 03:28:59PM -0200, Thadeu Lima de Souza Cascardo wrote:
> 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 <cascardo@redhat.com>

Acked-by: Ben Pfaff <blp@ovn.org>
diff mbox

Patch

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index a4007e3..e9b95a6 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 */
         }
@@ -4895,7 +4897,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,
@@ -4925,6 +4926,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: