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.

CommandEffect
statushub frame and transaction counters, and peer/agent/client/interface counts
peersevery live connection, including pre-HELLO and admin peers
peers kick <peer-id>disconnect any peer (id as printed, 0x... or decimal)
agentslive agents with interface counts
agents show <name>one agent: its interfaces and consuming clients
agents kick <name>disconnect an agent by registered name
clientsopen client channels, one row per channel
interfacesinterface catalogue with subscriber and traffic counters, and whether each bus carries CAN FD (fd, classic, or - when its agent does not report it)
transactionstransactions 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
pinspinned 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
aclclient grants
acl add <fp|*> <agent|*>/<iface|*> none|r|rw|rwagrant a permission level (semantics)
acl delete <fp|*> <agent|*>/<iface|*>drop a grant
pendingidentities the hub turned away, to authorize (enrolling)
bridgebus-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
groupbridge 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:

SettingValue
bitrate, dbitratenominal and CAN FD data bit rate, bit/s
sample-point, dsample-pointa 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
terminationohms, 0 = off (hardware that supports it)
fd, listen-only, loopback, one-shot, triple-sampling, berr-reportingon or off
restart-msrestart after bus-off, ms (0 = never)
txqueuelenTX queue length
up, downthe 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/down is forwarded to the owning agent and applied on the device via rtnetlink: the agent process needs CAP_NET_ADMIN (agent — capabilities). Bit timing, modes and restart-ms need the link down, so the agent cycles it once for the whole request and every consumer sees the bus drop briefly; agent unreachable means the agent dropped mid-request. Clients with an rwa grant can do the same with can-hub-client configure.
  • Kicked agents normally reconnect on their backoff. To keep one out, pins delete it 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 (default info) or the CAN_HUB_LOG environment variable.