Commit 9cd7938f authored by Ben Pfaff's avatar Ben Pfaff

ofproto-dpif-xlate: Fix recirculation for resubmit to current table.

When recirculation defers actions for processing later, it decides
based on the actions being saved whether it needs to record the table
and cookie from which they originated.  Until now, it was thought that
this was only important for actions that send packets to the controller
(because those actions send the table ID and cookie).  This overlooked
a special case of the "resubmit" action which also depends on the
current table ID, which meant that this special case malfunctioned if
it came after recirculation.  This commit fixes the problem.

This is a backport of a fix orginally committed on master.  That fix
was able to add a test, but branch-2.4 lacks the "debug_recirc" feature
needed for the test.

Found while testing another feature under development.
Signed-off-by: default avatarBen Pfaff <blp@ovn.org>
Acked-by: default avatarJarno Rajahalme <jarno@ovn.org>
parent a7a43b43
/* Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc.
/* Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -4007,8 +4007,7 @@ recirc_put_unroll_xlate(struct xlate_ctx *ctx)
/* Copy remaining actions to the action_set to be executed after recirculation.
* UNROLL_XLATE action is inserted, if not already done so, before actions that
* may generate PACKET_INs from the current table and without matching another
* rule. */
* may depend on the current table ID or flow cookie. */
static void
recirc_unroll_actions(const struct ofpact *ofpacts, size_t ofpacts_len,
struct xlate_ctx *ctx)
......@@ -4017,17 +4016,25 @@ recirc_unroll_actions(const struct ofpact *ofpacts, size_t ofpacts_len,
OFPACT_FOR_EACH (a, ofpacts, ofpacts_len) {
switch (a->type) {
/* May generate PACKET INs. */
case OFPACT_OUTPUT_REG:
case OFPACT_GROUP:
case OFPACT_OUTPUT:
case OFPACT_CONTROLLER:
case OFPACT_DEC_MPLS_TTL:
case OFPACT_DEC_TTL:
/* These actions may generate asynchronous messages, which include
* table ID and flow cookie information. */
recirc_put_unroll_xlate(ctx);
break;
/* These may not generate PACKET INs. */
case OFPACT_RESUBMIT:
if (ofpact_get_RESUBMIT(a)->table_id == 0xff) {
/* This resubmit action is relative to the current table, so we
* need to track what table that is.*/
recirc_put_unroll_xlate(ctx);
}
break;
case OFPACT_SET_TUNNEL:
case OFPACT_REG_MOVE:
case OFPACT_SET_FIELD:
......@@ -4035,8 +4042,7 @@ recirc_unroll_actions(const struct ofpact *ofpacts, size_t ofpacts_len,
case OFPACT_STACK_POP:
case OFPACT_LEARN:
case OFPACT_WRITE_METADATA:
case OFPACT_RESUBMIT: /* May indirectly generate PACKET INs, */
case OFPACT_GOTO_TABLE: /* but from a different table and rule. */
case OFPACT_GOTO_TABLE:
case OFPACT_ENQUEUE:
case OFPACT_SET_VLAN_VID:
case OFPACT_SET_VLAN_PCP:
......@@ -4067,11 +4073,12 @@ recirc_unroll_actions(const struct ofpact *ofpacts, size_t ofpacts_len,
case OFPACT_WRITE_ACTIONS:
case OFPACT_METER:
case OFPACT_SAMPLE:
/* These may not generate PACKET INs. */
break;
/* These need not be copied for restoration. */
case OFPACT_NOTE:
case OFPACT_CONJUNCTION:
/* These need not be copied for restoration. */
continue;
}
/* Copy the action over. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment