mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-15 12:34:27 +02:00
mod/bridge-port-to: 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 bridge, which breaks connectivity.
This commit is contained in:
parent
61c9b29ec3
commit
3d8ca10a91
1 changed files with 8 additions and 2 deletions
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
:foreach BridgePort in=[ /interface/bridge/port/find where !(comment=[]) ] do={
|
:foreach BridgePort in=[ /interface/bridge/port/find where !(comment=[]) ] do={
|
||||||
:local BridgePortVal [ /interface/bridge/port/get $BridgePort ];
|
:local BridgePortVal [ /interface/bridge/port/get $BridgePort ];
|
||||||
|
:local InterfaceReEnable [ :toarray "" ];
|
||||||
:foreach Config,BridgeDefault in=[ $ParseKeyValueStore ($BridgePortVal->"comment") ] do={
|
:foreach Config,BridgeDefault in=[ $ParseKeyValueStore ($BridgePortVal->"comment") ] do={
|
||||||
:if ($Config = $BridgePortTo) do={
|
:if ($Config = $BridgePortTo) do={
|
||||||
:local DHCPClient [ /ip/dhcp-client/find where interface=$BridgePortVal->"interface" comment="toggle with bridge port" ];
|
:local DHCPClient [ /ip/dhcp-client/find where interface=$BridgePortVal->"interface" comment="toggle with bridge port" ];
|
||||||
|
@ -44,8 +45,7 @@
|
||||||
}
|
}
|
||||||
/interface/ethernet/disable [ find where name=$BridgePortVal->"interface" ];
|
/interface/ethernet/disable [ find where name=$BridgePortVal->"interface" ];
|
||||||
/interface/bridge/port/set disabled=no bridge=$BridgeDefault $BridgePort;
|
/interface/bridge/port/set disabled=no bridge=$BridgeDefault $BridgePort;
|
||||||
:delay 500ms;
|
:set InterfaceReEnable ($InterfaceReEnable, $BridgePortVal->"interface");
|
||||||
/interface/ethernet/enable [ find where name=$BridgePortVal->"interface" ];
|
|
||||||
} else={
|
} else={
|
||||||
$LogPrintExit2 debug $0 ("Interface " . $BridgePortVal->"interface" . " already connected to " . $BridgePortTo . \
|
$LogPrintExit2 debug $0 ("Interface " . $BridgePortVal->"interface" . " already connected to " . $BridgePortTo . \
|
||||||
" bridge " . $BridgeDefault . ".") false;
|
" bridge " . $BridgeDefault . ".") false;
|
||||||
|
@ -53,5 +53,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
:if ([ :len $InterfaceReEnable ] > 0) do={
|
||||||
|
:delay 2s;
|
||||||
|
:foreach Interface in=$InterfaceReEnable do={
|
||||||
|
/interface/ethernet/enable [ find where name=$Interface ];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue