aboutsummaryrefslogtreecommitdiffstats
path: root/bridge-port-to-default
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2019-06-25 23:47:53 +0200
committerGravatar Christian Hesse <mail@eworm.de>2019-06-26 00:07:11 +0200
commit44dd4231cb03f258104083f3ec841d400e3814fa (patch)
treef939c33ea3c35cddf846c74f9bc209b0b5bf34e6 /bridge-port-to-default
parent9d1a59fd646b867ab30712056682f8c643b2cfd9 (diff)
bridge-port-to-default: handle special value 'dhcp-client'...
... which disables the bridge port, but enables a dhcp client.
Diffstat (limited to 'bridge-port-to-default')
-rw-r--r--bridge-port-to-default22
1 files changed, 17 insertions, 5 deletions
diff --git a/bridge-port-to-default b/bridge-port-to-default
index 4d25513..e646b33 100644
--- a/bridge-port-to-default
+++ b/bridge-port-to-default
@@ -18,12 +18,24 @@
:foreach Comment in=[ :toarray ($BridgePortVal->"comment") ] do={
:if ([ :pick $Comment 0 $Len ] = ($BridgePortTo . ":")) do={
:local BridgeDefault [ :pick $Comment $Len [ :len $Comment ] ];
- :if ($BridgeDefault != $BridgePortVal->"bridge") do={
- :log info ("Changing interface " . $BridgePortVal->"interface" . " to " . $BridgePortTo . " bridge " . $BridgeDefault);
- / interface bridge port set bridge=$BridgeDefault $BridgePort;
- / ip dhcp-client renew [ find where interface=$BridgeDefault ];
+ :if ($BridgeDefault = "dhcp-client") do={
+ :if ($BridgePortVal->"disabled" = false) do={
+ :log info ("Disabling bridge port for interface " . $BridgePortVal->"interface" . ", enabling dhcp client.");
+ / interface bridge port disable $BridgePort;
+ / ip dhcp-client enable [ find where interface=$BridgePortVal->"interface" comment="toggle with bridge port" disabled=yes ];
+ }
} else={
- :log debug ("Interface " . $BridgePortVal->"interface" . " already connected to " . $BridgePortTo . " bridge " . $BridgeDefault);
+ :if ($BridgePortVal->"disabled" = true) do={
+ :log info ("Enabling bridge port for interface " . $BridgePortVal->"interface" . ", disabling dhcp client.");
+ / ip dhcp-client disable [ find where interface=$BridgePortVal->"interface" comment="toggle with bridge port" disabled=no ];
+ / interface bridge port enable $BridgePort;
+ }
+ :if ($BridgeDefault != $BridgePortVal->"bridge") do={
+ :log info ("Changing interface " . $BridgePortVal->"interface" . " to " . $BridgePortTo . " bridge " . $BridgeDefault);
+ / interface bridge port set bridge=$BridgeDefault $BridgePort;
+ } else={
+ :log debug ("Interface " . $BridgePortVal->"interface" . " already connected to " . $BridgePortTo . " bridge " . $BridgeDefault);
+ }
}
}
}