mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
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.
This commit is contained in:
parent
3d8ca10a91
commit
9942918580
1 changed files with 8 additions and 2 deletions
|
@ -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 ];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue