plugins icon indicating copy to clipboard operation
plugins copied to clipboard

net/frr: watchfrr service handling

Open AndyX90 opened this issue 8 months ago • 4 comments

This commit fixes CARP event handler integration with FRR service startup. It resolves issues with triggering the CARP event handler during service startup, particularly in setups where route costs depend on CARP status.

  • Removes the "start_postcmd" override, as routing deamon lifecycle management is now handled by watchfrr.
  • Introduces two service wrapper scripts to hook into watchfrr's startup and restart procedures.

More information on actual startup behavior: https://cgit.freebsd.org/ports/tree/net/frr8/files/frr.in#n15 https://cgit.freebsd.org/ports/tree/net/frr8/files/watchfrr.in#n25

Tested Scenarios (correct costs applied): ✓ Stopping / Starting FRR ✓ Killing ospfd process ✓ Reboot ✓ Service reload through frr-reload.py

Resolves https://github.com/opnsense/plugins/issues/4702

AndyX90 avatar May 17 '25 18:05 AndyX90

@AdSchellevis This one works! Note: It also removes the old 50-frr start syshook. It is not needed anymore and produces errors on startup: >>> Error in start script '50-frr'

EDIT: Another option instead of removal could've been to change it to something like the carp syshook: ... shell_exec('/usr/local/opnsense/scripts/frr/carp_event_handler'); ...

AndyX90 avatar May 23 '25 05:05 AndyX90

Changes:

  • the wrapper now catches the exit code of the service and returns it to watchfrr.
  • actions_quagga.conf changed accordingly
  • added copyright header

I would try to omit the start syshook, because watchfrr is now enabled by default and should handle such a case. If I'm not mistaken this was because of (sub)process startup issues.

AndyX90 avatar May 23 '25 07:05 AndyX90

Pushed the wrong one 😅 So i think this is the safest version. It uses the startup syshook to invoke the carp_event_handler on successful startup through rc and internally watchfrr start/restarts are handled. If you are okay with this @fichtner and @AdSchellevis then this is the one.

Note: The startup now is taken from the carp hook. This is not explicitly required, but i noticed sometimes some weird timing issues on reboot, when the service starts and watchfrr starts the all the services. It safeguards the setting of needed costs.

AndyX90 avatar May 23 '25 08:05 AndyX90

Changes:

  • added syslog filter definition for frr_wrapper

AndyX90 avatar May 24 '25 11:05 AndyX90