FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
src/vnet/classify

classify filter

Summary/usage

classify filter <intfc> | pcap mask <mask-value> match <match-value>

| trace mask <mask-value> match <match-value> [del] [buckets <nn>] [memory-size <n>].

Description

Construct an arbitrary set of packet classifier tables for use with &#34;pcap rx | tx trace,&#34; and with the vpp packet tracer

Packets which match a rule in the classifier table chain will be traced. The tables are automatically ordered so that matches in the most specific table are tried first.

It&#39;s reasonably likely that folks will configure a single table with one or two matches. As a result, we configure 8 hash buckets and 128K of match rule space. One can override the defaults by specifiying &#34;buckets <nnn>&#34; and &#34;memory-size <xxx>&#34; as desired.

To build up complex filter chains, repeatedly issue the classify filter debug CLI command. Each command must specify the desired mask and match values. If a classifier table with a suitable mask already exists, the CLI command adds a match rule to the existing table. If not, the CLI command add a new table and the indicated mask rule

Here is a terse description of the &#34;mask <xxx>&#34; syntax:

l2 src dst proto tag1 tag2 ignore-tag1 ignore-tag2 cos1 cos2 dot1q dot1ad

l3 ip4 <ip4-mask> ip6 <ip6-mask>

<ip4-mask> version hdr_length src[/width] dst[/width] tos length fragment_id ttl protocol checksum

<ip6-mask> version traffic-class flow-label src dst proto payload_length hop_limit protocol

l4 tcp <tcp-mask> udp <udp_mask> src_port dst_port

<tcp-mask> src dst # ports

<udp-mask> src_port dst_port

To construct matches, add the values to match after the indicated keywords: in the match syntax. For example: mask l3 ip4 src -> match l3 ip4 src 192.168.1.11

Example usage
Configuring the classify filter

Configure a simple classify filter, and configure pcap rx trace to use it:

<b><em>classify filter rx mask l3 ip4 src match l3 ip4 src 192.168.1.11&#34;</em></b><br> <b><em>pcap rx trace on max 100 filter</em></b>

Configure another fairly simple filter

<b><em>classify filter mask l3 ip4 src dst match l3 ip4 src 192.168.1.10 dst 192.168.2.10&#34;</em></b>

Configure a filter for use with the vpp packet tracer: <b><em>classify filter trace mask l3 ip4 src dst match l3 ip4 src 192.168.1.10 dst 192.168.2.10&#34;</em></b> <b><em>trace add dpdk-input 100 filter</em></b>

Clear classifier filters

<b><em>classify filter [trace | rx | tx | <intfc>] del</em></b>

To display the top-level classifier tables for each use case: <b><em>show classify filter</em/></b>

To inspect the classifier tables, use

<b><em>show classify table [verbose]</em></b> The verbose form displays all of the match rules, with hit-counters

Declaration and implementation

Declaration: classify_filter (src/vnet/classify/vnet_classify.c line 2107)

Implementation: classify_filter_command_fn.

classify session

Summary/usage

classify session [hit-next|l2-input-hit-next|l2-output-hit-next|acl-hit-next &lt;next_index&gt;|policer-hit-next &lt;policer_name&gt;]

table-index <nn> match [hex] [l2] [l3 ip4] [opaque-index <index>] [action set-ip4-fib-id|set-ip6-fib-id|set-sr-policy-index <n>] [del].

Declaration and implementation

Declaration: classify_session_command (src/vnet/classify/vnet_classify.c line 2894)

Implementation: classify_session_command_fn.

classify table

Summary/usage

classify table [miss-next|l2-miss_next|acl-miss-next &lt;next_index&gt;]

mask <mask-value> buckets <nn> [skip <n>] [match <n>] [current-data-flag <n>] [current-data-offset <n>] [table <n>] [memory-size <nn>[M][G]] [next-table <n>] [del] [del-chain].

Declaration and implementation

Declaration: classify_table (src/vnet/classify/vnet_classify.c line 1621)

Implementation: classify_table_command_fn.

set interface input acl

Summary/usage

set interface input acl intfc &lt;int&gt; [ip4-table &lt;index&gt;]

[ip6-table <index>] [l2-table <index>] [del].

Declaration and implementation

Declaration: set_input_acl_command (src/vnet/classify/in_out_acl.c line 234)

Implementation: set_input_acl_command_fn.

set interface output acl

Summary/usage

set interface output acl intfc &lt;int&gt; [ip4-table &lt;index&gt;]

[ip6-table <index>] [l2-table <index>] [del].

Declaration and implementation

Declaration: set_output_acl_command (src/vnet/classify/in_out_acl.c line 241)

Implementation: set_output_acl_command_fn.

set policer classify

Summary/usage

set policer classify interface &lt;int&gt; [ip4-table &lt;index&gt;]

[ip6-table <index>] [l2-table <index>] [del].

Declaration and implementation

Declaration: set_policer_classify_command (src/vnet/classify/policer_classify.c line 168)

Implementation: set_policer_classify_command_fn.

show classify filter

Summary/usage

show classify filter [verbose [nn]].

Declaration and implementation

Declaration: show_classify_filter (src/vnet/classify/vnet_classify.c line 2197)

Implementation: show_classify_filter_command_fn.

show classify flow

Summary/usage

show classify flow type [ip4|ip6].

Declaration and implementation

Declaration: show_flow_classify_command (src/vnet/classify/flow_classify.c line 219)

Implementation: show_flow_classify_command_fn.

show classify policer

Summary/usage

show classify policer type [ip4|ip6|l2].

Declaration and implementation

Declaration: show_policer_classify_command (src/vnet/classify/policer_classify.c line 235)

Implementation: show_policer_classify_command_fn.

show classify tables

Summary/usage

show classify tables [index &lt;nn&gt;].

Declaration and implementation

Declaration: show_classify_table_command (src/vnet/classify/vnet_classify.c line 2293)

Implementation: show_classify_tables_command_fn.

show inacl

Summary/usage

show inacl type [ip4|ip6|l2].

Declaration and implementation

Declaration: show_inacl_command (src/vnet/classify/in_out_acl.c line 370)

Implementation: show_inacl_command_fn.

show outacl

Summary/usage

show outacl type [ip4|ip6|l2].

Declaration and implementation

Declaration: show_outacl_command (src/vnet/classify/in_out_acl.c line 375)

Implementation: show_outacl_command_fn.

test classify

Summary/usage

test classify [src &lt;ip&gt;] [sessions &lt;nn&gt;] [buckets &lt;nn&gt;] [seed &lt;nnn&gt;]
          [memory-size &lt;nn&gt;[M|G]]
          [churn-test].

Declaration and implementation

Declaration: test_classify_command (src/vnet/classify/vnet_classify.c line 3317)

Implementation: test_classify_command_fn.