diff options
author | Christian Hesse <mail@eworm.de> | 2022-06-02 10:37:31 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2022-06-02 11:14:36 +0200 |
commit | 9942918580a486cfabd6bdec8783fc8069372429 (patch) | |
tree | 91c347135530e8b11e9ea903e85fca1b0325eddd /mod | |
parent | 3d8ca10a91d394670a52137135c2bd56b07de8b9 (diff) |
mod/bridge-port-vlan: re-enable interfaces with longer delay...
... and in one go to limit the overall runtime.
Looks like IPv6 addresses are not flushed if the link down does not last
long enough (~ 2 seconds on linux). This results on stale addresses
after switching the vlan, which breaks connectivity.
Diffstat (limited to 'mod')
-rw-r--r-- | mod/bridge-port-vlan | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/mod/bridge-port-vlan b/mod/bridge-port-vlan index b880c82..13352b5 100644 --- a/mod/bridge-port-vlan +++ b/mod/bridge-port-vlan @@ -17,6 +17,7 @@ :foreach BridgePort in=[ /interface/bridge/port/find where !(comment=[]) ] do={ :local BridgePortVal [ /interface/bridge/port/get $BridgePort ]; + :local InterfaceReEnable [ :toarray "" ]; :foreach Config,Vlan in=[ $ParseKeyValueStore ($BridgePortVal->"comment") ] do={ :if ($Config = $ConfigTo) do={ :local DHCPClient [ /ip/dhcp-client/find where interface=$BridgePortVal->"interface" comment="toggle with bridge port" ]; @@ -51,8 +52,7 @@ } /interface/ethernet/disable [ find where name=$BridgePortVal->"interface" ]; /interface/bridge/port/set disabled=no pvid=$Vlan $BridgePort; - :delay 500ms; - /interface/ethernet/enable [ find where name=$BridgePortVal->"interface" ]; + :set InterfaceReEnable ($InterfaceReEnable, $BridgePortVal->"interface"); } else={ $LogPrintExit2 debug $0 ("Interface " . $BridgePortVal->"interface" . " already connected to " . $ConfigTo . \ " vlan " . $Vlan . ".") false; @@ -60,5 +60,11 @@ } } } + :if ([ :len $InterfaceReEnable ] > 0) do={ + :delay 2s; + :foreach Interface in=$InterfaceReEnable do={ + /interface/ethernet/enable [ find where name=$Interface ]; + } + } } } |