can-hub-cli — administration
Admin tool for a running hub. It speaks only unix:// — the hub accepts the
admin role exclusively on its local unix socket, so administration is
local-by-design (use SSH or the web panel for remote access).
can-hub-cli [--connect unix://<path>] <command> # default: /run/can-hub/hub.sock
The socket belongs to the can-hub user under the packaged hub; run the cli
as root or as a member of the can-hub group.
Commands
Noun-first grammar; an omitted verb lists.
| Command | Effect |
|---|---|
status | hub frame and transaction counters, and peer/agent/client/interface counts |
peers | every live connection, including pre-HELLO and admin peers |
peers kick <peer-id> | disconnect any peer (id as printed, 0x... or decimal) |
agents | live agents with interface counts |
agents show <name> | one agent: its interfaces and consuming clients |
agents kick <name> | disconnect an agent by registered name |
clients | open client channels, one row per channel |
interfaces | interface catalogue with subscriber and traffic counters, and whether each bus carries CAN FD (fd, classic, or - when its agent does not report it) |
transactions | transactions in flight: interface, owning client, state, lease, steps done, record bytes in flight, age and time since the last progress |
interface show <agent>/<iface> | the settings the bus holds now: link, state, bit timing, modes, TX queue |
interface set <agent>/<iface> <setting>... | reconfigure a bus, every setting in one step (settings) |
interface up|down <agent>/<iface> | bring a bus up or down |
pins | pinned agent identities |
pins add <name> <fingerprint> | authorize an agent, or enroll one pinned on first contact (enrollment) |
pins delete <name> | drop a pin so a re-keyed agent can pin again |
acl | client grants |
acl add <fp|*> <agent|*>/<iface|*> none|r|rw|rwa | grant a permission level (semantics) |
acl delete <fp|*> <agent|*>/<iface|*> | drop a grant |
pending | identities the hub turned away, to authorize (enrolling) |
bridge | bus-to-bus routes with their state and counters |
bridge add <agent>/<iface> <agent>/<iface> [<id>[:<mask>] ...] | inject what the first bus carries into the second, all of it or only the ids given; adding again replaces the ids (bridging buses) |
bridge delete <agent>/<iface> <agent>/<iface> | drop a route |
group | bridge groups with their members, state and counters |
group add <name> [<id>[:<mask>] ...] | create a group of buses that behave as one, or replace its ids (groups) |
group delete <name> | drop a group |
group join <name> <agent>/<iface> [both|sends|receives] [<id>[:<mask>] ...] | add a bus to a group or change it: sends only feeds the group, receives only gets it; ids (up to 8) limit what it sends |
group leave <name> <agent>/<iface> | remove a bus from a group |
Interface settings
interface set takes the words of ip link set ... type can, any number of
them, and the agent applies them all at once:
| Setting | Value |
|---|---|
bitrate, dbitrate | nominal and CAN FD data bit rate, bit/s |
sample-point, dsample-point | a fraction, 0.875 |
tq, prop-seg, phase-seg1, phase-seg2, sjw (and dtq … dsjw) | raw timing instead of a bitrate: time quantum in ns, segments in quanta; sjw alone may go with a bitrate |
termination | ohms, 0 = off (hardware that supports it) |
fd, listen-only, loopback, one-shot, triple-sampling, berr-reporting | on or off |
restart-ms | restart after bus-off, ms (0 = never) |
txqueuelen | TX queue length |
up, down | the link state to leave the bus in |
can-hub-cli interface set truck42/can0 bitrate 500000 sample-point 0.875 fd on dbitrate 2000000
can-hub-cli interface set truck42/can0 restart-ms 100 termination 120
can-hub-cli interface set truck42/can0 tq 125 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
can-hub-cli interface show truck42/can0
Both print the settings the device holds afterwards, as the kernel reports
them (it may round a sample point), raw timing and brp included. A failure prints the kernel's reason,
e.g. apply failed: Operation not supported for bit timing on a vcan.
Notes
- All counters are cumulative and monotonic — sample twice for rates.
interface set/up/downis forwarded to the owning agent and applied on the device via rtnetlink: the agent process needsCAP_NET_ADMIN(agent — capabilities). Bit timing, modes andrestart-msneed the link down, so the agent cycles it once for the whole request and every consumer sees the bus drop briefly;agent unreachablemeans the agent dropped mid-request. Clients with anrwagrant can do the same withcan-hub-client configure.- Kicked agents normally reconnect on their backoff. To keep one out,
pins deleteit first and run the hub with--require-known-peers. - Failures print
hub error <code>: <detail>from the hub's ERROR message. - Command output goes to stdout, diagnostics to stderr. Tune the stderr
verbosity with
--log-level error|warn|info|debug(defaultinfo) or theCAN_HUB_LOGenvironment variable.