Blame man/man8/tc-ife.8

Packit d3f73b
.TH "IFE action in tc" 8 "22 Apr 2016" "iproute2" "Linux"
Packit d3f73b
Packit d3f73b
.SH NAME
Packit d3f73b
IFE - encapsulate/decapsulate metadata
Packit d3f73b
.SH SYNOPSIS
Packit d3f73b
.in +8
Packit d3f73b
.ti -8
Packit d3f73b
.BR tc " ... " " action ife"
Packit d3f73b
.IR DIRECTION " [ " ACTION " ] "
Packit d3f73b
.RB "[ " dst
Packit d3f73b
.IR DMAC " ] "
Packit d3f73b
.RB "[ " src
Packit d3f73b
.IR SMAC " ] "
Packit d3f73b
.RB "[ " type
Packit d3f73b
.IR TYPE " ] "
Packit d3f73b
.RI "[ "
Packit d3f73b
.IR CONTROL " ] "
Packit d3f73b
.RB "[ " index
Packit d3f73b
.IR INDEX " ] "
Packit d3f73b
Packit d3f73b
.ti -8
Packit d3f73b
.IR DIRECTION " := { "
Packit d3f73b
.BR decode " | " encode " }"
Packit d3f73b
Packit d3f73b
.ti -8
Packit d3f73b
.IR ACTION " := { "
Packit d3f73b
.BI allow " ATTR"
Packit d3f73b
.RB "| " use
Packit d3f73b
.IR "ATTR value" " }"
Packit d3f73b
Packit d3f73b
.ti -8
Packit d3f73b
.IR ATTR " := { "
Packit d3f73b
.BR mark " | " prio " | " tcindex " }"
Packit d3f73b
Packit d3f73b
.ti -8
Packit d3f73b
.IR CONTROL " := { "
Packit d3f73b
.BR reclassify " | " use " | " pipe " | " drop " | " continue " | " ok " | " goto " " chain " " CHAIN_INDEX " }"
Packit d3f73b
.SH DESCRIPTION
Packit d3f73b
The
Packit d3f73b
.B ife
Packit d3f73b
action allows for a sending side to encapsulate arbitrary metadata, which is
Packit d3f73b
then decapsulated by the receiving end. The sender runs in encoding mode and
Packit d3f73b
the receiver in decode mode. Both sender and receiver must specify the same
Packit d3f73b
ethertype. In the future, a registered ethertype may be available as a default.
Packit d3f73b
.SH OPTIONS
Packit d3f73b
.TP
Packit d3f73b
.B decode
Packit d3f73b
For the receiving side; decode the metadata if the packet matches.
Packit d3f73b
.TP
Packit d3f73b
.B encode
Packit d3f73b
For the sending side. Encode the specified metadata if the packet matches.
Packit d3f73b
.TP
Packit d3f73b
.B allow
Packit d3f73b
Encode direction only. Allows encoding specified metadata.
Packit d3f73b
.TP
Packit d3f73b
.B use
Packit d3f73b
Encode direction only. Enforce static encoding of specified metadata.
Packit d3f73b
.TP
Packit d3f73b
.BR mark " [ "
Packit d3f73b
.IR u32_value " ]"
Packit d3f73b
The value to set for the skb mark. The u32 value is required only when
Packit d3f73b
.BR use " is specified. If
Packit d3f73b
.BR mark " value is zero, it will not be encoded, instead
Packit d3f73b
"overlimits" statistics increment and
Packit d3f73b
.BR CONTROL " action is taken.
Packit d3f73b
.TP
Packit d3f73b
.BR prio " [ "
Packit d3f73b
.IR u32_value " ]"
Packit d3f73b
The value to set for priority in the skb structure. The u32 value is required
Packit d3f73b
only when
Packit d3f73b
.BR use " is specified."
Packit d3f73b
.TP
Packit d3f73b
.BR tcindex " ["
Packit d3f73b
.IR u16_value " ]"
Packit d3f73b
Value to set for the traffic control index in the skb structure. The u16 value
Packit d3f73b
is required only when
Packit d3f73b
.BR use " is specified."
Packit d3f73b
.TP
Packit d3f73b
.BI dmac " DMAC"
Packit d3f73b
.TQ
Packit d3f73b
.BI smac " SMAC"
Packit d3f73b
Optional six byte destination or source MAC address to encode.
Packit d3f73b
.TP
Packit d3f73b
.BI type " TYPE"
Packit d3f73b
Optional 16-bit ethertype to encode. If not specified value of 0xED3E will be used.
Packit d3f73b
.TP
Packit d3f73b
.BI CONTROL
Packit d3f73b
Action to take following an encode/decode.
Packit d3f73b
.TP
Packit d3f73b
.BI index " INDEX"
Packit d3f73b
Assign a unique ID to this action instead of letting the kernel choose one
Packit d3f73b
automatically.
Packit d3f73b
.I INDEX
Packit d3f73b
is a 32bit unsigned integer greater than zero.
Packit d3f73b
.SH EXAMPLES
Packit d3f73b
Packit d3f73b
On the receiving side, match packets with ethertype 0xdead and restart
Packit d3f73b
classification so that it will match ICMP on the next rule, at prio 3:
Packit d3f73b
.RS
Packit d3f73b
.EX
Packit d3f73b
# tc qdisc add dev eth0 handle ffff: ingress
Packit d3f73b
# tc filter add dev eth0 parent ffff: prio 2 protocol 0xdead \\
Packit d3f73b
	u32 match u32 0 0 flowid 1:1 \\
Packit d3f73b
	action ife decode reclassify
Packit d3f73b
# tc filter add dev eth0 parent ffff: prio 3 protocol ip \\
Packit d3f73b
	u32 match ip protocol 0xff flowid 1:1 \\
Packit d3f73b
	action continue
Packit d3f73b
.EE
Packit d3f73b
.RE
Packit d3f73b
Packit d3f73b
Match with skb mark of 17:
Packit d3f73b
Packit d3f73b
.RS
Packit d3f73b
.EX
Packit d3f73b
# tc filter add dev eth0 parent ffff: prio 4 protocol ip \\
Packit d3f73b
	handle 0x11 fw flowid 1:1 \\
Packit d3f73b
	action ok
Packit d3f73b
.EE
Packit d3f73b
.RE
Packit d3f73b
Packit d3f73b
Configure the sending side to encode for the filters above. Use a destination
Packit d3f73b
IP address of 192.168.122.237/24, then tag with skb mark of decimal 17. Encode
Packit d3f73b
the packaet with ethertype 0xdead, add skb->mark to whitelist of metadatum to
Packit d3f73b
send, and rewrite the destination MAC address to 02:15:15:15:15:15.
Packit d3f73b
Packit d3f73b
.RS
Packit d3f73b
.EX
Packit d3f73b
# tc qdisc add dev eth0 root handle 1: prio
Packit d3f73b
# tc filter add dev eth0 parent 1: protocol ip prio 10 u32 \\
Packit d3f73b
	match ip dst 192.168.122.237/24 \\
Packit d3f73b
	match ip protocol 1 0xff \\
Packit d3f73b
	flowid 1:2 \\
Packit d3f73b
	action skbedit mark 17 \\
Packit d3f73b
	action ife encode \\
Packit d3f73b
	type 0xDEAD \\
Packit d3f73b
	allow mark \\
Packit d3f73b
	dst 02:15:15:15:15:15
Packit d3f73b
.EE
Packit d3f73b
.RE
Packit d3f73b
Packit d3f73b
.SH SEE ALSO
Packit d3f73b
.BR tc (8),
Packit d3f73b
.BR tc-u32 (8)