Update: the reason it didn’t work was because my uplink is on lan3 not lan1.
@psy666 I took a look at the script and I think it’s not necessary to list all the ports. Instead, you can just remove the mac address from all other interfaces.
here is an init script that does this, just copy it to /etc/init.d/whatevernameyoulike
#!/bin/bash /etc/rc.common
USE_PROCD=1
EXTRA_COMMANDS=run
START=99
STOP=10
run() {
/usr/sbin/bridge monitor fdb | while read mac d dev rest; do
if [ $mac != Deleted ]; then
echo Found $mac on $dev;
/usr/sbin/bridge fdb show br br-lan | while read omac d odev rest; do
if [ $omac = $mac ] && [ $odev != $dev ]; then
echo Removing old entry from $odev;
/usr/sbin/bridge fdb del $mac dev $odev $rest;
fi;
done;
fi;
done
}
start_service() {
procd_open_instance
procd_set_param command $initscript run
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}