]> git.proxmox.com Git - mirror_iproute2.git/blob - man/man8/tc-ife.8
Merge branch 'master' into net-next
[mirror_iproute2.git] / man / man8 / tc-ife.8
1 .TH "IFE action in tc" 8 "22 Apr 2016" "iproute2" "Linux"
2
3 .SH NAME
4 IFE - encapsulate/decapsulate metadata
5 .SH SYNOPSIS
6 .in +8
7 .ti -8
8 .BR tc " ... " " action ife"
9 .IR DIRECTION " [ " ACTION " ] "
10 .RB "[ " dst
11 .IR DMAC " ] "
12 .RB "[ " src
13 .IR SMAC " ] "
14 .RB "[ " type
15 .IR TYPE " ] "
16 .RI "[ "
17 .IR CONTROL " ] "
18 .RB "[ " index
19 .IR INDEX " ] "
20
21 .ti -8
22 .IR DIRECTION " := { "
23 .BR decode " | " encode " }"
24
25 .ti -8
26 .IR ACTION " := { "
27 .BI allow " ATTR"
28 .RB "| " use
29 .IR "ATTR value" " }"
30
31 .ti -8
32 .IR ATTR " := { "
33 .BR mark " | " prio " | " tcindex " }"
34
35 .ti -8
36 .IR CONTROL " := { "
37 .BR reclassify " | " use " | " pipe " | " drop " | " continue " | " ok " | " goto " " chain " " CHAIN_INDEX " }"
38 .SH DESCRIPTION
39 The
40 .B ife
41 action allows for a sending side to encapsulate arbitrary metadata, which is
42 then decapsulated by the receiving end. The sender runs in encoding mode and
43 the receiver in decode mode. Both sender and receiver must specify the same
44 ethertype. In the future, a registered ethertype may be available as a default.
45 .SH OPTIONS
46 .TP
47 .B decode
48 For the receiving side; decode the metadata if the packet matches.
49 .TP
50 .B encode
51 For the sending side. Encode the specified metadata if the packet matches.
52 .TP
53 .B allow
54 Encode direction only. Allows encoding specified metadata.
55 .TP
56 .B use
57 Encode direction only. Enforce static encoding of specified metadata.
58 .TP
59 .BR mark " [ "
60 .IR u32_value " ]"
61 The value to set for the skb mark. The u32 value is required only when
62 .BR use " is specified. If
63 .BR mark " value is zero, it will not be encoded, instead
64 "overlimits" statistics increment and
65 .BR CONTROL " action is taken.
66 .TP
67 .BR prio " [ "
68 .IR u32_value " ]"
69 The value to set for priority in the skb structure. The u32 value is required
70 only when
71 .BR use " is specified."
72 .TP
73 .BR tcindex " ["
74 .IR u16_value " ]"
75 Value to set for the traffic control index in the skb structure. The u16 value
76 is required only when
77 .BR use " is specified."
78 .TP
79 .BI dmac " DMAC"
80 .TQ
81 .BI smac " SMAC"
82 Optional six byte destination or source MAC address to encode.
83 .TP
84 .BI type " TYPE"
85 Optional 16-bit ethertype to encode.
86 .TP
87 .BI CONTROL
88 Action to take following an encode/decode.
89 .TP
90 .BI index " INDEX"
91 Assign a unique ID to this action instead of letting the kernel choose one
92 automatically.
93 .I INDEX
94 is a 32bit unsigned integer greater than zero.
95 .SH EXAMPLES
96
97 On the receiving side, match packets with ethertype 0xdead and restart
98 classification so that it will match ICMP on the next rule, at prio 3:
99 .RS
100 .EX
101 # tc qdisc add dev eth0 handle ffff: ingress
102 # tc filter add dev eth0 parent ffff: prio 2 protocol 0xdead \\
103 u32 match u32 0 0 flowid 1:1 \\
104 action ife decode reclassify
105 # tc filter add dev eth0 parent ffff: prio 3 protocol ip \\
106 u32 match ip protocol 0xff flowid 1:1 \\
107 action continue
108 .EE
109 .RE
110
111 Match with skb mark of 17:
112
113 .RS
114 .EX
115 # tc filter add dev eth0 parent ffff: prio 4 protocol ip \\
116 handle 0x11 fw flowid 1:1 \\
117 action ok
118 .EE
119 .RE
120
121 Configure the sending side to encode for the filters above. Use a destination
122 IP address of 192.168.122.237/24, then tag with skb mark of decimal 17. Encode
123 the packaet with ethertype 0xdead, add skb->mark to whitelist of metadatum to
124 send, and rewrite the destination MAC address to 02:15:15:15:15:15.
125
126 .RS
127 .EX
128 # tc qdisc add dev eth0 root handle 1: prio
129 # tc filter add dev eth0 parent 1: protocol ip prio 10 u32 \\
130 match ip dst 192.168.122.237/24 \\
131 match ip protocol 1 0xff \\
132 flowid 1:2 \\
133 action skbedit mark 17 \\
134 action ife encode \\
135 type 0xDEAD \\
136 allow mark \\
137 dst 02:15:15:15:15:15
138 .EE
139 .RE
140
141 .SH SEE ALSO
142 .BR tc (8),
143 .BR tc-u32 (8)