Ensure sw_if_index to node mapping for L2 output path is only done via l2output_main... 88/5588/3
authorAndrew Yourtchenko <ayourtch@gmail.com>
Thu, 2 Mar 2017 12:23:15 +0000 (13:23 +0100)
committerAndrew Yourtchenko <ayourtch@gmail.com>
Thu, 2 Mar 2017 17:57:47 +0000 (18:57 +0100)
commite7dcee4027854b0ad076101471afdfff67eb9011
tree67aa0da50ff9f3ad322e1485f56fedfa5336f464
parent32dfd77df0240d26eebe7dd2058b36d66289bda8
Ensure sw_if_index to node mapping for L2 output path is only done via l2output_main.next_nodes

Before this commit, several output features that happen to be the
last in the list of features to be executed, send the packets directly
to <interfaceName>-output. To do this, they use l2_output_dispatch,
which builds a list of sw_if_index to next index mappings.

When interfaces are deleted and the new interfaces are created,
these mappings become stale, and cause the packets being sent to wrong
interface output nodes.

This patch (thanks John Lo for the brilliant idea!) adds a feature node "output",
whose sole purpose is dispatching the packets to the correct interface output
nodes. To do that, it uses the l2output_main.next_nodes, which is already
taken care of for the case of the sw_if_index reuse, so this makes the dependent
features all work correctly.

Since this changes the packet path, for the features that were always the last ones
it has triggered a side problem of the output feat_next_node_index not being properly
initalized. These two users are l2-output-classify node and the output nodes belonging
to the acl-plugin.

For the first one the less invasive fix is just to initialize that field.
For the acl-plugin nodes, rewrite the affected part of the code to use
feat_bitmap_get_next_node_index since this is essentially what the conditional
in l2_output_dispatch does, and fix the compiler warnings generated.

Change-Id: If44457b1c1c3e197b78470c08555720d0872c6e5
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
plugins/acl-plugin/acl/acl.c
plugins/acl-plugin/acl/acl.h
plugins/acl-plugin/acl/l2sess.c
plugins/acl-plugin/acl/l2sess.h
plugins/acl-plugin/acl/l2sess_node.c
plugins/acl-plugin/acl/node_in.c
plugins/acl-plugin/acl/node_out.c
vnet/vnet/l2/l2_input.c
vnet/vnet/l2/l2_output.h
vnet/vnet/l2/l2_output_classify.c