From b6e2b8c3e42d117ef36071edb5886423d6700ca5 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 25 Oct 2018 20:48:48 +0200 Subject: bridge-port-to-default: delay only when required --- bridge-port-to-default | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'bridge-port-to-default') diff --git a/bridge-port-to-default b/bridge-port-to-default index 3abb1f3..b273723 100644 --- a/bridge-port-to-default +++ b/bridge-port-to-default @@ -4,13 +4,15 @@ # # reset bridge ports to default bridge -# delay for global-config -:delay 1s; - :global "bridge-port-to"; :local "len" ([ :len $"bridge-port-to" ] + 1); +:if ($"len" = 1) do={ + :delay 1s; + :set "len" ([ :len $"bridge-port-to" ] + 1); +} + :foreach interface in=[ / interface bridge port find where comment!="" ] do={ :foreach comment in=[ :toarray [ / interface bridge port get $interface comment ] ] do={ :if ([ :pick $comment 0 $len ] = ($"bridge-port-to" . ":")) do={ -- cgit v1.2.3-70-g09d2