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