Blame man/man8/tc-flower.8

Packit d3f73b
.TH "Flower filter in tc" 8 "22 Oct 2015" "iproute2" "Linux"
Packit d3f73b
Packit Service 9dfd34
	"Usage: ct clear\n"
Packit Service 9dfd34
		"	ct commit [force] [zone ZONE] [mark MASKED_MARK] [label MASKED_LABEL] [nat NAT_SPEC] [OFFLOAD_POLICY]\n"
Packit Service 9dfd34
		"	ct [nat] [zone ZONE] [OFFLOAD_POLICY]\n"
Packit Service 9dfd34
		"Where: ZONE is the conntrack zone table number\n"
Packit Service 9dfd34
		"	NAT_SPEC is {src|dst} addr addr1[-addr2] [port port1[-port2]]\n"
Packit Service 9dfd34
		"	OFFLOAD_POLICY is [policy_pkts PACKETS] [policy_timeout TIMEOUT]\n"
Packit d3f73b
.SH NAME
Packit d3f73b
flower \- flow based traffic control filter
Packit d3f73b
.SH SYNOPSIS
Packit d3f73b
.in +8
Packit d3f73b
.ti -8
Packit d3f73b
.BR tc " " filter " ... " flower " [ "
Packit d3f73b
.IR MATCH_LIST " ] [ "
Packit d3f73b
.B action
Packit d3f73b
.IR ACTION_SPEC " ] [ "
Packit d3f73b
.B classid
Packit d3f73b
.IR CLASSID " ] [ "
Packit d3f73b
.B hw_tc
Packit d3f73b
.IR TCID " ]"
Packit d3f73b
Packit d3f73b
Packit d3f73b
.ti -8
Packit d3f73b
.IR MATCH_LIST " := [ " MATCH_LIST " ] " MATCH
Packit d3f73b
Packit d3f73b
.ti -8
Packit d3f73b
.IR MATCH " := { "
Packit d3f73b
.B indev
Packit d3f73b
.IR ifname " | "
Packit d3f73b
.BR verbose
Packit d3f73b
.RI " | "
Packit d3f73b
.BR skip_sw " | " skip_hw
Packit d3f73b
.RI " | { "
Packit d3f73b
.BR dst_mac " | " src_mac " } "
Packit d3f73b
.IR MASKED_LLADDR " | "
Packit d3f73b
.B vlan_id
Packit d3f73b
.IR VID " | "
Packit d3f73b
.B vlan_prio
Packit d3f73b
.IR PRIORITY " | "
Packit d3f73b
.BR vlan_ethtype " { " ipv4 " | " ipv6 " | "
Packit d3f73b
.IR ETH_TYPE " } | "
Packit d3f73b
.B cvlan_id
Packit d3f73b
.IR VID " | "
Packit d3f73b
.B cvlan_prio
Packit d3f73b
.IR PRIORITY " | "
Packit d3f73b
.BR cvlan_ethtype " { " ipv4 " | " ipv6 " | "
Packit d3f73b
.IR ETH_TYPE " } | "
Packit d3f73b
.B mpls_label
Packit d3f73b
.IR LABEL " | "
Packit d3f73b
.B mpls_tc
Packit d3f73b
.IR TC " | "
Packit d3f73b
.B mpls_bos
Packit d3f73b
.IR BOS " | "
Packit d3f73b
.B mpls_ttl
Packit d3f73b
.IR TTL " | "
Packit d3f73b
.BR ip_proto " { " tcp " | " udp " | " sctp " | " icmp " | " icmpv6 " | "
Packit d3f73b
.IR IP_PROTO " } | "
Packit d3f73b
.B ip_tos
Packit d3f73b
.IR MASKED_IP_TOS " | "
Packit d3f73b
.B ip_ttl
Packit d3f73b
.IR MASKED_IP_TTL " | { "
Packit d3f73b
.BR dst_ip " | " src_ip " } "
Packit d3f73b
.IR PREFIX " | { "
Packit d3f73b
.BR dst_port " | " src_port " } { "
Packit d3f73b
.IR port_number " | "
Packit d3f73b
.IR min_port_number-max_port_number " } | "
Packit d3f73b
.B tcp_flags
Packit d3f73b
.IR MASKED_TCP_FLAGS " | "
Packit d3f73b
.B type
Packit d3f73b
.IR MASKED_TYPE " | "
Packit d3f73b
.B code
Packit d3f73b
.IR MASKED_CODE " | { "
Packit d3f73b
.BR arp_tip " | " arp_sip " } "
Packit d3f73b
.IR IPV4_PREFIX " | "
Packit d3f73b
.BR arp_op " { " request " | " reply " | "
Packit d3f73b
.IR OP " } | { "
Packit d3f73b
.BR arp_tha " | " arp_sha " } "
Packit d3f73b
.IR MASKED_LLADDR " | "
Packit d3f73b
.B enc_key_id
Packit d3f73b
.IR KEY-ID " | {"
Packit d3f73b
.BR enc_dst_ip " | " enc_src_ip " } { "
Packit d3f73b
.IR ipv4_address " | " ipv6_address " } | "
Packit d3f73b
.B enc_dst_port
Packit d3f73b
.IR port_number " | "
Packit d3f73b
.B enc_tos
Packit d3f73b
.IR TOS " | "
Packit d3f73b
.B enc_ttl
Packit d3f73b
.IR TTL " | "
Packit Service b6871c
{
Packit d3f73b
.B geneve_opts
Packit Service b6871c
|
Packit Service b6871c
.B vxlan_opts
Packit Service 90fbfb
|
Packit Service 90fbfb
.B erspan_opts
Packit Service b6871c
}
Packit d3f73b
.IR OPTIONS " | "
Packit d3f73b
.BR ip_flags
Packit d3f73b
.IR IP_FLAGS
Packit d3f73b
.SH DESCRIPTION
Packit d3f73b
The
Packit d3f73b
.B flower
Packit d3f73b
filter matches flows to the set of keys specified and assigns an arbitrarily
Packit d3f73b
chosen class ID to packets belonging to them. Additionally (or alternatively) an
Packit d3f73b
action from the generic action framework may be called.
Packit d3f73b
.SH OPTIONS
Packit d3f73b
.TP
Packit d3f73b
.BI action " ACTION_SPEC"
Packit d3f73b
Apply an action from the generic actions framework on matching packets.
Packit d3f73b
.TP
Packit d3f73b
.BI classid " CLASSID"
Packit d3f73b
Specify a class to pass matching packets on to.
Packit d3f73b
.I CLASSID
Packit d3f73b
is in the form
Packit d3f73b
.BR X : Y ", while " X " and " Y
Packit d3f73b
are interpreted as numbers in hexadecimal format.
Packit d3f73b
.TP
Packit d3f73b
.BI hw_tc " TCID"
Packit d3f73b
Specify a hardware traffic class to pass matching packets on to. TCID is in the
Packit d3f73b
range 0 through 15.
Packit d3f73b
.TP
Packit d3f73b
.BI indev " ifname"
Packit d3f73b
Match on incoming interface name. Obviously this makes sense only for forwarded
Packit d3f73b
flows.
Packit d3f73b
.I ifname
Packit d3f73b
is the name of an interface which must exist at the time of
Packit d3f73b
.B tc
Packit d3f73b
invocation.
Packit d3f73b
.TP
Packit d3f73b
.BI verbose
Packit d3f73b
Enable verbose logging, including offloading errors when not using
Packit d3f73b
.B skip_sw
Packit d3f73b
flag.
Packit d3f73b
.TP
Packit d3f73b
.BI skip_sw
Packit d3f73b
Do not process filter by software. If hardware has no offload support for this
Packit d3f73b
filter, or TC offload is not enabled for the interface, operation will fail.
Packit d3f73b
.TP
Packit d3f73b
.BI skip_hw
Packit d3f73b
Do not process filter by hardware.
Packit d3f73b
.TP
Packit d3f73b
.BI dst_mac " MASKED_LLADDR"
Packit d3f73b
.TQ
Packit d3f73b
.BI src_mac " MASKED_LLADDR"
Packit d3f73b
Match on source or destination MAC address.  A mask may be optionally
Packit d3f73b
provided to limit the bits of the address which are matched. A mask is
Packit d3f73b
provided by following the address with a slash and then the mask. It may be
Packit d3f73b
provided in LLADDR format, in which case it is a bitwise mask, or as a
Packit d3f73b
number of high bits to match. If the mask is missing then a match on all
Packit d3f73b
bits is assumed.
Packit d3f73b
.TP
Packit d3f73b
.BI vlan_id " VID"
Packit d3f73b
Match on vlan tag id.
Packit d3f73b
.I VID
Packit d3f73b
is an unsigned 12bit value in decimal format.
Packit d3f73b
.TP
Packit d3f73b
.BI vlan_prio " PRIORITY"
Packit d3f73b
Match on vlan tag priority.
Packit d3f73b
.I PRIORITY
Packit d3f73b
is an unsigned 3bit value in decimal format.
Packit d3f73b
.TP
Packit d3f73b
.BI vlan_ethtype " VLAN_ETH_TYPE"
Packit d3f73b
Match on layer three protocol.
Packit d3f73b
.I VLAN_ETH_TYPE
Packit d3f73b
may be either
Packit d3f73b
.BR ipv4 ", " ipv6
Packit d3f73b
or an unsigned 16bit value in hexadecimal format. To match on QinQ packet, it must be 802.1Q or 802.1AD.
Packit d3f73b
.TP
Packit d3f73b
.BI cvlan_id " VID"
Packit d3f73b
Match on QinQ inner vlan tag id.
Packit d3f73b
.I VID
Packit d3f73b
is an unsigned 12bit value in decimal format.
Packit d3f73b
.TP
Packit d3f73b
.BI cvlan_prio " PRIORITY"
Packit d3f73b
Match on QinQ inner vlan tag priority.
Packit d3f73b
.I PRIORITY
Packit d3f73b
is an unsigned 3bit value in decimal format.
Packit d3f73b
.TP
Packit d3f73b
.BI cvlan_ethtype " VLAN_ETH_TYPE"
Packit d3f73b
Match on QinQ layer three protocol.
Packit d3f73b
.I VLAN_ETH_TYPE
Packit d3f73b
may be either
Packit d3f73b
.BR ipv4 ", " ipv6
Packit d3f73b
or an unsigned 16bit value in hexadecimal format.
Packit d3f73b
.TP
Packit d3f73b
.BI mpls_label " LABEL"
Packit d3f73b
Match the label id in the outermost MPLS label stack entry.
Packit d3f73b
.I LABEL
Packit d3f73b
is an unsigned 20 bit value in decimal format.
Packit d3f73b
.TP
Packit d3f73b
.BI mpls_tc " TC"
Packit d3f73b
Match on the MPLS TC field, which is typically used for packet priority,
Packit d3f73b
in the outermost MPLS label stack entry.
Packit d3f73b
.I TC
Packit d3f73b
is an unsigned 3 bit value in decimal format.
Packit d3f73b
.TP
Packit d3f73b
.BI mpls_bos " BOS"
Packit d3f73b
Match on the MPLS Bottom Of Stack field in the outermost MPLS label stack
Packit d3f73b
entry.
Packit d3f73b
.I BOS
Packit d3f73b
is a 1 bit value in decimal format.
Packit d3f73b
.TP
Packit d3f73b
.BI mpls_ttl " TTL"
Packit d3f73b
Match on the MPLS Time To Live field in the outermost MPLS label stack
Packit d3f73b
entry.
Packit d3f73b
.I TTL
Packit d3f73b
is an unsigned 8 bit value in decimal format.
Packit d3f73b
.TP
Packit d3f73b
.BI ip_proto " IP_PROTO"
Packit d3f73b
Match on layer four protocol.
Packit d3f73b
.I IP_PROTO
Packit d3f73b
may be
Packit d3f73b
.BR tcp ", " udp ", " sctp ", " icmp ", " icmpv6
Packit d3f73b
or an unsigned 8bit value in hexadecimal format.
Packit d3f73b
.TP
Packit d3f73b
.BI ip_tos " MASKED_IP_TOS"
Packit d3f73b
Match on ipv4 TOS or ipv6 traffic-class - eight bits in hexadecimal format.
Packit d3f73b
A mask may be optionally provided to limit the bits which are matched. A mask
Packit d3f73b
is provided by following the value with a slash and then the mask. If the mask
Packit d3f73b
is missing then a match on all bits is assumed.
Packit d3f73b
.TP
Packit d3f73b
.BI ip_ttl " MASKED_IP_TTL"
Packit d3f73b
Match on ipv4 TTL or ipv6 hop-limit  - eight bits value in decimal or hexadecimal format.
Packit d3f73b
A mask may be optionally provided to limit the bits which are matched. Same
Packit d3f73b
logic is used for the mask as with matching on ip_tos.
Packit d3f73b
.TP
Packit d3f73b
.BI dst_ip " PREFIX"
Packit d3f73b
.TQ
Packit d3f73b
.BI src_ip " PREFIX"
Packit d3f73b
Match on source or destination IP address.
Packit d3f73b
.I PREFIX
Packit d3f73b
must be a valid IPv4 or IPv6 address, depending on the \fBprotocol\fR
Packit d3f73b
option to tc filter, optionally followed by a slash and the prefix length.
Packit d3f73b
If the prefix is missing, \fBtc\fR assumes a full-length host match.
Packit d3f73b
.TP
Packit d3f73b
.IR \fBdst_port " { "  NUMBER " | " " MIN_VALUE-MAX_VALUE "  }
Packit d3f73b
.TQ
Packit d3f73b
.IR \fBsrc_port " { "  NUMBER " | " " MIN_VALUE-MAX_VALUE "  }
Packit d3f73b
Match on layer 4 protocol source or destination port number. Alternatively, the
Packit d3f73b
mininum and maximum values can be specified to match on a range of layer 4
Packit d3f73b
protocol source or destination port numbers. Only available for
Packit d3f73b
.BR ip_proto " values " udp ", " tcp  " and " sctp
Packit d3f73b
which have to be specified in beforehand.
Packit d3f73b
.TP
Packit d3f73b
.BI tcp_flags " MASKED_TCP_FLAGS"
Packit d3f73b
Match on TCP flags represented as 12bit bitfield in in hexadecimal format.
Packit d3f73b
A mask may be optionally provided to limit the bits which are matched. A mask
Packit d3f73b
is provided by following the value with a slash and then the mask. If the mask
Packit d3f73b
is missing then a match on all bits is assumed.
Packit d3f73b
.TP
Packit d3f73b
.BI type " MASKED_TYPE"
Packit d3f73b
.TQ
Packit d3f73b
.BI code " MASKED_CODE"
Packit d3f73b
Match on ICMP type or code. A mask may be optionally provided to limit the
Packit d3f73b
bits of the address which are matched. A mask is provided by following the
Packit d3f73b
address with a slash and then the mask. The mask must be as a number which
Packit d3f73b
represents a bitwise mask If the mask is missing then a match on all bits
Packit d3f73b
is assumed.  Only available for
Packit d3f73b
.BR ip_proto " values " icmp  " and " icmpv6
Packit d3f73b
which have to be specified in beforehand.
Packit d3f73b
.TP
Packit d3f73b
.BI arp_tip " IPV4_PREFIX"
Packit d3f73b
.TQ
Packit d3f73b
.BI arp_sip " IPV4_PREFIX"
Packit d3f73b
Match on ARP or RARP sender or target IP address.
Packit d3f73b
.I IPV4_PREFIX
Packit d3f73b
must be a valid IPv4 address optionally followed by a slash and the prefix
Packit d3f73b
length. If the prefix is missing, \fBtc\fR assumes a full-length host
Packit d3f73b
match.
Packit d3f73b
.TP
Packit d3f73b
.BI arp_op " ARP_OP"
Packit d3f73b
Match on ARP or RARP operation.
Packit d3f73b
.I ARP_OP
Packit d3f73b
may be
Packit d3f73b
.BR request ", " reply
Packit d3f73b
or an integer value 0, 1 or 2.  A mask may be optionally provided to limit
Packit d3f73b
the bits of the operation which are matched. A mask is provided by
Packit d3f73b
following the address with a slash and then the mask. It may be provided as
Packit d3f73b
an unsigned 8 bit value representing a bitwise mask. If the mask is missing
Packit d3f73b
then a match on all bits is assumed.
Packit d3f73b
.TP
Packit d3f73b
.BI arp_sha " MASKED_LLADDR"
Packit d3f73b
.TQ
Packit d3f73b
.BI arp_tha " MASKED_LLADDR"
Packit d3f73b
Match on ARP or RARP sender or target MAC address.  A mask may be optionally
Packit d3f73b
provided to limit the bits of the address which are matched. A mask is
Packit d3f73b
provided by following the address with a slash and then the mask. It may be
Packit d3f73b
provided in LLADDR format, in which case it is a bitwise mask, or as a
Packit d3f73b
number of high bits to match. If the mask is missing then a match on all
Packit d3f73b
bits is assumed.
Packit d3f73b
.TP
Packit d3f73b
.BI enc_key_id " NUMBER"
Packit d3f73b
.TQ
Packit d3f73b
.BI enc_dst_ip " PREFIX"
Packit d3f73b
.TQ
Packit d3f73b
.BI enc_src_ip " PREFIX"
Packit d3f73b
.TQ
Packit d3f73b
.BI enc_dst_port " NUMBER"
Packit d3f73b
.TQ
Packit d3f73b
.BI enc_tos " NUMBER"
Packit d3f73b
.TQ
Packit d3f73b
.BI enc_ttl " NUMBER"
Packit d3f73b
.TQ
Packit Service 20c726
.BR
Packit Service 20c726
.TP
Packit Service 20c726
.BI ct_state " CT_STATE"
Packit Service 20c726
.TQ
Packit Service 20c726
.BI ct_zone " CT_MASKED_ZONE"
Packit Service 20c726
.TQ
Packit Service 20c726
.BI ct_mark " CT_MASKED_MARK"
Packit Service 20c726
.TQ
Packit Service 20c726
.BI ct_label " CT_MASKED_LABEL"
Packit Service 20c726
Matches on connection tracking info
Packit Service 20c726
.RS
Packit Service 20c726
.TP
Packit Service 20c726
.I CT_STATE
Packit Service 20c726
Match the connection state, and can ne combination of [{+|-}flag] flags, where flag can be one of
Packit Service 20c726
.RS
Packit Service 20c726
.TP
Packit Service 20c726
trk - Tracked connection.
Packit Service 20c726
.TP
Packit Service 20c726
new - New connection.
Packit Service 20c726
.TP
Packit Service 20c726
est - Established connection.
Packit Service 20c726
.TP
Packit Service 20c726
Example: +trk+est
Packit Service 20c726
.RE
Packit Service 20c726
.TP
Packit Service 20c726
.I CT_MASKED_ZONE
Packit Service 20c726
Match the connection zone, and can be masked.
Packit Service 20c726
.TP
Packit Service 20c726
.I CT_MASKED_MARK
Packit Service 20c726
32bit match on the connection mark, and can be masked.
Packit Service 20c726
.TP
Packit Service 20c726
.I CT_MASKED_LABEL
Packit Service 20c726
128bit match on the connection label, and can be masked.
Packit Service 20c726
.RE
Packit Service 20c726
.TP
Packit d3f73b
.BI geneve_opts " OPTIONS"
Packit Service b6871c
.TQ
Packit Service b6871c
.BI vxlan_opts " OPTIONS"
Packit Service 90fbfb
.TQ
Packit Service 90fbfb
.BI erspan_opts " OPTIONS"
Packit d3f73b
Match on IP tunnel metadata. Key id
Packit d3f73b
.I NUMBER
Packit d3f73b
is a 32 bit tunnel key id (e.g. VNI for VXLAN tunnel).
Packit d3f73b
.I PREFIX
Packit d3f73b
must be a valid IPv4 or IPv6 address optionally followed by a slash and the
Packit d3f73b
prefix length. If the prefix is missing, \fBtc\fR assumes a full-length
Packit d3f73b
host match.  Dst port
Packit d3f73b
.I NUMBER
Packit d3f73b
is a 16 bit UDP dst port. Tos
Packit d3f73b
.I NUMBER
Packit d3f73b
is an 8 bit tos (dscp+ecn) value, ttl
Packit d3f73b
.I NUMBER
Packit d3f73b
is an 8 bit time-to-live value. geneve_opts
Packit d3f73b
.I OPTIONS
Packit d3f73b
must be a valid list of comma-separated geneve options where each option
Packit d3f73b
consists of a key optionally followed by a slash and corresponding mask. If
Packit d3f73b
the masks is missing, \fBtc\fR assumes a full-length match. The options can
Packit d3f73b
be described in the form CLASS:TYPE:DATA/CLASS_MASK:TYPE_MASK:DATA_MASK,
Packit d3f73b
where CLASS is represented as a 16bit hexadecimal value, TYPE as an 8bit
Packit d3f73b
hexadecimal value and DATA as a variable length hexadecimal value.
Packit Service b6871c
vxlan_opts
Packit Service b6871c
.I OPTIONS
Packit Service b6871c
doesn't support multiple options, and it consists of a key followed by a slash
Packit Service b6871c
and corresponding mask. If the mask is missing, \fBtc\fR assumes a full-length
Packit Service b6871c
match. The option can be described in the form GBP/GBP_MASK, where GBP is
Packit Service b6871c
represented as a 32bit number.
Packit Service 90fbfb
erspan_opts
Packit Service 90fbfb
.I OPTIONS
Packit Service 90fbfb
doesn't support multiple options, and it consists of a key followed by a slash
Packit Service 90fbfb
and corresponding mask. If the mask is missing, \fBtc\fR assumes a full-length
Packit Service 90fbfb
match. The option can be described in the form
Packit Service 90fbfb
VERSION:INDEX:DIR:HWID/VERSION:INDEX_MASK:DIR_MASK:HWID_MASK, where VERSION is
Packit Service 90fbfb
represented as a 8bit number, INDEX as an 32bit number, DIR and HWID as a 8bit
Packit Service 90fbfb
number. Multiple options is not supported. Note INDEX/INDEX_MASK is used when
Packit Service 90fbfb
VERSION is 1, and DIR/DIR_MASK and HWID/HWID_MASK are used when VERSION is 2.
Packit d3f73b
.TP
Packit d3f73b
.BI ip_flags " IP_FLAGS"
Packit d3f73b
.I IP_FLAGS
Packit d3f73b
may be either
Packit d3f73b
.BR frag ", " nofrag ", " firstfrag " or " nofirstfrag
Packit d3f73b
where frag and nofrag could be used to match on fragmented packets or not,
Packit d3f73b
respectively. firstfrag and nofirstfrag can be used to further distinguish
Packit d3f73b
fragmented packet. firstfrag can be used to indicate the first fragmented
Packit d3f73b
packet. nofirstfrag can be used to indicates subsequent fragmented packets
Packit d3f73b
or non-fragmented packets.
Packit d3f73b
.SH NOTES
Packit d3f73b
As stated above where applicable, matches of a certain layer implicitly depend
Packit d3f73b
on the matches of the next lower layer. Precisely, layer one and two matches
Packit d3f73b
(\fBindev\fR,  \fBdst_mac\fR and \fBsrc_mac\fR)
Packit d3f73b
have no dependency,
Packit d3f73b
MPLS and layer three matches
Packit d3f73b
(\fBmpls_label\fR, \fBmpls_tc\fR, \fBmpls_bos\fR, \fBmpls_ttl\fR,
Packit d3f73b
\fBip_proto\fR, \fBdst_ip\fR, \fBsrc_ip\fR, \fBarp_tip\fR, \fBarp_sip\fR,
Packit d3f73b
\fBarp_op\fR, \fBarp_tha\fR, \fBarp_sha\fR and \fBip_flags\fR)
Packit d3f73b
depend on the
Packit d3f73b
.B protocol
Packit d3f73b
option of tc filter, layer four port matches
Packit d3f73b
(\fBdst_port\fR and \fBsrc_port\fR)
Packit d3f73b
depend on
Packit d3f73b
.B ip_proto
Packit d3f73b
being set to
Packit d3f73b
.BR tcp ", " udp " or " sctp,
Packit d3f73b
and finally ICMP matches (\fBcode\fR and \fBtype\fR) depend on
Packit d3f73b
.B ip_proto
Packit d3f73b
being set to
Packit d3f73b
.BR icmp " or " icmpv6.
Packit d3f73b
.P
Packit d3f73b
There can be only used one mask per one prio. If user needs to specify different
Packit d3f73b
mask, he has to use different prio.
Packit d3f73b
.SH SEE ALSO
Packit d3f73b
.BR tc (8),
Packit d3f73b
.BR tc-flow (8)