1IFE action in tc(8) Linux IFE action in tc(8)
2
3
4
6 IFE - encapsulate/decapsulate metadata
7
9 tc ... action ife DIRECTION [ ACTION ] [ dst DMAC ] [ src SMAC ] [
10 type TYPE ] [ CONTROL ] [ index INDEX ]
11
12 DIRECTION := { decode | encode }
13
14 ACTION := { allow ATTR | use ATTR value }
15
16 ATTR := { mark | prio | tcindex }
17
18 CONTROL := { reclassify | use | pipe | drop | continue | ok }
19
21 The ife action allows for a sending side to encapsulate arbitrary meta‐
22 data, which is then decapsulated by the receiving end. The sender runs
23 in encoding mode and the receiver in decode mode. Both sender and
24 receiver must specify the same ethertype. In the future, a registered
25 ethertype may be available as a default.
26
28 decode For the receiving side; decode the metadata if the packet
29 matches.
30
31 encode For the sending side. Encode the specified metadata if the
32 packet matches.
33
34 allow Encode direction only. Allows encoding specified metadata.
35
36 use Encode direction only. Enforce static encoding of specified
37 metadata.
38
39 mark [ u32_value ] The value to set for the skb mark. The u32 value is
40 required only when use is specified.
41
42 prio [ u32_value ] The value to set for priority in the skb structure.
43 The u32 value is required only when use is specified.
44
45 tcindex [
46 u16_value ] Value to set for the traffic control index in the
47 skb structure. The u16 value is required only when use is speci‐
48 fied.
49
50 dmac DMAC
51 smac SMAC
52 Optional six byte destination or source MAC address to encode.
53
54 type TYPE
55 Optional 16-bit ethertype to encode.
56
57 CONTROL
58 Action to take following an encode/decode.
59
60 index INDEX
61 Assign a unique ID to this action instead of letting the kernel
62 choose one automatically. INDEX is a 32bit unsigned integer
63 greater than zero.
64
66 On the receiving side, match packets with ethertype 0xdead and restart
67 classification so that it will match ICMP on the next rule, at prio 3:
68 # tc qdisc add dev eth0 handle ffff: ingress
69 # tc filter add dev eth0 parent ffff: prio 2 protocol 0xdead \
70 u32 match u32 0 0 flowid 1:1 \
71 action ife decode reclassify
72 # tc filter add dev eth0 parent ffff: prio 3 protocol ip \
73 u32 match ip protocol 0xff flowid 1:1 \
74 action continue
75
76 Match with skb mark of 17:
77
78 # tc filter add dev eth0 parent ffff: prio 4 protocol ip \
79 handle 0x11 fw flowid 1:1 \
80 action ok
81
82 Configure the sending side to encode for the filters above. Use a des‐
83 tination IP address of 192.168.122.237/24, then tag with skb mark of
84 decimal 17. Encode the packaet with ethertype 0xdead, add skb->mark to
85 whitelist of metadatum to send, and rewrite the destination MAC address
86 to 02:15:15:15:15:15.
87
88 # tc qdisc add dev eth0 root handle 1: prio
89 # tc filter add dev eth0 parent 1: protocol ip prio 10 u32 \
90 match ip dst 192.168.122.237/24 \
91 match ip protocol 1 0xff \
92 flowid 1:2 \
93 action skbedit mark 17 \
94 action ife encode \
95 type 0xDEAD \
96 allow mark \
97 dst 02:15:15:15:15:15
98
99
101 tc(8), tc-u32(8)
102
103
104
105iproute2 22 Apr 2016 IFE action in tc(8)