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