mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
update-gre-address: RouterOS v7 path syntax
This commit is contained in:
parent
2cd0fb88fa
commit
67bd3a32a8
1 changed files with 7 additions and 7 deletions
|
@ -13,19 +13,19 @@
|
|||
|
||||
:global LogPrintExit2;
|
||||
|
||||
/ interface gre set remote-address=0.0.0.0 disabled=yes [ find where !running !disabled ];
|
||||
/interface/gre/set remote-address=0.0.0.0 disabled=yes [ find where !running !disabled ];
|
||||
|
||||
:foreach Peer in=[ / ip ipsec active-peers find ] do={
|
||||
:local PeerVal [ / ip ipsec active-peers get $Peer ];
|
||||
:local GreInt [ / interface gre find where comment=$PeerVal->"id" ];
|
||||
:foreach Peer in=[ /ip/ipsec/active-peers/find ] do={
|
||||
:local PeerVal [ /ip/ipsec/active-peers/get $Peer ];
|
||||
:local GreInt [ /interface/gre/find where comment=$PeerVal->"id" ];
|
||||
:if ([ :len $GreInt ] > 0) do={
|
||||
:local GreIntVal [ / interface gre get $GreInt ];
|
||||
:local GreIntVal [ /interface/gre/get $GreInt ];
|
||||
:if ([ :typeof ($PeerVal->"dynamic-address") ] = "str" && \
|
||||
($PeerVal->"dynamic-address" != $GreIntVal->"remote-address" || \
|
||||
$GreIntVal->"disabled" = true)) do={
|
||||
$LogPrintExit2 info $0 ("Updating remote address for interface " . $GreIntVal->"name" . " to " . $PeerVal->"dynamic-address") false;
|
||||
/ interface gre set remote-address=0.0.0.0 disabled=yes [ find where remote-address=$PeerVal->"dynamic-address" name!=$GreIntVal->"name" ];
|
||||
/ interface gre set $GreInt remote-address=($PeerVal->"dynamic-address") disabled=no;
|
||||
/interface/gre/set remote-address=0.0.0.0 disabled=yes [ find where remote-address=$PeerVal->"dynamic-address" name!=$GreIntVal->"name" ];
|
||||
/interface/gre/set $GreInt remote-address=($PeerVal->"dynamic-address") disabled=no;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue