You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(netfault): replace root qdisc instead of add to support pre-existing qdiscs
Network attacks using tc (delay, loss, corruption, bandwidth) failed
on hosts where the kernel had already attached a root qdisc to the
target interface (e.g. `mq` on GKE COS, EKS, AKS, RHCOS). `tc qdisc
add ... root` returned `NLM_F_REPLACE needed to override` and the
attack could not start.
Switch the root qdisc command to `tc qdisc replace ... root` on apply.
On revert we still `qdisc del root`; the kernel then re-attaches its
default qdisc (`mq` on multi-queue devices, `noqueue` on veth,
otherwise the configured `net.core.default_qdisc`), so common cloud
node setups are restored to their pre-attack state automatically.
Add a preflight that runs `tc qdisc show` once per Apply, parses all
root qdiscs into a map, and emits a warning for each affected
interface whose root qdisc is not in the kernel-auto-restored
allowlist (mq, noqueue, pfifo_fast, fq_codel, fq). Callers surface
the warnings via the new `Apply` return value.
Refactor the Opts interface to opt in to subsystem behavior via three
optional providers, mirroring the existing iptablesScriptProvider:
- tcCommandProvider (tcCommands + tcRootQdiscInterfaces)
- ipCommandProvider (ipCommands)
- iptablesScriptProvider (iptablesScripts)
Each opts type now only implements the providers for the subsystems
it actually uses, removing six `return nil, nil` stubs across
blackhole, delay, loss, corruption, bandwidth, and tcp_reset.
generateAndRunCommands and Apply discover behavior via type
assertions, the same pattern already used for iptables scripts.
Breaking changes:
- `netfault.Apply` now returns `([]string, error)`. The string slice
contains preflight warnings to surface to the user.
- The `Opts` interface no longer requires `ipCommands` or `tcCommands`.
External Opts implementations that returned `nil, nil` from these
methods can simply remove them; external callers that consumed those
methods need a type assertion first.
0 commit comments