flockd process is controlled by systemd.
$ systemctl status flockd # systemctl start flockd # systemctl stop flockd
flockd is a single process that is split into separate components.
The system component manages the other components and presents a unified API to the outside world.
The system component monitors external signals and updates the other components as required. Example external signals would be the addition of an IP address to an interface, or the addition of a route to the Linux Kernel.
The system component provides the configuration and operations API.
The RIB component receives route updates from other components and from the Linux Kernel. The RIB component selects the best update for each route and redistributes it to other components and to the Linux Kernel. This redistribution can be controlled by configuration. By default the RIB will send the best route to the Linux Kernel and will accept any routes from the Linux Kernel that are not sourced by
The OSPFv2 component runs the OSPFv2 protocol. This component gets interface state information and connected IP subnet information from the System Component. This component gets external state information by connecting to OSPFv2 neighbors via Linux Kernel raw IP sockets. This information is combined and each best route is derived and sent to the RIB component.
The BGPv4 component runs the BGPv4 protocol. This component gets IP route information from the RIB component and external state information by connecting to BGP neighbors via Linux Kernel TCP sockets. This information is combined and each best route is derived and sent to the RIB component.
The routing suite runs in a single process and each component runs in its own thread. One way to view the active threads it via the Linux /proc virtual file system. The System and RIB components currently share the main thread. OSPFv2 and BGPv4 have a thread each. If a component is not enabled, it will not have a thread.
flock@flocknet:~$ grep Name /proc/`pidof flockd`/task/*/status /proc/409/task/409/status:Name: flockd /proc/409/task/432/status:Name: OSPFv2 Master /proc/409/task/433/status:Name: BGPv4 Master
Logging can be viewed using
flockd logs since router was booted.
$ journalctl -u flockd --boot -- Logs begin at Fri 2020-01-10 14:01:47 GMT, end at Mon 2020-06-29 09:38:44 BST. -- Jun 29 08:49:36 r61 flockd: [INFO flockd] START: PID=455, Compile Mode=Release, Log Level="info" ...
flockd logs since a certain time.
$ journalctl -u flockd --since "2020-06-26 17:19:20" -- Logs begin at Fri 2020-01-10 14:01:47 GMT, end at Mon 2020-06-29 09:40:55 BST. -- Jun 26 17:19:20 r61 flockd: [INFO flockd::bgp::bgp_neigh] 184.108.40.206/Some(BgpId(220.127.116.11)) BgpAsId2(70) Outgoing FSM state change OpenConfirm -> Established ...
Monitor for the latest
$ journalctl -u flockd --follow -- Logs begin at Fri 2020-01-10 14:01:47 GMT. -- Jun 29 09:44:34 r61 flockd: [INFO flockd::bgp::bgp_neigh] 18.104.22.168/Some(BgpId(22.214.171.124)) BgpAsId2(60) Incoming FSM state change OpenConfirm -> Established ...
The default log level is
info. At this level all
info and higher priority levels will be logged. Supported log levels in descending priority order are
[ERROR] is used for unexpected events signalled from inside the router. These are never expected to be seen and indicate a bug. Please email a bug report to:
[WARN] is used for unexpected events signalled from outside the router. It is normal to see warnings whilst the network is converging. Warnings should never be seen after the network has converged and remains stable.
[WARN flockd::ospf_neigh] RouterId(10.0.100.2), V4(10.0.3.157) neigh state change Full -> Down
[INFO] is used for expected events of note
[INFO flockd] START: PID 385 Compile Mode Release Log Level "debug" [INFO flockd::os_intf] Update IntfId(2)] Broadcast Mtu(1500) Up  event DownToUp [INFO flockd::ospf_intf] IntfId(2), 10.0.1.168/24 state change Wait -> DrOther [INFO flockd::ospf_neigh] RouterId(10.0.100.3), V4(10.0.1.152) neigh state change Loading -> Full
[DEBUG] is used for common expected events.
[TRACE] is used for very common expected events.
The default log level can be changed by setting the
RUST_LOG environment variable in the flockd systemd service file.
grep RUST_LOG /lib/systemd/system/flockd.service Environment=RUST_LOG="info"
When the systemd service file has changed, systemd needs to be told to reload the new flockd configuration.
# systemctl daemon-reload
To enable the new log level, flockd needs to be restarted.
# systemctl restart flockd