{
    "content": [
        {
            "type": "text",
            "text": "# tc-ife(8) (man)\n\n**Summary:** IFE - encapsulate/decapsulate metadata\n\n**Synopsis:** tc ...  action ife DIRECTION [ ACTION ] [ dst DMAC ] [ src SMAC ] [ type TYPE ] [ CONTROL ] [\nindex INDEX ]\nDIRECTION := { decode | encode }\nACTION := { allow ATTR | use ATTR value }\nATTR := { mark | prio | tcindex }\nCONTROL := { reclassify | use | pipe | drop | continue | ok | goto chain CHAININDEX }\n\n## Examples\n\n- `On the receiving side, match packets with ethertype 0xdead and restart classification so that`\n- `it will match ICMP on the next rule, at prio 3:`\n- `# tc qdisc add dev eth0 handle ffff: ingress`\n- `# tc filter add dev eth0 parent ffff: prio 2 protocol 0xdead \\`\n- `u32 match u32 0 0 flowid 1:1 \\`\n- `action ife decode reclassify`\n- `# tc filter add dev eth0 parent ffff: prio 3 protocol ip \\`\n- `u32 match ip protocol 0xff flowid 1:1 \\`\n- `action continue`\n- `Match with skb mark of 17:`\n- `# tc filter add dev eth0 parent ffff: prio 4 protocol ip \\`\n- `handle 0x11 fw flowid 1:1 \\`\n- `action ok`\n- `Configure  the  sending side to encode for the filters above. Use a destination IP address of`\n- `192.168.122.237/24, then tag with skb mark of decimal 17. Encode the packaet  with  ethertype`\n- `0xdead,  add skb->mark to whitelist of metadatum to send, and rewrite the destination MAC ad‐`\n- `dress to 02:15:15:15:15:15.`\n- `# tc qdisc add dev eth0 root handle 1: prio`\n- `# tc filter add dev eth0 parent 1: protocol ip prio 10 u32 \\`\n- `match ip dst 192.168.122.237/24 \\`\n- `match ip protocol 1 0xff \\`\n- `flowid 1:2 \\`\n- `action skbedit mark 17 \\`\n- `action ife encode \\`\n- `type 0xDEAD \\`\n- `allow mark \\`\n- `dst 02:15:15:15:15:15`\n\n## See Also\n\n- tc(8)\n- tc-u32(8)\n- tc(8)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (11 lines)\n- **DESCRIPTION** (5 lines)\n- **OPTIONS** (33 lines)\n- **EXAMPLES** (33 lines)\n- **SEE ALSO** (5 lines)\n\n## Full Content\n\n### NAME\n\nIFE - encapsulate/decapsulate metadata\n\n### SYNOPSIS\n\ntc ...  action ife DIRECTION [ ACTION ] [ dst DMAC ] [ src SMAC ] [ type TYPE ] [ CONTROL ] [\nindex INDEX ]\n\nDIRECTION := { decode | encode }\n\nACTION := { allow ATTR | use ATTR value }\n\nATTR := { mark | prio | tcindex }\n\nCONTROL := { reclassify | use | pipe | drop | continue | ok | goto chain CHAININDEX }\n\n### DESCRIPTION\n\nThe ife action allows for a sending side to encapsulate arbitrary metadata, which is then de‐\ncapsulated  by the receiving end. The sender runs in encoding mode and the receiver in decode\nmode. Both sender and receiver must specify the same ethertype. In the future,  a  registered\nethertype may be available as a default.\n\n### OPTIONS\n\ndecode For the receiving side; decode the metadata if the packet matches.\n\nencode For the sending side. Encode the specified metadata if the packet matches.\n\nallow  Encode direction only. Allows encoding specified metadata.\n\nuse    Encode direction only. Enforce static encoding of specified metadata.\n\nmark [ u32value ] The value to set for the skb mark. The u32 value is required only when use\nis specified. If mark value is zero, it will not be encoded, instead \"overlimits\" sta‐\ntistics increment and CONTROL action is taken.\n\nprio [ u32value  ]  The value to set for priority in the skb structure. The u32 value is re‐\nquired only when use is specified.\n\ntcindex [\nu16value ] Value to set for the traffic control index in the skb structure.  The  u16\nvalue is required only when use is specified.\n\ndmac DMAC\nsmac SMAC\nOptional six byte destination or source MAC address to encode.\n\ntype TYPE\nOptional 16-bit ethertype to encode. If not specified value of 0xED3E will be used.\n\nCONTROL\nAction to take following an encode/decode.\n\nindex INDEX\nAssign  a  unique ID to this action instead of letting the kernel choose one automati‐\ncally.  INDEX is a 32bit unsigned integer greater than zero.\n\n### EXAMPLES\n\nOn the receiving side, match packets with ethertype 0xdead and restart classification so that\nit will match ICMP on the next rule, at prio 3:\n# tc qdisc add dev eth0 handle ffff: ingress\n# tc filter add dev eth0 parent ffff: prio 2 protocol 0xdead \\\nu32 match u32 0 0 flowid 1:1 \\\naction ife decode reclassify\n# tc filter add dev eth0 parent ffff: prio 3 protocol ip \\\nu32 match ip protocol 0xff flowid 1:1 \\\naction continue\n\nMatch with skb mark of 17:\n\n# tc filter add dev eth0 parent ffff: prio 4 protocol ip \\\nhandle 0x11 fw flowid 1:1 \\\naction ok\n\nConfigure  the  sending side to encode for the filters above. Use a destination IP address of\n192.168.122.237/24, then tag with skb mark of decimal 17. Encode the packaet  with  ethertype\n0xdead,  add skb->mark to whitelist of metadatum to send, and rewrite the destination MAC ad‐\ndress to 02:15:15:15:15:15.\n\n# tc qdisc add dev eth0 root handle 1: prio\n# tc filter add dev eth0 parent 1: protocol ip prio 10 u32 \\\nmatch ip dst 192.168.122.237/24 \\\nmatch ip protocol 1 0xff \\\nflowid 1:2 \\\naction skbedit mark 17 \\\naction ife encode \\\ntype 0xDEAD \\\nallow mark \\\ndst 02:15:15:15:15:15\n\n### SEE ALSO\n\ntc(8), tc-u32(8)\n\n\n\niproute2                                     22 Apr 2016                         IFE action in tc(8)\n\n"
        }
    ],
    "structuredContent": {
        "command": "tc-ife",
        "section": "8",
        "mode": "man",
        "summary": "IFE - encapsulate/decapsulate metadata",
        "synopsis": "tc ...  action ife DIRECTION [ ACTION ] [ dst DMAC ] [ src SMAC ] [ type TYPE ] [ CONTROL ] [\nindex INDEX ]\nDIRECTION := { decode | encode }\nACTION := { allow ATTR | use ATTR value }\nATTR := { mark | prio | tcindex }\nCONTROL := { reclassify | use | pipe | drop | continue | ok | goto chain CHAININDEX }",
        "flags": [],
        "examples": [
            "On the receiving side, match packets with ethertype 0xdead and restart classification so that",
            "it will 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",
            "Match with skb mark of 17:",
            "# tc filter add dev eth0 parent ffff: prio 4 protocol ip \\",
            "handle 0x11 fw flowid 1:1 \\",
            "action ok",
            "Configure  the  sending side to encode for the filters above. Use a destination IP address of",
            "192.168.122.237/24, then tag with skb mark of decimal 17. Encode the packaet  with  ethertype",
            "0xdead,  add skb->mark to whitelist of metadatum to send, and rewrite the destination MAC ad‐",
            "dress 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": [
            {
                "name": "tc",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc/8/json"
            },
            {
                "name": "tc-u32",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc-u32/8/json"
            },
            {
                "name": "tc",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/tc/8/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 11,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 33,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 33,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            }
        ]
    }
}