Page MenuHomeVyOS Platform

WAN Load Balancing: User-defined health-check scripts do not receive interface context (WLB_INTERFACE_NAME)
Closed, ResolvedPublicBUG

Description

User-defined WAN load-balancing health-check scripts are executed without any interface context. Unlike WAN hook scripts, they do not receive the interface name via environment variables, making it impossible to write a generic health-check script that can identify the interface being tested.

configuration

set load-balancing wan interface-health eth0 failure-count '3'
set load-balancing wan interface-health eth0 nexthop '10.0.2.2'
set load-balancing wan interface-health eth0 success-count '3'
set load-balancing wan interface-health eth0 test 11 target '10.0.2.2'
set load-balancing wan interface-health eth0 test 11 test-script '/config/scripts/wanlb-hc.sh'
set load-balancing wan interface-health eth0 test 11 type 'user-defined'

set load-balancing wan interface-health eth1 failure-count '3'
set load-balancing wan interface-health eth1 nexthop '10.0.3.2'
set load-balancing wan interface-health eth1 success-count '3'
set load-balancing wan interface-health eth1 test 12 target '10.0.3.2'
set load-balancing wan interface-health eth1 test 12 test-script '/config/scripts/wanlb-hc.sh'
set load-balancing wan interface-health eth1 test 12 type 'user-defined'

set load-balancing wan rule 10 inbound-interface 'eth2'
set load-balancing wan rule 10 interface eth0 weight '1'
set load-balancing wan rule 10 interface eth1 weight '1'
set load-balancing wan rule 10 protocol 'all'
set load-balancing wan sticky-connections inbound

health check script

#!/bin/bash

printenv > /tmp/vars.out

script output

vyos@vyos:~$ cat /tmp/vars.out
PWD=/
SYSTEMD_EXEC_PID=2362
LANG=en_US.UTF-8
INVOCATION_ID=371db7ffcdd9464b886a46f330e78fc9
SHLVL=1
JOURNAL_STREAM=9:9660
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
_=/usr/bin/printenv

Details

Version
vyos-2026.07.21-1151-rolling-generic-amd64
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

Do you know the version where it worked at all?
I believe we didn't pass those info to the health check scripts. If so, it should be a feature request and not a bug report.

Viacheslav triaged this task as Normal priority.Jul 30 2026, 9:53 AM

It was available in 1.4 but with different variable name WLB_SCRIPT_IFACE-

Example output from 1.4

PIDFILE=/run/vyatta/wlb.pid
PWD=/
SYSTEMD_EXEC_PID=20804
_=/usr/bin/printenv
LANG=en_US.UTF-8
INVOCATION_ID=73e7f64b856a4207bade38512f169192
SHLVL=1
JOURNAL_STREAM=7:48364
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
WLB_SCRIPT_IFACE=eth0

I would like to work on this task.

Before implementation, should rolling expose WLB_INTERFACE_NAME to match
the existing WAN state-change hooks, retain the VyOS 1.4 variable
WLB_SCRIPT_IFACE for compatibility, or provide both?

I plan to add regression coverage confirming that each user-defined
health-check script receives the interface being tested. Please assign
the task to me if that scope is acceptable.

@hybridops It would be great to provide both variables retaining backward compatibility. Thanks.

Viacheslav moved this task from Need Triage to Completed on the VyOS Rolling board.