TOS 5.2.4 hotplug issues?

Ever since updateing to TOS 5.2.4 I notice issues that seem related to hotplugging.
After a reboot machines on the LAN/WAN networks can reach the rputer but not the internet, while the router can reach both internal machines and the internet. Neither DDNS nor SQM get started properly.
Manual calls to

/etc/init.d/firewall restart
/etc/init.d/ddns restart
/etc/init.d/sqm restart

temporarily fix the issue until the next reboot. After a PPPoE reconnect SQM is partially broken (only the ingress shaper remsins, but the egress shaper disappears and the SQM hotplug script never runs).
Also the firewall hotplug script does not run…

So hotplug for pppoe-wan seems to be not working. here is a work-around to be put into /etc/hotplug.d/net/40-iface-synthesizer that uses the working net hotplug events to sythesize cals to the otherwise left idle /etc/hotplug.d/iface scripts, while trying badly to get the required parameters. This currently only works for pppoe-wan on eth2, because I still hope that this will “fix” itself just as it seems to have appeared on July 25th …

#! /bin/sh

# 20210803 since 0725 TOS fails to call the hotplug.d/iface scripts causing issues with among other's sqm, ddns and firewall
# so here we try to synthesize the relevant information and manually call those scripts as a stop-gap measure
# Here are examples of hotplug.g/net events and their information
#Aug  2 23:23:36 turris hotplug_net_logger: USER=root ACTION=remove SHLVL=1 HOME=/ SEQNUM=1477 IFINDEX=32 HOTPLUG_TYPE=net DEVPATH=/d
#evices/virtual/net/pppoe-wan mangled_fs=btrfs LOGNAME=root DEVICENAME=pppoe-wan TERM=linux SUBSYSTEM=net PATH=/usr/sbin:/usr/bin:/sb
#in:/bin INTERFACE=pppoe-wan PWD=/ DEVTYPE=ppp 
#
#Aug  2 23:23:46 turris hotplug_net_logger: USER=root ACTION=add SHLVL=1 HOME=/ SEQNUM=1478 IFINDEX=37 HOTPLUG_TYPE=net DEVPATH=/devi
#ces/virtual/net/ppp0 mangled_fs=btrfs LOGNAME=root DEVICENAME=ppp0 TERM=linux SUBSYSTEM=net PATH=/usr/sbin:/usr/bin:/sbin:/bin INTER
#FACE=ppp0 PWD=/ DEVTYPE=ppp  
#                                                                                                       
#Aug  2 23:23:46 turris hotplug_net_logger: USER=root ACTION=move SHLVL=1 HOME=/ SEQNUM=1481 IFINDEX=37 HOTPLUG_TYPE=net DEVPATH=/dev
#ices/virtual/net/pppoe-wan mangled_fs=btrfs LOGNAME=root DEVICENAME=pppoe-wan TERM=linux SUBSYSTEM=net DEVPATH_OLD=/devices/virtual/
#net/ppp0 PATH=/usr/sbin:/usr/bin:/sbin:/bin INTERFACE=pppoe-wan PWD=/ DEVTYPE=ppp        

# here are the variables passed to / expected by iface scripts
#ACTION	“ifup”, “ifdown”, “ifupdate”
#INTERFACE	Name of the logical interface which went up or down (e.g. “wan” or “ppp0”)
#DEVICE	Physical device name which interface went up or down (e.g. “eth0.1” or “br-lan”)
#IFUPDATE_ADDRESSES	“1” if address changed
#IFUPDATE_PREFIXES	“1” if prefix updated FIXME what constitutes an update?


VERBOSE=1


[ "$VERBOSE" = "1" ] && logger -t hotplug_synthesizer "Running 40-iface-synthesizer"
[ "$VERBOSE" = "1" ] && logger -t hotplug_synthesizer $(env)

