This category is for handling requests for privileged interfaces, formerly known as auto-connections. The process is documented in Process for aliases, auto-connections and tracks.
To make the review of your request easier, please use the following template to provide all the required details and also include any other information that may be relevant.
name: wasta-traffic-cop
description: Set and watch per-app bandwidth limits.
snapcraft: https://github.com/wasta-linux/traffic-cop/blob/main/snap/snapcraft.yaml
upstream: https://github.com/wasta-linux/traffic-cop
upstream-relation: same developer
plugs: # all plugs are for daemon app only
network-control:
request-type: auto-connection
reasoning: to apply bandwidth limits with tc and ip on the interface
currently connected to the internet
- an HTB root qdisc with one CAKE leaf per limited app, plus an `fw`
filter matching the daemon’s packet mark;
- an `ifb-trafficcop` device, and an ingress qdisc with `matchall` +
`connmark` + `mirred`, so downloads are shaped on the ifb device the
same way;
- `ip route get` to find the interface currently connected to the
internet (and follow VPNs), and `tc -s -j qdisc show` to read CAKE’s
counters for the rates.
firewall-control:
request-type: auto-connection
reasoning: to load one nftables table, `inet trafficcop`, through
libnftables. It marks each app’s packets with `socket cgroupv2 level N
"<the app's systemd unit>"`, and holds the counters that measure each
app’s traffic. The daemon only uses mark bits 24–29 (mask `0x3f000000`)
and leaves the rest of the mark alone, so WireGuard, Tailscale and similar
marks keep working. The table is removed when the daemon stops or is
paused.
system-observe:
request-type: auto-connection
reasoning: to find which systemd unit each configured app runs in. The
daemon reads `/proc/<pid>/cgroup`, `/proc/<pid>/comm` and `/proc/<pid>/
cmdline` for all processes, and `/proc/<pid>/exe` where readable. These
are matched against the user’s settings (e.g. `snap: firefox` matches
`snap.firefox.firefox-*.scope`; `exe: /usr/lib/firefox/firefox`). It also
reads a caller’s `/proc/<pid>/status` to check their groups before
allowing changes. Processes must be observed regardless of which user runs
them: apps run as the desktop user, and the daemon runs as root.
What the snap does: Traffic Cop sets per-app bandwidth limits (download and upload) and shows each app’s live usage. It’s for people on slow or metered connections: for example, keeping a video call usable while snap updates download, or capping how much data a browser can use. It’s developed for Wasta Linux (a Ubuntu-based distribution used by SIL staff and partners). It replaces our earlier deb, which needed root, pkexec and port polling.
Design: One root daemon does all the privileged work. The GUI (wasta-traffic-cop.gui) and the CLI (wasta-traffic-cop) don’t plug any of these interfaces. They only talk to the daemon over a Unix socket in $SNAP_COMMON. The daemon checks each caller with SO_PEERCRED: anyone may read status and rates, but only root or members of sudo/admin/wheel may change limits or pause them. The daemon doesn’t touch anything outside its own objects, and removes all of them when it stops.
Why auto-connect: without these three interfaces the snap can’t do anything: the daemon can neither detect apps nor limit them. The intended users are not technical. On a fresh install, limits start paused until an administrator turns them on, so connecting the interfaces automatically doesn’t start shaping anyone’s traffic unexpectedly.
Alternatives considered: classic confinement isn’t needed: everything works under strict confinement with these interfaces (tested with a local build on core26). kernel-module-load turned out not to be needed, because the ifb module loads automatically.