diff options
author | Christian Hesse <mail@eworm.de> | 2018-08-27 10:16:10 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2018-08-27 10:16:10 +0200 |
commit | 529acebc7bf57a6407d35c0bfc7aca11d04a08fe (patch) | |
tree | 18a26cc3d60c03e1dd9ba5cdf542b3e39aefa245 /bridge-port-to-default | |
parent | ef48073657244ffe09a99a4880edf07a798ffc8e (diff) |
rename ethernet-to-default -> bridge-port-to-default
Diffstat (limited to 'bridge-port-to-default')
-rw-r--r-- | bridge-port-to-default | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/bridge-port-to-default b/bridge-port-to-default new file mode 100644 index 0000000..6f5c129 --- /dev/null +++ b/bridge-port-to-default @@ -0,0 +1,18 @@ +# +# RouterOS script: bridge-port-to-default +# Copyright (c) 2013-2018 Christian Hesse <mail@eworm.de> +# +# reset bridge ports to default bridge + +:foreach interface in=[ / interface bridge port find where comment~"^default:" ] do={ + :local comment [ / interface bridge port get $interface comment ]; + :local "interface-name" [ / interface bridge port get $interface interface ]; + :local "bridge-default" [ :pick $comment 8 [ :len $comment ] ]; + :local "bridge-current" [ / interface bridge port get $interface bridge ]; + :if ($"bridge-default" != $"bridge-current") do={ + :log info ("Reverting interface " . $"interface-name" . " to default bridge " . $"bridge-default"); + / interface bridge port set bridge=$"bridge-default" $interface; + } else={ + :log debug ("Interface " . $"interface-name" . " already connected to default bridge " . $"bridge-default"); + } +} |