1Flower filter in tc(8) Linux Flower filter in tc(8)
2
3
4
6 flower - flow based traffic control filter
7
9 tc filter ... flower [ MATCH_LIST ] [ action ACTION_SPEC ] [ classid
10 CLASSID ] [ hw_tc TCID ]
11
12
13 MATCH_LIST := [ MATCH_LIST ] MATCH
14
15 MATCH := { indev ifname | verbose | skip_sw | skip_hw | { dst_mac |
16 src_mac } MASKED_LLADDR | vlan_id VID | vlan_prio PRIORITY |
17 vlan_ethtype { ipv4 | ipv6 | ETH_TYPE } | mpls_label LABEL |
18 mpls_tc TC | mpls_bos BOS | mpls_ttl TTL | ip_proto { tcp | udp
19 | sctp | icmp | icmpv6 | IP_PROTO } | ip_tos MASKED_IP_TOS |
20 ip_ttl MASKED_IP_TTL | { dst_ip | src_ip } PREFIX | { dst_port
21 | src_port } port_number } | tcp_flags MASKED_TCP_FLAGS | type
22 MASKED_TYPE | code MASKED_CODE | { arp_tip | arp_sip }
23 IPV4_PREFIX | arp_op { request | reply | OP } | { arp_tha |
24 arp_sha } MASKED_LLADDR | enc_key_id KEY-ID | { enc_dst_ip |
25 enc_src_ip } { ipv4_address | ipv6_address } | enc_dst_port
26 port_number | enc_tos TOS | enc_ttl TTL | geneve_opts OPTIONS |
27 ip_flags IP_FLAGS
28
30 The flower filter matches flows to the set of keys specified and
31 assigns an arbitrarily chosen class ID to packets belonging to them.
32 Additionally (or alternatively) an action from the generic action
33 framework may be called.
34
36 action ACTION_SPEC
37 Apply an action from the generic actions framework on matching
38 packets.
39
40 classid CLASSID
41 Specify a class to pass matching packets on to. CLASSID is in
42 the form X:Y, while X and Y are interpreted as numbers in hexa‐
43 decimal format.
44
45 hw_tc TCID
46 Specify a hardware traffic class to pass matching packets on to.
47 TCID is in the range 0 through 15.
48
49 indev ifname
50 Match on incoming interface name. Obviously this makes sense
51 only for forwarded flows. ifname is the name of an interface
52 which must exist at the time of tc invocation.
53
54 verbose
55 Enable verbose logging, including offloading errors when not
56 using skip_sw flag.
57
58 skip_sw
59 Do not process filter by software. If hardware has no offload
60 support for this filter, or TC offload is not enabled for the
61 interface, operation will fail.
62
63 skip_hw
64 Do not process filter by hardware.
65
66 dst_mac MASKED_LLADDR
67 src_mac MASKED_LLADDR
68 Match on source or destination MAC address. A mask may be
69 optionally provided to limit the bits of the address which are
70 matched. A mask is provided by following the address with a
71 slash and then the mask. It may be provided in LLADDR format, in
72 which case it is a bitwise mask, or as a number of high bits to
73 match. If the mask is missing then a match on all bits is
74 assumed.
75
76 vlan_id VID
77 Match on vlan tag id. VID is an unsigned 12bit value in decimal
78 format.
79
80 vlan_prio PRIORITY
81 Match on vlan tag priority. PRIORITY is an unsigned 3bit value
82 in decimal format.
83
84 vlan_ethtype VLAN_ETH_TYPE
85 Match on layer three protocol. VLAN_ETH_TYPE may be either
86 ipv4, ipv6 or an unsigned 16bit value in hexadecimal format.
87
88 mpls_label LABEL
89 Match the label id in the outermost MPLS label stack entry.
90 LABEL is an unsigned 20 bit value in decimal format.
91
92 mpls_tc TC
93 Match on the MPLS TC field, which is typically used for packet
94 priority, in the outermost MPLS label stack entry. TC is an
95 unsigned 3 bit value in decimal format.
96
97 mpls_bos BOS
98 Match on the MPLS Bottom Of Stack field in the outermost MPLS
99 label stack entry. BOS is a 1 bit value in decimal format.
100
101 mpls_ttl TTL
102 Match on the MPLS Time To Live field in the outermost MPLS label
103 stack entry. TTL is an unsigned 8 bit value in decimal format.
104
105 ip_proto IP_PROTO
106 Match on layer four protocol. IP_PROTO may be tcp, udp, sctp,
107 icmp, icmpv6 or an unsigned 8bit value in hexadecimal format.
108
109 ip_tos MASKED_IP_TOS
110 Match on ipv4 TOS or ipv6 traffic-class - eight bits in hexadec‐
111 imal format. A mask may be optionally provided to limit the
112 bits which are matched. A mask is provided by following the
113 value with a slash and then the mask. If the mask is missing
114 then a match on all bits is assumed.
115
116 ip_ttl MASKED_IP_TTL
117 Match on ipv4 TTL or ipv6 hop-limit - eight bits value in deci‐
118 mal or hexadecimal format. A mask may be optionally provided to
119 limit the bits which are matched. Same logic is used for the
120 mask as with matching on ip_tos.
121
122 dst_ip PREFIX
123 src_ip PREFIX
124 Match on source or destination IP address. PREFIX must be a
125 valid IPv4 or IPv6 address, depending on the protocol option to
126 tc filter, optionally followed by a slash and the prefix length.
127 If the prefix is missing, tc assumes a full-length host match.
128
129 dst_port NUMBER
130 src_port NUMBER
131 Match on layer 4 protocol source or destination port number.
132 Only available for ip_proto values udp, tcp and sctp which have
133 to be specified in beforehand.
134
135 tcp_flags MASKED_TCP_FLAGS
136 Match on TCP flags represented as 12bit bitfield in in hexadeci‐
137 mal format. A mask may be optionally provided to limit the bits
138 which are matched. A mask is provided by following the value
139 with a slash and then the mask. If the mask is missing then a
140 match on all bits is assumed.
141
142 type MASKED_TYPE
143 code MASKED_CODE
144 Match on ICMP type or code. A mask may be optionally provided to
145 limit the bits of the address which are matched. A mask is pro‐
146 vided by following the address with a slash and then the mask.
147 The mask must be as a number which represents a bitwise mask If
148 the mask is missing then a match on all bits is assumed. Only
149 available for ip_proto values icmp and icmpv6 which have to be
150 specified in beforehand.
151
152 arp_tip IPV4_PREFIX
153 arp_sip IPV4_PREFIX
154 Match on ARP or RARP sender or target IP address. IPV4_PREFIX
155 must be a valid IPv4 address optionally followed by a slash and
156 the prefix length. If the prefix is missing, tc assumes a full-
157 length host match.
158
159 arp_op ARP_OP
160 Match on ARP or RARP operation. ARP_OP may be request, reply or
161 an integer value 0, 1 or 2. A mask may be optionally provided
162 to limit the bits of the operation which are matched. A mask is
163 provided by following the address with a slash and then the
164 mask. It may be provided as an unsigned 8 bit value representing
165 a bitwise mask. If the mask is missing then a match on all bits
166 is assumed.
167
168 arp_sha MASKED_LLADDR
169 arp_tha MASKED_LLADDR
170 Match on ARP or RARP sender or target MAC address. A mask may
171 be optionally provided to limit the bits of the address which
172 are matched. A mask is provided by following the address with a
173 slash and then the mask. It may be provided in LLADDR format, in
174 which case it is a bitwise mask, or as a number of high bits to
175 match. If the mask is missing then a match on all bits is
176 assumed.
177
178 enc_key_id NUMBER
179 enc_dst_ip PREFIX
180 enc_src_ip PREFIX
181 enc_dst_port NUMBER
182 enc_tos NUMBER
183 enc_ttl NUMBER
184 geneve_opts OPTIONS
185 Match on IP tunnel metadata. Key id NUMBER is a 32 bit tunnel
186 key id (e.g. VNI for VXLAN tunnel). PREFIX must be a valid IPv4
187 or IPv6 address optionally followed by a slash and the prefix
188 length. If the prefix is missing, tc assumes a full-length host
189 match. Dst port NUMBER is a 16 bit UDP dst port. Tos NUMBER is
190 an 8 bit tos (dscp+ecn) value, ttl NUMBER is an 8 bit time-to-
191 live value. geneve_opts OPTIONS must be a valid list of comma-
192 separated geneve options where each option consists of a key
193 optionally followed by a slash and corresponding mask. If the
194 masks is missing, tc assumes a full-length match. The options
195 can be described in the form
196 CLASS:TYPE:DATA/CLASS_MASK:TYPE_MASK:DATA_MASK, where CLASS is
197 represented as a 16bit hexadecimal value, TYPE as an 8bit hexa‐
198 decimal value and DATA as a variable length hexadecimal value.
199
200 ip_flags IP_FLAGS
201 IP_FLAGS may be either frag, nofrag, firstfrag or nofirstfrag
202 where frag and nofrag could be used to match on fragmented pack‐
203 ets or not, respectively. firstfrag and nofirstfrag can be used
204 to further distinguish fragmented packet. firstfrag can be used
205 to indicate the first fragmented packet. nofirstfrag can be used
206 to indicates subsequent fragmented packets or non-fragmented
207 packets.
208
210 As stated above where applicable, matches of a certain layer implicitly
211 depend on the matches of the next lower layer. Precisely, layer one and
212 two matches (indev, dst_mac and src_mac) have no dependency, MPLS and
213 layer three matches (mpls_label, mpls_tc, mpls_bos, mpls_ttl, ip_proto,
214 dst_ip, src_ip, arp_tip, arp_sip, arp_op, arp_tha, arp_sha and
215 ip_flags) depend on the protocol option of tc filter, layer four port
216 matches (dst_port and src_port) depend on ip_proto being set to tcp,
217 udp or sctp, and finally ICMP matches (code and type) depend on
218 ip_proto being set to icmp or icmpv6.
219
220 There can be only used one mask per one prio. If user needs to specify
221 different mask, he has to use different prio.
222
224 tc(8), tc-flow(8)
225
226
227
228iproute2 22 Oct 2015 Flower filter in tc(8)