Newansage v0.4.0 is out
Reference / Signals, exit codes and files

Signals, exit codes and files

How ansage reacts to signals, what its exit codes mean, its environment variables, files and NOTIFICATIONs.

Signals

SignalEffect
SIGHUPreload the config (like ansage reload, but the result is only logged)
SIGTERM, SIGINTstop: with drain_time, drain first; then close every session with Cease / Administrative Shutdown and remove kernel routes
second SIGTERM/SIGINT during the drainend the drain at once and stop

Exit codes

Daemon

CodeMeaningsystemd unit
0stopped by a signalstays stopped
1error (invalid config, cannot bind, missing capability)restarted after 5 s (Restart=on-failure)
75ansage upgrade: restart merestarted at once (RestartForceExitStatus=75)

Client commands

0 on success, 1 on an error (no socket, unknown neighbor, invalid prefix, refused reload). ansage upgrade exits 0 only once every neighbor is back with our full table; ansage check 0 if the config is valid.

systemd notifications

With Type=notify-reload (or Type=notify) ansage reports through NOTIFY_SOCKET:

MessageWhen
READY=1sessions started (also after a reload)
RELOADING=1a reload begins
STOPPING=1a stop begins
EXTEND_TIMEOUT_USEC, STATUS=draining ...with drain_time: the stop timeout grows by the drain

Environment

VariableEffect
RUST_LOGlog filter, default info; e.g. ansage=debug
NO_COLORno colors in text logs (colors are only used on a terminal anyway)
NOTIFY_SOCKETset by systemd; enables the notifications above
ANSAGE_SUPERVISED=1tells ansage upgrade that a supervisor restarts ansage on exit 75, see Run without systemd
ANSAGE_VERSION, ANSAGE_BASE_URLinstaller only, see Install

Files

PathWhatOwner, mode
/usr/local/bin/ansagethe binaryroot, 0755
/etc/ansage/ansage.tomlthe configroot:ansage, 0640
/etc/ansage/*e.g. password_file keysroot:ansage, 0640
/etc/ansage/*.bak.TIMEfiles the installer replaced
/etc/systemd/system/ansage.servicethe unitroot, 0644
/run/ansage/ansage.sockcontrol socket (control_socket)ansage:ansage, 0660

ansage without --config reads ./ansage.toml; the client commands use --socket, else the control_socket of --config, else /run/ansage/ansage.sock.

NOTIFICATIONs ansage sends

CodeWhen
Cease / Administrative Shutdown (6/2)stop, ansage peer N disable (with the --reason text, RFC 9003)
Cease / Peer De-configured (6/3)the neighbor was removed by a reload
Cease / Administrative Reset (6/4)ansage peer N reset
Cease / Other Configuration Change (6/6)the neighbor's settings changed in a reload
Cease / Maximum Number of Prefixes Reached (6/1)the neighbor exceeded max_prefixes_ipv4/ipv6
Cease / Hard Reset (6/9)wraps the above when the N bit (RFC 8538) is negotiated, so the neighbor drops our routes at once
Cease 6/2 "ansage restarting", without Hard Resetansage upgrade: the neighbor keeps our routes as stale
Hold Timer Expired, OPEN and UPDATE errorsprotocol errors (RFC 4271, RFC 7606)

Esc to close