diff options
author | Jan Scheurich <jan.scheurich@ericsson.com> | 2018-04-05 16:11:03 +0200 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2018-04-06 09:27:35 -0700 |
commit | 88ec1e0aa31d4cb4a3eb5b0aad3d23834ffbd642 (patch) | |
tree | 15903ad705de54104e51c731277d295692628799 /ofproto | |
parent | 4b337e489b0e886197a526e01a5924b2791ad7bc (diff) | |
download | openvswitch-88ec1e0aa31d4cb4a3eb5b0aad3d23834ffbd642.tar.gz |
xlate: Correct handling of double encap() actions
When the same encap() header was pushed twice onto a packet (e.g in the
case of NSH in NSH), the translation logic only generated a datapath push
action for the first encap() action. The second encap() did not emit a
push action because the packet type was unchanged.
commit_encap_decap_action() (renamed from commit_packet_type_change) must
solely rely on ctx->pending_encap to generate an datapath push action.
Similarly, the first decap() action on a double header packet does not
change the packet_type either. Add a corresponding ctx->pending_decap
flag and use that to trigger emitting a datapath pop action.
Fixes: f839892a2 ("OF support and translation of generic encap and decap")
Fixes: 1fc11c594 ("Generic encap and decap support for NSH")
Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'ofproto')
-rw-r--r-- | ofproto/ofproto-dpif-xlate.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 42ac1186f..c8baba1b7 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -243,6 +243,8 @@ struct xlate_ctx { * true. */ bool pending_encap; /* True when waiting to commit a pending * encap action. */ + bool pending_decap; /* True when waiting to commit a pending + * decap action. */ struct ofpbuf *encap_data; /* May contain a pointer to an ofpbuf with * context for the datapath encap action.*/ @@ -3477,8 +3479,9 @@ xlate_commit_actions(struct xlate_ctx *ctx) ctx->xout->slow |= commit_odp_actions(&ctx->xin->flow, &ctx->base_flow, ctx->odp_actions, ctx->wc, use_masked, ctx->pending_encap, - ctx->encap_data); + ctx->pending_decap, ctx->encap_data); ctx->pending_encap = false; + ctx->pending_decap = false; ofpbuf_delete(ctx->encap_data); ctx->encap_data = NULL; } @@ -5989,6 +5992,7 @@ xlate_generic_decap_action(struct xlate_ctx *ctx, break; } ctx->wc->masks.nsh.np = UINT8_MAX; + ctx->pending_decap = true; /* Trigger recirculation. */ return true; default: @@ -6859,6 +6863,7 @@ xlate_actions(struct xlate_in *xin, struct xlate_out *xout) .in_action_set = false, .in_packet_out = xin->in_packet_out, .pending_encap = false, + .pending_decap = false, .encap_data = NULL, .table_id = 0, |