TC-IFE(8)
๐ IFE action in tc(8) ๐
okay bestie, this is the manual page for IFE action in tc(8) on Linux ๐ฆ it's the tc action for IFE, which is short for encapsulate/decapsulate metadata. let's get into it โจ
โจ NAME โจ
IFE โ encapsulate/decapsulate metadata ๐ง
๐ SYNOPSIS ๐
tc ... action ife DIRECTION [ ACTION ] [ dst DMAC ] [ src SMAC ] [ type
TYPE ] [ CONTROL ] [ index INDEX ]
DIRECTION := { decode | encode }
ACTION := { allow ATTR | use ATTR value }
ATTR := { mark | prio | tcindex }
CONTROL := { reclassify | use | pipe | drop | continue | ok | goto chain
CHAIN_INDEX }
๐ธ DESCRIPTION ๐ธ
okay so the ife action lets the sending side encapsulate arbitrary metadata ๐
and then the receiving end decapsulates it and gets to use it. the sender runs in encoding mode and the receiver runs in decode mode. ๐ซถ
the big rule: both sender and receiver have to specify the same ethertype ๐ no cap, if they don't match it's not gonna work. in the future a registered ethertype may be available as a default, so keep an eye out ๐
๐ OPTIONS ๐
decodeโ this one's for the receiving side ๐ฅ it decodes the metadata if the packet matches.encodeโ this one's for the sending side ๐ค it encodes the specified metadata if the packet matches.allowโ encode direction only ๐ it allows encoding the specified metadata.useโ encode direction only ๐ it enforces static encoding of the specified metadata.mark [ u32_value ]โ sets the value for the skb mark ๐ท๏ธ the u32 value is only required whenuseis specified. if the mark value is zero it won't be encoded, instead the "overlimits" statistics increment and the CONTROL action gets taken ๐ญprio [ u32_value ]โ sets the priority in the skb structure ๐ฅ the u32 value is only required whenuseis specified.tcindex [ u16_value ]โ the value to set for the traffic control index in the skb structure ๐ the u16 value is only required whenuseis specified.dmac DMAC,smac SMACโ optional six byte destination or source MAC address to encode ๐type TYPEโ optional 16-bit ethertype to encode ๐ if you don't specify one,0xED3Egets used as the default.CONTROLโ the action to take right after an encode/decode ๐ฆindex INDEXโ gives this action a unique ID instead of letting the kernel pick one automatically โจ INDEX is a 32bit unsigned integer greater than zero.
๐ง EXAMPLES ๐ง
okay so the first one: on the receiving side, we match packets with ethertype 0xdead and restart classification so it'll match ICMP on the next rule, at prio 3 ๐ฅ
# tc qdisc add dev eth0 handle ffff: ingress
# tc filter add dev eth0 parent ffff: prio 2 protocol 0xdead \
u32 match u32 0 0 flowid 1:1 \
action ife decode reclassify
# tc filter add dev eth0 parent ffff: prio 3 protocol ip \
u32 match ip protocol 0xff flowid 1:1 \
action continue
next up, matching with an skb mark of 17 ๐
# tc filter add dev eth0 parent ffff: prio 4 protocol ip \
handle 0x11 fw flowid 1:1 \
action ok
and now the sending side ๐ค this one is giving main character energy. we're configuring it to encode for the filters above. it uses a destination IP address of 192.168.122.237/24, then tags with an skb mark of decimal 17. the packet gets encoded with ethertype 0xdead, we add skb->mark to the allowed list of metadata to send, and we rewrite the destination MAC address to 02:15:15:15:15:15 ๐
# tc qdisc add dev eth0 root handle 1: prio
# tc filter add dev eth0 parent 1: protocol ip prio 10 u32 \
match ip dst 192.168.122.237/24 \
match ip protocol 1 0xff \
flowid 1:2 \
action skbedit mark 17 \
action ife encode \
type 0xDEAD \
allow mark \
dst 02:15:15:15:15:15
๐ฆ SEE ALSO ๐ฆ
bestie that's the whole IFE page ๐ it's from iproute2, dated 22 Apr 2016, and it's the IFE action in tc(8) manual ๐ go be iconic ๐ธ
๐ฆ where this page comes from
- alpine 3.22: iproute2-doc 6.15.0-r0 ยท GPL-2.0-or-later
- alpine 3.23: iproute2-doc 6.17.0-r0 ยท GPL-2.0-or-later
- alpine 3.24: iproute2-doc 7.0.0-r0 ยท GPL-2.0-or-later
- arch rolling: iproute2 7.2.0-1
- arch rolling: iproute2 7.3.0-1 ยท GPL-2.0-or-later
- centos-stream 10: iproute-tc 7.0.0-2.el10 ยท GPL-2.0-or-later
- centos-stream 9: iproute-tc 6.17.0-3.el9 ยท GPL-2.0-or-later
- debian trixie: iproute2 6.15.0-1 ยท GPL-2.0-only
- fedora 43: iproute-tc 6.14.0-2.fc43 ยท GPL-2.0-or-later
- fedora 44: iproute-tc 6.17.0-2.fc44 ยท GPL-2.0-or-later
- nixos 26.05: iproute2 7.0.0
- nixpkgs unstable: iproute2 7.2.0
- opensuse-leap 16.0: iproute2 6.12-160000.4.1 ยท GPL-2.0-only
- opensuse-leap 16.0: iproute2 6.12-160000.4.1 ยท GPL-2.0-only
- opensuse-leap 16.0: iproute2 6.12-160000.4.1 ยท GPL-2.0-only
- opensuse-leap 16.0: iproute2 6.12-160000.4.1 ยท GPL-2.0-only
- ubuntu questing: iproute2 6.16.0-1ubuntu2
- ubuntu questing: iproute2 6.16.0-1ubuntu2.1 ยท GPL-2.0-only
- ubuntu questing: iproute2 6.16.0-1ubuntu2.2
- ubuntu resolute: iproute2 6.19.0-1ubuntu1 ยท GPL-2.0-only
- ubuntu resolute: iproute2 6.19.0-1ubuntu1.1 ยท GPL-2.0-only
- ubuntu stonking: iproute2 7.2.0-1ubuntu1 ยท GPL-2.0-only
- ๐ girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms