For example, consider the following OpenFlow rule:
- IPv6 -> IPv4 tunnel translation:
add-flow br-int 'in_port=vxlan_br-int_0, \
actions=set_field:8.8.8.7->tun_src, \
set_field:8.8.8.8->tun_dst,set_field:43->tun_id,geneve_br-int_1'
As any set_field action, flow wildcards are set to the
tun_src/dst. The offload layer fails if not all matches are
handled ("consumed"). Clear the irrelevant wildcards.
Signed-off-by: Reuven Plevinsky <[email protected]>
---
ofproto/ofproto-dpif-xlate.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 2c8197fb7307..7e986d0d4d0f 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -8078,6 +8078,19 @@ xlate_wc_init(struct xlate_ctx *ctx)
tnl_wc_init(&ctx->xin->flow, ctx->wc);
}
+static void
+clear_tunnel_wc(const struct flow_tnl *spec, struct flow_tnl *mask)
+{
+ if (!spec->ip_src || !spec->ip_dst) {
+ mask->ip_src = 0;
+ mask->ip_dst = 0;
+ }
+ if (ipv6_is_zero(&spec->ipv6_src) || ipv6_is_zero(&spec->ipv6_dst)) {
+ mask->ipv6_src = in6addr_any;
+ mask->ipv6_dst = in6addr_any;
+ }
+}
+
static void
xlate_wc_finish(struct xlate_ctx *ctx)
{
@@ -8152,6 +8165,9 @@ xlate_wc_finish(struct xlate_ctx *ctx)
if (!flow_tnl_dst_is_set(&ctx->xin->upcall_flow->tunnel)) {
memset(&ctx->wc->masks.tunnel, 0, sizeof ctx->wc->masks.tunnel);
}
+ /* Both IPv4/IPv6 tunnel wc may be set because of set_fields action.
+ * Clear the irrelevant one. */
+ clear_tunnel_wc(&ctx->xin->upcall_flow->tunnel, &ctx->wc->masks.tunnel);
}
/* This will tweak the odp actions generated. For now, it will:
--
2.47.0
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev