diff options
author | Christian Hesse <mail@eworm.de> | 2022-05-12 11:03:06 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2022-05-12 11:03:06 +0200 |
commit | 48f0a2d21118a7bff7d598e84d9f606fb30bf07a (patch) | |
tree | fb9746502335552880823e9445cd4201414bb8eb /mod/bridge-port-vlan | |
parent | 93ec9afe558ef6eba5d513fab359bb5f6618666d (diff) | |
parent | a71a3d5466548d05d27d31c446c62afdf2412070 (diff) |
Merge branch 'scripts' into ros-v7-path-syntax
Diffstat (limited to 'mod/bridge-port-vlan')
-rw-r--r-- | mod/bridge-port-vlan | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/mod/bridge-port-vlan b/mod/bridge-port-vlan index db9cbfd..6255dff 100644 --- a/mod/bridge-port-vlan +++ b/mod/bridge-port-vlan @@ -16,29 +16,29 @@ :global LogPrintExit2; :global ParseKeyValueStore; - :foreach BridgePort in=[ / interface bridge port find where !(comment=[]) ] do={ - :local BridgePortVal [ / interface bridge port get $BridgePort ]; + :foreach BridgePort in=[ /interface/bridge/port/find where !(comment=[]) ] do={ + :local BridgePortVal [ /interface/bridge/port/get $BridgePort ]; :foreach Config,Vlan in=[ $ParseKeyValueStore ($BridgePortVal->"comment") ] do={ :if ($Config = $ConfigTo) do={ - :local DHCPClient [ / ip dhcp-client find where interface=$BridgePortVal->"interface" comment="toggle with bridge port" ]; + :local DHCPClient [ /ip/dhcp-client/find where interface=$BridgePortVal->"interface" comment="toggle with bridge port" ]; :if ($Vlan = "dhcp-client") do={ :if ([ :len $DHCPClient ] != 1) do={ $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 ]; + :local DHCPClientDisabled [ /ip/dhcp-client/get $DHCPClient disabled ]; :if ($BridgePortVal->"disabled" = false || $DHCPClientDisabled = true) do={ $LogPrintExit2 info $0 ("Disabling bridge port for interface " . $BridgePortVal->"interface" . ", enabling dhcp client.") false; - / interface bridge port disable $BridgePort; + /interface/bridge/port/disable $BridgePort; :delay 200ms; - / ip dhcp-client enable $DHCPClient; + /ip/dhcp-client/enable $DHCPClient; } } else={ :if ($Vlan != [ :tostr [ :tonum $Vlan ] ]) do={ :do { - :set $Vlan ([ / interface bridge vlan get [ find where comment=$Vlan ] vlan-ids ]->0); + :set $Vlan ([ /interface/bridge/vlan/get [ find where comment=$Vlan ] vlan-ids ]->0); } on-error={ $LogPrintExit2 warning $0 ("Could not find VLAN '" . $Vlan . "' for interface " . $BridgePortVal->"interface" . "!") true; } @@ -47,10 +47,10 @@ $LogPrintExit2 info $0 ("Enabling bridge port for interface " . $BridgePortVal->"interface" . ", changing to " . $ConfigTo . \ " vlan " . $Vlan . ", disabling dhcp client.") false; :if ([ :len $DHCPClient ] = 1) do={ - / ip dhcp-client disable $DHCPClient; + /ip/dhcp-client/disable $DHCPClient; :delay 200ms; } - / interface bridge port set disabled=no pvid=$Vlan $BridgePort; + /interface/bridge/port/set disabled=no pvid=$Vlan $BridgePort; } else={ $LogPrintExit2 debug $0 ("Interface " . $BridgePortVal->"interface" . " already connected to " . $ConfigTo . \ " vlan " . $Vlan . ".") false; |