aboutsummaryrefslogtreecommitdiffstats
path: root/bridge-port-to-default
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2021-02-22 15:14:10 +0100
committerGravatar Christian Hesse <mail@eworm.de>2021-02-24 21:51:54 +0100
commitf46db918453dcb8878b9a0de6e122fb0ea2224d9 (patch)
tree31544a450651d0705ecdea0c3d35e650ef784d67 /bridge-port-to-default
parentb0e52aa2d1baa78fc9d025c0671fea8babba0ec2 (diff)
global: give script or function name in log messages
Diffstat (limited to 'bridge-port-to-default')
-rw-r--r--bridge-port-to-default11
1 files changed, 6 insertions, 5 deletions
diff --git a/bridge-port-to-default b/bridge-port-to-default
index 60e3112..b8503df 100644
--- a/bridge-port-to-default
+++ b/bridge-port-to-default
@@ -6,13 +6,14 @@
# reset bridge ports to default bridge
# https://git.eworm.de/cgit/routeros-scripts/about/doc/bridge-port.md
+:local 0 "bridge-port-to-default";
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
:global BridgePortTo;
:global IfThenElse;
-:global LogPrintExit;
+:global LogPrintExit2;
:global ParseKeyValueStore;
:foreach BridgePort in=[ / interface bridge port find where !(comment=[]) ] do={
@@ -23,19 +24,19 @@
:if ($BridgeDefault = "dhcp-client") do={
:if ([ :len $DHCPClient ] != 1) do={
- $LogPrintExit warning ([ $IfThenElse ([ :len $DHCPClient ] = 0) "Missing" "Duplicate" ] . \
+ $LogPrintExit2 warning $0 ([ $IfThenElse ([ :len $DHCPClient ] = 0) "Missing" "Duplicate" ] . \
" dhcp client configuration for interface " . $BridgePortVal->"interface" . "!") true;
}
:local DHCPClientDisabled [ / ip dhcp-client get $DHCPClient disabled ];
:if ($BridgePortVal->"disabled" = false || $DHCPClientDisabled = true) do={
- $LogPrintExit info ("Disabling bridge port for interface " . $BridgePortVal->"interface" . ", enabling dhcp client.") false;
+ $LogPrintExit2 info $0 ("Disabling bridge port for interface " . $BridgePortVal->"interface" . ", enabling dhcp client.") false;
/ interface bridge port disable $BridgePort;
/ ip dhcp-client enable $DHCPClient;
}
} else={
:if ($BridgePortVal->"disabled" = true || $BridgeDefault != $BridgePortVal->"bridge") do={
- $LogPrintExit info ("Enabling bridge port for interface " . $BridgePortVal->"interface" . ", changing to " . $BridgePortTo . \
+ $LogPrintExit2 info $0 ("Enabling bridge port for interface " . $BridgePortVal->"interface" . ", changing to " . $BridgePortTo . \
" bridge " . $BridgeDefault . ", disabling dhcp client.") false;
:if ([ :len $DHCPClient ] = 1) do={
/ ip dhcp-client disable $DHCPClient;
@@ -43,7 +44,7 @@
}
/ interface bridge port set disabled=no bridge=$BridgeDefault $BridgePort;
} else={
- $LogPrintExit debug ("Interface " . $BridgePortVal->"interface" . " already connected to " . $BridgePortTo . \
+ $LogPrintExit2 debug $0 ("Interface " . $BridgePortVal->"interface" . " already connected to " . $BridgePortTo . \
" bridge " . $BridgeDefault . ".") false;
}
}