From 529acebc7bf57a6407d35c0bfc7aca11d04a08fe Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 27 Aug 2018 10:16:10 +0200 Subject: rename ethernet-to-default -> bridge-port-to-default --- bridge-port-to-default | 18 ++++++++++++++++++ ethernet-to-default | 18 ------------------ 2 files changed, 18 insertions(+), 18 deletions(-) create mode 100644 bridge-port-to-default delete mode 100644 ethernet-to-default 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 +# +# 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"); + } +} diff --git a/ethernet-to-default b/ethernet-to-default deleted file mode 100644 index f38622f..0000000 --- a/ethernet-to-default +++ /dev/null @@ -1,18 +0,0 @@ -# -# RouterOS script: ethernet-to-default -# Copyright (c) 2013-2018 Christian Hesse -# -# reset ethernet interfaces 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"); - } -} -- cgit v1.2.3-70-g09d2