# 1) generate the required action name
NET_ACTION="$ACTION"
case "$NET_ACTION" in
    remove)
	IFACE_ACTION="ifdown"
    ;;
    add|move)
	IFACE_ACTION="ifup"
    ;;
    *)
	# log the environment variable to help figuring out what went wrong
	logger -t hotplug_synthesizer "Unhandled ACTION ($ACTION) encoutered."
	logger -t hotplug_synthesizer $(env)
	exit 0
    ;;
esac
[ "$VERBOSE" = "1" ] && logger -t hotplug_synthesizer "NET_ACTION: $NET_ACTION; IFACE_ACTION: $IFACE_ACTION"




# 2) assign the INTERFACE
NET_INTERFACE="$INTERFACE"
IFACE_INTERFACE="$NET_INTERFACE"
[ "$VERBOSE" = "1" ] && logger -t hotplug_synthesizer "NET_INTERFACE: $NET_INTERFACE; IFACE_INTERFACE: $IFACE_INTERFACE"


# 3) get the DEVICE
NET_DEVICE="$DEVICE"
case "$NET_INTERFACE" in
    TMP_IFB_4_SQM)
	# this gets created a lot during SQM scipts execution so silence this
	exit 0
    ;;
    eth*)
	NET_DEVICE=$NET_INTERFACE
    ;;
    pppoe-wan)
	NET_DEVICE="eth2"
    ;;
    *)
	logger -t hotplug_synthesizer "Unhandled INTERFACE ($NET_INTERFACE) for DEVICE extraction encountered."
	logger -t hotplug_synthesizer $(env)
	exit 0
    ;;
esac
IFACE_DEVICE="$NET_DEVICE"
[ "$VERBOSE" = "1" ] && logger -t hotplug_synthesizer "NET_DEVICE: $NET_DEVICE; IFACE_DEVICE: $IFACE_DEVICE"



# 4) deal with IFUPDATE_ADDRESSES
NET_IFUPDATE_ADDRESSES="1"
IFACE_IFUPDATE_ADDRESSES="$NET_IFUPDATE_ADDRESSES"
[ "$VERBOSE" = "1" ] && logger -t hotplug_synthesizer "NET_IFUPDATE_ADDRESSES: $NET_IFUPDATE_ADDRESSES; IFACE_IFUPDATE_ADDRESSES: $IFACE_IFUPDATE_ADDRESSES"


# 5) deal with IFUPDATE_PREFIXES
NET_IFUPDATE_PREFIXES="1"
IFACE_IFUPDATE_PREFIXES="$NET_IFUPDATE_PREFIXES"
[ "$VERBOSE" = "1" ] && logger -t hotplug_synthesizer "NET_IFUPDATE_PREFIXES: $NET_IFUPDATE_PREFIXES; IFACE_IFUPDATE_PREFIXES: $IFACE_IFUPDATE_PREFIXES"


[ "$VERBOSE" = "1" ] && logger -t hotplug_synthesizer "ACTION=$IFACE_ACTION DEVICE=$IFACE_DEVICE IFUPDATE_ADDRESSES=$IFACE_IFUPDATE_ADDRESSES IFUPDATE_PREFIXES=$IFACE_IFUPDATE_PREFIXES $IFACE_SCRIPT"

# 6) find all scripts in /etc/hotplug.d/iface and call them with appropirate environment variables
for IFACE_SCRIPT in /etc/hotplug.d/iface/*; do
    logger -t hotplug_synthesizer "Calling $IFACE_SCRIPT"
    logger -t hotplug_synthesizer "ACTION=$IFACE_ACTION DEVICE=$IFACE_DEVICE IFUPDATE_ADDRESSES=$IFACE_IFUPDATE_ADDRESSES IFUPDATE_PREFIXES=$IFACE_IFUPDATE_PREFIXES $IFACE_SCRIPT"
    ACTION=$IFACE_ACTION DEVICE=$IFACE_DEVICE IFUPDATE_ADDRESSES=$IFACE_IFUPDATE_ADDRESSES IFUPDATE_PREFIXES=$IFACE_IFUPDATE_PREFIXES $IFACE_SCRIPT
done