classifier-based ACL: refactor + add output ACL 02/10002/9
authorAndrew Yourtchenko <ayourtch@gmail.com>
Wed, 7 Feb 2018 10:37:02 +0000 (11:37 +0100)
committerJohn Lo <loj@cisco.com>
Wed, 7 Feb 2018 18:01:09 +0000 (18:01 +0000)
commit815d7d5637fbffd20bf81c74fd59dac8e4fe4d94
tree2e7fef7406a2df664b8d3e16d9336e6d59a255ab
parentdac03527f64216e132953a1a1d47b414e6841c68
classifier-based ACL: refactor + add output ACL

For implementation of MACIP ACLs enhancement (VPP-1088), an outbound
classifier-based ACL would be needed. There was an existing incomplete
code for outbound ACLs, it looked almost exact copy of input ACLs, minus
the various enhancements, trying to sync that code seemed error-prone
and cumbersome to maintain in the longer run.

This change refactors the input+output ACLs processing into a unified
routine (thus any changes will have effect on both), and also adds
the API to set the output interface ACL, with the same format
and semantics as the existing input one (except working on output
ACL of course).

WARNING: IP outbound ACL in L3 mode clobbers the ip.* fields
in the vnet_buffer_opaque_t, since the code is using l2_classify.*
The net_buffer (p0)->ip.save_rewrite_length is rescued into
l2_classify.pad.l2_len, and used to rewind the header in case of
drop, so that ipX_drop prints something sensible.

Change-Id: I62f814f1e3650e504474a3a5359edb8a0a8836ed
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
21 files changed:
src/plugins/acl/acl.c
src/vat/api_format.c
src/vnet.am
src/vnet/classify/classify.api
src/vnet/classify/classify_api.c
src/vnet/classify/in_out_acl.c [moved from src/vnet/classify/input_acl.c with 53% similarity]
src/vnet/classify/in_out_acl.h [moved from src/vnet/classify/input_acl.h with 55% similarity]
src/vnet/classify/vnet_classify.c
src/vnet/classify/vnet_classify.h
src/vnet/ip/ip4_error.h
src/vnet/ip/ip4_forward.c
src/vnet/ip/ip6_error.h
src/vnet/ip/ip6_forward.c
src/vnet/ip/ip_in_out_acl.c [moved from src/vnet/ip/ip_input_acl.c with 63% similarity]
src/vnet/ip/ip_init.c
src/vnet/l2/l2_in_out_acl.c [moved from src/vnet/l2/l2_input_acl.c with 68% similarity]
src/vnet/l2/l2_input.c
src/vnet/l2/l2_output_acl.c [deleted file]
src/vpp/api/custom_dump.c
test/test_classifier.py
test/vpp_papi_provider.py