Generic actions in tc(8) Linux Generic actions in tc(8)

# [NAME](#NAME)

gact - generic action

# [SYNOPSIS](#SYNOPSIS)

**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](#DESCRIPTION)

The **gact** action allows reclassify, dropping, passing, or accepting packets. At the moment there are only two algorithms. One is deterministic and the other uses internal kernel netrand.

# [OPTIONS](#OPTIONS)

[**random RANDTYPE CONTROL VAL**](#random)

The probability of taking the action expressed in terms of 1 out of *VAL* packets.

[*CONTROL*](#CONTROL)

Indicate how **tc** should proceed if the packet matches. For a description of the possible *CONTROL* values, see [**tc-actions**(8)](/man/os/iproute2/tc-actions.8).

# [EXAMPLES](#EXAMPLES)

Apply a rule on ingress to drop packets from a given source address.

```
# 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 10 packets from source randomly using the netrand generator

```
# 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

```
# 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](#SEE_ALSO)

[**tc**(8)](/man/os/iproute2/tc.8), [**tc-actions**(8)](/man/os/iproute2/tc-actions.8), [**tc-u32**(8)](/man/os/iproute2/tc-u32.8)

11 Jan 2023 iproute2

---

Document: tc-gact(8) from iproute2 7.2.0-r0 (Chainguard OS)
Source: https://kernel.googlesource.com/pub/scm/network/iproute2/iproute2
