aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/classify
AgeCommit message (Collapse)AuthorFilesLines
2024-03-29misc: deprecate lawful-intercepthsandid1-6/+5
Type: refactor Change-Id: Ifd7f5b351401cdcaaaf57fefc5dbbfdaf235054e Signed-off-by: hsandid <halsandi@cisco.com>
2024-03-12misc: remove GNU Indent directivesDamjan Marion7-46/+0
Type: refactor Change-Id: I5235bf3e9aff58af6ba2c14e8c6529c4fc9ec86c Signed-off-by: Damjan Marion <damarion@cisco.com>
2023-12-14bpf_trace_filter: allow use whithout classifierMohammed Hawari1-0/+3
Change-Id: I7ac5693ca547fe7249e7b6297bade70a6052b169 Type: improvement Signed-off-by: Mohammed Hawari <mohammed@hawari.fr>
2023-07-25classify: add bpf support to pcap classifierMaxime Peim1-3/+3
Type: feature Change-Id: I28fb38e49c89f4c4d4cc58c1a5c0aa8502678472 Signed-off-by: Maxime Peim <mpeim@cisco.com>
2023-06-30bpf_trace_filter: plugin for BPF Trace FilteringMohammed Hawari1-0/+2
Change-Id: I342de0a375b783725aa2b621c1c70bc8bf646450 Signed-off-by: Mohammed Hawari <mohammed@hawari.fr> Type: improvement
2023-06-30vlib: introduce trace filter functionsMohammed Hawari1-1/+6
Change-Id: I7a988fafe98599e4fcf7cdaa307a69b9d76650f0 Signed-off-by: Mohammed Hawari <mohammed@hawari.fr> Type: improvement
2023-03-01docs: fixed to use unified "pcap trace" commandNobuhiro MIKI1-3/+3
Type: docs Fixes: 33909777c637 ("misc: unify pcap rx / tx / drop trace") Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp> Change-Id: I049616cfad300658e62e5026c0655ee6f07a2421
2023-01-25api: pcap capture api updateMaxime Peim1-3/+2
Allow enabling and disabling pcap capture via the API. A little bug is fixed along the way in vl_api_classify_pcap_set_table_t_handler. Type: improvement Signed-off-by: Maxime Peim <mpeim@cisco.com> Change-Id: I096129c82aecdc82bee5dbfb5e19c76a51d80aab
2022-12-07classify: increase metadata from 16- to 32-bitsBenoît Ganne2-9/+11
The metadata in classifier entries is used to index a fib or a dpo in the acl nodes which can exceeds UINT16_MAX in large configurations. To maintain entries size and alignment, decrease next_index from 32- to 16-bits: next_index should not exceed 16-bits in VPP, as it is already shown by vlib_buffer_enqueue_to_next() or dpo_id_t.dpoi_next_node. Type: fix Change-Id: I4fd1b3cd495319420044c219036b2d2ea952270a Signed-off-by: Benoît Ganne <bganne@cisco.com>
2022-11-04classify: fix crash when update nonexistent classify table.Huawei LI1-1/+3
vpp crash when update nonexistent classify table. Program received signal SIGABRT, Aborted. 0x00007fbf3b49b337 in raise () from /lib64/libc.so.6 (gdb) bt 0 0x00007fbf3b49b337 in raise () from /lib64/libc.so.6 1 0x00007fbf3b49ca28 in abort () from /lib64/libc.so.6 2 0x00000000004079db in os_panic () at /usr/src/debug/vpp-23.02/src/vpp/vnet/main.c:417 3 0x00007fbf3bb611c7 in debugger () at /usr/src/debug/vpp-23.02/src/vppinfra/error.c:84 4 0x00007fbf3bb61529 in _clib_error (how_to_die=2, function_name=0x0, line_number=0, fmt=0x7fbf3d03af08 "%s:%d (%s) assertion `%s' fails") at /usr/src/debug/vpp-23.02/src/vppinfra/error.c:143 5 0x00007fbf3c67062c in vnet_classify_add_del_table (cm=0x7fbf3d438f00 <vnet_classify_main>, mask=0x7fbf00fdc088 "", nbuckets=2, memory_size=2097152, skip=4, match=1, next_table_index=4294967295, miss_next_index=4294967295, table_index=0x7fbeed930b98, current_data_flag=0 '\000', current_data_offset=0, is_add=1, del_chain=0) at /usr/src/debug/vpp-23.02/src/vnet/classify/vnet_classify.c:780 6 0x00007fbf3c672bf4 in classify_table_command_fn (vm=0x7fbefb465740, input=0x7fbeed930ef0, cmd=0x7fbefc45ec18) at /usr/src/debug/vpp-23.02/src/vnet/classify/vnet_classify.c:1622 7 0x00007fbf3d52b527 in vlib_cli_dispatch_sub_commands (vm=0x7fbefb465740, cm=0x4273f0 <vlib_global_main+48>, input=0x7fbeed930ef0, parent_command_index=1064) at /usr/src/debug/vpp-23.02/src/vlib/cli.c:650 8 0x00007fbf3d52b2c3 in vlib_cli_dispatch_sub_commands (vm=0x7fbefb465740, cm=0x4273f0 <vlib_global_main+48>, input=0x7fbeed930ef0, parent_command_index=0) at /usr/src/debug/vpp-23.02/src/vlib/cli.c:607 9 0x00007fbf3d52b9cb in vlib_cli_input (vm=0x7fbefb465740, input=0x7fbeed930ef0, function=0x7fbf3d597406 <unix_vlib_cli_output>, function_arg=0) at /usr/src/debug/vpp-23.02/src/vlib/cli.c:753 10 0x00007fbf3d59cb0c in unix_cli_process_input (cm=0x7fbf3d61fe00 <unix_cli_main>, cli_file_index=0) at /usr/src/debug/vpp-23.02/src/vlib/unix/cli.c:2616 11 0x00007fbf3d59d25a in unix_cli_process (vm=0x7fbefb465740, rt=0x7fbf00f7bfc0, f=0x0) at /usr/src/debug/vpp-23.02/src/vlib/unix/cli.c:2745 12 0x00007fbf3d555a25 in vlib_process_bootstrap (_a=140458063833296) at /usr/src/debug/vpp-23.02/src/vlib/main.c:1221 13 0x00007fbf3bb74204 in clib_calljmp () at /usr/src/debug/vpp-23.02/src/vppinfra/longjmp.S:123 14 0x00007fbef10028a0 in ?? () 15 0x00007fbf3d555b4e in vlib_process_startup (vm=0x7fbf3bb7d70f <clib_mem_size+24>, p=0x7fbef10028d0, f=0x7fbf00f06ae0) at /usr/src/debug/vpp-23.02/src/vlib/main.c:1246 16 0x00007fbf3d592be6 in vec_max_bytes (v=0x8) at /usr/src/debug/vpp-23.02/src/vppinfra/vec_bootstrap.h:161 17 0x00007fbf00f06af8 in ?? () 18 0x0000000000000004 in ?? () 19 0x00000000000000ff in ?? () 20 0x00007fbef1002980 in ?? () 21 0x00007fbf3d592dcb in _vec_set_len (v=<error reading variable: Cannot access memory at address 0xfffffffffffffff5>, len=<error reading variable: Cannot access memory at address 0xffffffffffffffed>, elt_sz=<error reading variable: Cannot access memory at address 0xffffffffffffffe5>) at /usr/src/debug/vpp-23.02/src/vppinfra/vec_bootstrap.h:196 Backtrace stopped: previous frame inner to this frame (corrupt stack?) (gdb) f 5 0x00007fbf3c67062c in vnet_classify_add_del_table (cm=0x7fbf3d438f00 <vnet_classify_main>, mask=0x7fbf00fdc088 "", nbuckets=2, memory_size=2097152, skip=4, match=1, next_table_index=4294967295, miss_next_index=4294967295, table_index=0x7fbeed930b98, current_data_flag=0 '\000', current_data_offset=0, is_add=1, del_chain=0) at /usr/src/debug/vpp-23.02/src/vnet/classify/vnet_classify.c:780 780 t = pool_elt_at_index (cm->tables, *table_index); (gdb) p *table_index $1 = 8 (gdb) p cm->tables $2 = (vnet_classify_table_t *) 0x0 (gdb) Type: fix Signed-off-by: Huawei LI <lihuawei_zzu@163.com> Change-Id: I1c5f6168f0a7e1d1989ce07ec6c30c6fd9f0aaa9
2022-08-23classify: fix coverity 249223Andrew Yourtchenko1-1/+1
Day1 latent integer overflow. vnet_classify_add_del defines new_hash as u32 - so replace a u64 type with u32 in split_and_rehash as well. Type: fix Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com> Change-Id: I51384a2db1caa4099b4d2ac25cd185bd108da037
2022-06-29classify: use 32 bits hashBenoît Ganne4-20/+21
classify hash used to be stored as u64 in buffer metadata, use 32 bits instead: - on almost all our supported arch (x86 and arm64) we use crc32c intrinsics to compute the final hash: we really get a 32-bits hash - the hash itself is used to compute a 32-bits bucket index by masking upper bits: we always discard the higher 32-bits - this allows to increase the l2 classify buffer metadata padding such as it does not overlap with the ip fib_index metadata anymore. This overlap is an issue when using the 'set metadata' action in the ip ACL node which updates both fields Type: fix Change-Id: I5d35bdae97b96c3cae534e859b63950fb500ff50 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2022-06-10ip: improve ip ACL tracesBenoît Ganne2-2/+3
Type: improvement Change-Id: I85c73cb940d81d0b249eda0d57de135bcd798418 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2022-06-07classify: fix sesssion details apiNathan Skrzypczak1-1/+1
We were not allocating space for the variable length payload in the response message. Type: fix Change-Id: I345102f4555f66c5632ab0882ca1dd178e98eb7b Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2022-05-19api: refactor api data storageDamjan Marion1-3/+4
single struct to hold all api handler, flags, etc. Provide functions to toggle flags instead of writing directly to internal data. Type: refactor Change-Id: I4730d7290e57489de8eda34a72211527e015b721 Signed-off-by: Damjan Marion <damarion@cisco.com>
2022-04-04vppinfra: make _vec_len() read-onlyDamjan Marion1-3/+3
Use of _vec_len() to set vector length breaks address sanitizer. Users should use vec_set_len(), vec_inc_len(), vec_dec_len () instead. Type: improvement Change-Id: I441ae948771eb21c23a61f3ff9163bdad74a2cb8 Signed-off-by: Damjan Marion <damarion@cisco.com>
2022-03-23classify: fix typo in AVX-512 find entryBenoît Ganne1-1/+1
Type: fix Fixes: 26bc9f3c855496fb56f5fc648f75a299d4d539f8 Change-Id: Idab52bf856c03ded7b181608c3db1313aa2e33de Signed-off-by: Benoît Ganne <bganne@cisco.com>
2022-03-08classify: add API to retrieve punt ACL tablesBenoît Ganne2-0/+45
Type: feature Change-Id: Ica3e60836c0f26518ba2c238a8c03ce3648ea69b Signed-off-by: Benoît Ganne <bganne@cisco.com>
2022-03-04classify: skip l2 header in CLIArthur de Kerhor1-14/+50
Add the possibility to create masks and matches without l2 header in the CLI when creating tables and entries. This is useful for tables working on l3 and l4 only. Type: improvement Signed-off-by: Arthur de Kerhor <arthurdekerhor@gmail.com> Change-Id: I7da9e47d810c0b4a0938e2cb3bc31aa69ace3649
2021-11-02classify: fix build on systems without crc32f and vector unitDamjan Marion1-2/+6
Change-Id: I4229239ed6b81c10362faa1aa9f658c3fccfd31b Type: fix Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-10-06docs: vnet comment nitfixesNathan Skrzypczak1-5/+7
Type: improvement Change-Id: Iac01d7830b53819ace8f199554be10ab89ecdb97 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
2021-10-06ip: add classifier-based ACLs support on ip puntBenoît Ganne4-57/+117
This feature allows one to add classifier-based ACLs on packets punted from the ip infra, eg. to only whitelist specific sender(s). Type: feature Change-Id: Idab37b188583efbca980038875fc3e540cb2e880 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2021-09-29classify: fix message IDs on API repliesMatthew Smith1-33/+42
Type: fix When the API cleanup of classify messages was done, the code was not updated to add the message enums to REPLY_MSG_ID_BASE. So the wrong message IDs are being sent back in replies to classify API requests. Add REPLY_MSG_ID_BASE when populated vl_msg_id on a reply. Change-Id: Ic7c828f14d42a346fc58fc9ff062b954f494cdbd Signed-off-by: Matthew Smith <mgsmith@netgate.com>
2021-09-28misc: vpe.api messages dynamically allocatedOle Troan1-0/+9
This is the last in the series of moving API messages from vpp/api/vpe.api to vlibmemory/memclnt.api. This patch makes the remaining vpe.api messages dynamic, to help VAT2 binary-api command. Moves the VAT test code to a separate file and removes the now unnused API meta files. Type: improvement Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I01dd78eaff1d3715dff17d2643bf0f7f0089935b Signed-off-by: Ole Troan <ot@cisco.com>
2021-09-23classify: use AVX-512 to find entryDamjan Marion1-3/+41
Type: improvement Change-Id: I10f4084907ad714aded86e0b7a1a4d1c5fa1f140 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-09-23classify: use AVX-512 to calculate hash on x86Damjan Marion2-1/+29
Type:improvement Change-Id: I9f9f16eabf64203db11cd4338948d76ca5e0ef12 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-09-22classify: improve vnet_classify_hashDamjan Marion1-27/+23
Type: improvement Change-Id: I8b129b71f91b12ab2d8b05fe3891a7ab8926f072 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-09-22classify: simplify vnet_classify_find_entry_inlineDamjan Marion1-88/+72
Type: improvement Change-Id: I3de4450b95f6fa76705923d983cf93c21b02a635 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-09-20classify: improve find entry performanceDamjan Marion1-10/+9
Type: improvement Change-Id: I5245fc3f35b7a70833916db2ebf33f7c87398915 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-09-20classify: avoid dependent read of classify maskDamjan Marion2-9/+9
Type: improvement Change-Id: I176f08c74eb58a78f7fbdb48fd4592e6ddf74d34 Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-09-01classify: improve "show classify table" outputDave Barach1-5/+7
Print header for each table. Type: improvement Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I54ca04d6000a98afb4ad3d2f24caae3349548f23
2021-08-05classify: fix parsing for l4 matchBenoît Ganne1-1/+1
l4 match parsing should not try to consume the whole input, otherwise it breaks cli such as: 'classify session ... match l4 dst_port 22 action set-ip4-fib-id 2' Type: fix Change-Id: I81a1b5779811f7df8286a371f85fafe09c947b87 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2021-07-15misc: replace CLIB_PREFETCH with clib_prefetch_{load,store}Damjan Marion3-6/+6
Type: refactor Change-Id: Id10cbf52e8f2dd809080a228d8fa282308be84ac Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-07-14classify: cheaper way to check if all elements are zeroDamjan Marion1-1/+1
Type: improvement Change-Id: I5f4517c65c37c5d73fcd608dc29dfb1d25d4cd8d Signed-off-by: Damjan Marion <damarion@cisco.com>
2021-06-21classify: api cleanupFilip Tehlar1-68/+6
Use autogenerated code. Type: improvement Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: Id7d4d23e4fe707f7049828fec44df7ff0419d23c
2021-05-13tests: move test source to vpp/testDave Wallace2-1059/+0
- Generate copyright year and version instead of using hard-coded data Type: refactor Signed-off-by: Dave Wallace <dwallacelf@gmail.com> Change-Id: I6058f5025323b3aa483f5df4a2c4371e27b5914e
2021-04-22misc: add filter for specific error for pcap traceBenoît Ganne1-0/+4
Type: feature Change-Id: I325257454df1cc22833fa6a1dedd4739d4d5a558 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2021-04-17classify: honor pcap interface filter also when classify filter is usedBenoît Ganne1-0/+59
Type: fix Change-Id: Ic32550ee9c5d76d232d8b67a7810611f6c8b9177 Signed-off-by: Benoît Ganne <bganne@cisco.com>
2021-03-02classify: fix multiple filters supportBenoît Ganne1-11/+22
This fix the classify filter if we attach several different filters. This also fix some issues with l3 and l4 parsing. Type: fix Change-Id: I9dc6c55049a3bbc0110d1097b40d9da27633626b Signed-off-by: Benoît Ganne <bganne@cisco.com>
2021-02-15misc: coverity fixesDave Barach1-5/+3
Type: fix Signed-off-by: Dave Barach <dave@barachs.net> Change-Id: I6a3348c7edd1cce6b407d336443103f77392bc5d
2021-01-20classify: Layout classify entry to group data-plane accessed fields onNeale Ranns3-102/+124
one cache line Type: refactor Signed-off-by: Neale Ranns <neale.ranns@cisco.com> Change-Id: I54128ba62f8dcc87c1845b33ed3637112d42a891
2021-01-19classify: crash on classify filter pcap del commandSteven Luong1-1/+2
If classify pcap filter was never configured, typing the delete command causes a crash. The reason is cm->classify_table_index_by_sw_if_index not yet allocated. The fix is to add a check before we access the vector. Type: fix Fixes: gerrit 28475 Signed-off-by: Steven Luong <sluong@cisco.com> Change-Id: Ia33bd91fa82d8ffc4490d4069155980a6e233268
2020-12-15classify: add pcap/trace classfier mgmt API callsJon Loeliger4-188/+709
Add lookup/get/set API calls to manage both PCAP and Trace filtering Classifier tables. The "lookup" call may be used to identify a Classifier table within a chain of tables taht matches a particular mask vector. For efficiency, this call should be used to determine to which table a match vector should be added. The "get" calls return the first table within a chain (either a PCAP or the Trace) set of tables. The "set" call may be used to add a new table to one such chain. If the "sort_masks" flag is set, the tables within the chain are ordered such that the most-specific mask is first, and the least-specific mask is last. A call that "sets" a chain to ~0 will delete and free all the tables with a chain. The PCAP filters are per-interface, with "local0", (that is, sw_if_index == 0) holding the system-wide PCAP filter. The Classifier used a reference-counted "set" for each PCAP or trace filter that it stored. The ref counts were not used, and the vector of tables was only used temporarily to establish a sorted order for tables based on masks. None of that complexity was actually warranted, and where it was used, the same could be achieved more simply. Type: refactor Signed-off-by: Jon Loeliger <jdl@netgate.com> Change-Id: Icc56116cca91b91c631ca0628e814fb53f3677d2
2020-12-14misc: move to new pool_foreach macrosDamjan Marion2-12/+12
Type: refactor Change-Id: Ie67dc579e88132ddb1ee4a34cb69f96920101772 Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-11-17tests: move classifier tests to src/vnet/classify/testDave Wallace2-0/+1059
- Refactor make test code to be co-located with the vpp feature source code. Type: test Signed-off-by: Dave Wallace <dwallacelf@gmail.com> Change-Id: Ibae85a18df0d5a53e2a59c678a2a27499f54ce6d
2020-11-10classify: fix classify filter trace del cli processingJon Loeliger1-35/+49
When a 'del' is used to delete a classify table, only the mask is needed to locate the table. Any match vector is unneeded. The tests failed to notice this, but if the test is run by hand in vppctl, it issues a parse error. Fix the test so that it doesn't supply irrelevant data. Fix the CLI processing to read always complete newline terminated line of input instead. This allows unneeded CLI parameters to be ignored. It also necessitated fixing a trace test which had then erroneously split a single CLI command over multiple lines. While in the area, fix a latent bug on table matching where a test for compatible mask vector sizes were not matching impedance properly (byte vs ux32x4). Type: fix Signed-off-by: Jon Loeliger <jdl@netgate.com> Change-Id: I1177ab1dd417f3d11f30eecbaa2b0fb1015c3ab5
2020-10-28misc: Break the big IP header files to improve compile timeNeale Ranns1-0/+2
Type: refactor Signed-off-by: Neale Ranns <neale.ranns@cisco.com> Change-Id: Id1801519638a9b97175847d7ed58824fb83433d6
2020-10-01classify: Fix a couple bugs in 'pcap filter' command.Jon Loeliger1-12/+12
- Assert a valid set prior to first use. - Sort tables by mask prior to selecting first table - Use actual table indices and not loop index when linking tables Type: fix Change-Id: I9c61c8b7fe97c38faed8f2fc1792d7232799f580 Signed-off-by: Jon Loeliger <jdl@netgate.com>
2020-09-28vppinfra: don't call dlmalloc API directly from the codeDamjan Marion2-7/+7
- it is confusing from end consumer perspective that some thing is somewhere called heap and somewhere mspace - this is base for additional work where heap pointer is not the same thing like mspace Type: improvement Change-Id: I644d5a0de17690d65d164d8cec3c5654571629ef Signed-off-by: Damjan Marion <damarion@cisco.com>
2020-09-28classify: use clib_crc32c on supporting uarchRay Kinsella1-0/+5
Use clib_crc32c in place of clib_xxhash on supporting uarch. Type: improvement Signed-off-by: Ray Kinsella <mdr@ashroe.eu> Change-Id: Icdfb4ffa92c2c9e7aebc3ec99f20e91392a103ab