Linux
erpsd on Linux bridges
erpsd runs one or more ERP instances on Linux software bridges. erpsctl sends it commands over a Unix socket.
Dataplane model
| Function | How erpsd does it |
|---|---|
| Ring ports | Two ports of the same bridge, which must have vlan_filtering enabled (checked over rtnetlink) |
| Blocking a port (§9.4) | Remove the instance's protected VIDs from the port's bridge VLAN membership; unblocking adds them back as tagged members |
| R-APS (§9.5) | The R-APS VLAN is not configured on the bridge. A packet socket per ring port with a BPF filter for 01-19-A7-00-00-xx receives R-APS, recovering the VLAN tag from PACKET_AUXDATA; the core forwards it between ring ports in software |
| FDB flush (§9.6) | Netlink bulk delete of dynamic entries per ring port and protected VID (kernel 6.0 and later), with a dump-and-delete fallback |
| Signal fail | The port is down or has no carrier (IFF_UP and IFF_LOWER_UP), tracked through rtnetlink link events |
| Event loop | epoll over the packet sockets, rtnetlink, a timerfd armed to the earliest deadline, a signalfd and the control socket |
It needs CAP_NET_RAW for the packet sockets and CAP_NET_ADMIN for VLAN and FDB changes.
Set up a node
ip link add name br0 type bridge vlan_filtering 1 ip link set ring0 master br0 ip link set ring1 master br0 bridge vlan add dev ring0 vid 10 bridge vlan add dev ring1 vid 10 ip link set br0 up; ip link set ring0 up; ip link set ring1 up
Add each protected VID as a tagged member on both ring ports, and remove VLAN 1 from them if it is not protected. Use the same ring ID and R-APS VID on every node of a ring, and a distinct node ID on each node. Do not give the same protected VID to two instances on the same port.
Configure and run
# /etc/erpsd.conf: one command per line
erps ring R1 ring-id 1 raps-vid 100 port0 ring0 port1 ring1
erps ring R1 node-id 02:00:00:00:00:01
erps ring R1 protected-vlans 10
erps ring R1 role owner rpl-port 1
erps ring R1 enable
erpsd -c /etc/erpsd.conf -s /run/erpsd.sock -l notice
erpsctl -s /run/erpsd.sock show erps summary json
erpsctl -s /run/erpsd.sock erps ring R1 force-switch port 0
erpsctl -s /run/erpsd.sock # interactive, or a script on stdin
- Options
-cconfiguration script (a failing line is reported by number),-scontrol socket (default/run/erpsd.sock, mode 0660),-llog level,-nleave VLAN membership as it is on exit.- Shutdown
- On SIGINT or SIGTERM,
erpsdremoves protected VLANs from enabled ring ports by default, so no unprotected loop is left forwarding. - Node ID
- Set it explicitly. With
node-id autothe daemon uses the bridge's MAC when it can identify the bridge, otherwise the first non-loopback Ethernet MAC.
Control protocol
The control socket is a Unix stream socket. A client writes one command per line; the daemon replies with the command output followed by a trailer line made of the ASCII record separator (0x1E), the decimal result code and a newline. A connection may carry several commands. Requests are limited to 2048 bytes, and a client's pending output to 128 KiB.
Limits
- Linux software bridges only; switch hardware needs its own platform adapter.
- Netlink operations are synchronous with a five-second timeout, so a very large FDB flush pauses the event loop for that long at most.
- FDB flushes are issued per ring port and protected VID; thousands of protected VLANs mean thousands of requests per flush.
- The dump fallback for older kernels handles up to 8192 matching entries per flush.
- A transmit on a port that is down or momentarily out of buffers counts as a lost frame, not a platform error. R-APS is deliberately sent on both ports even when one has failed.
End-to-end test
make e2e needs no root. It runs tests/linux/ring4.sh in a user, network and mount namespace with sysfs remounted, builds four VLAN-filtering bridges joined by veth pairs into a ring, and starts one erpsd per bridge. It then checks:
- Idle convergence, with VLAN 10 removed only at the two RPL ends
- Broadcast traffic crosses the ring without a storm
- A link failure leads to Protection with the RPL opened
- Recovery leads, after WTR, back to Idle
- No platform error on any node, and FDB flushes performed
- Every daemon exits 0 on SIGTERM, reports nothing under AddressSanitizer, and leaves its ring ports blocked