TC-GACT(8)
โจ gact: Generic actions in tc(8) โจ
Hiii bestie ๐ฆ Okay so this is the page for gact, the generic action that lives inside tc(8). It's a Linux thing, and honestly it's giving very clean energy ๐
๐ง NAME
Okay so the name is just gact, short for generic action. Simple, iconic ๐
๐ฅ SYNOPSIS
Here's the shape of the command. Read it like a little recipe ๐
tc ... action gact CONTROL [ RAND ] [ INDEX ]
CONTROL := { reclassify | drop | continue | pass | pipe |
goto chain CHAIN_INDEX |
jump JUMP_COUNT }
RAND := random RANDTYPE CONTROL VAL
RANDTYPE := { netrand | determ }
VAL := number not exceeding 10000
JUMP_COUNT := absolute jump from start of action list
INDEX := index value used
๐ธ DESCRIPTION
Okay so gact lets you reclassify, drop, pass, or accept packets. Main character energy ๐ Right now there are only two algorithms. One is deterministic, and the other uses the internal kernel netrand. Both are lowkey iconic ๐ซถ
โจ OPTIONS โจ
random RANDTYPE CONTROL VALโ This one is the probability setting. It tells you the chance of taking the action, written as 1 out ofVALpackets. So 1 out of every VAL packets gets the action ๐CONTROLโ This is where you telltchow to proceed if the packet matches. For all the possibleCONTROLvalues, go check outtc-actions(8). Literally the place to go ๐
๐ฆ EXAMPLES ๐ฆ
Okay now the fun part ๐ญ Here are the examples, all of them, ready to copy.
Apply a rule on ingress to drop packets from a given source address. Bye bye, bad vibes ๐
# tc filter add dev eth0 parent ffff: protocol ip prio 6 u32 match ip src 10.0.0.9/32 flowid 1:16 action drop
Allow 1 out of 10 packets from the source, randomly, using the netrand generator. Lowkey a probability flex ๐ฒ
# tc filter add dev eth0 parent ffff: protocol ip prio 6 u32 match ip src 10.0.0.9/32 flowid 1:16 action drop random netrand ok 10
Deterministically accept every second packet. Predictable and periodt ๐
# tc filter add dev eth0 parent ffff: protocol ip prio 6 u32 match ip src 10.0.0.9/32 flowid 1:16 action drop random determ ok 2
๐ SEE ALSO ๐
Go check these out, they're the real ones ๐ซถ
Okay that's the whole tea ๐ต Shoutout to iproute2, last updated 11 Jan 2023, all about Generic actions in tc(8). Love you, mwah ๐๐งโจ
๐ฆ 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