bridge-port-to-default: use $ParseKeyValueStore...

... and unbreak last commit removing delay (69352c90).
This requires a change in configuration syntax. Change this...

    comment="default:br-local, alt:br-guest"

to...

    comment="default=br-local, alt=br-guest"
This commit is contained in:
Christian Hesse 2020-03-03 13:32:00 +01:00
parent 4ccdec602e
commit 628ae1bd70
5 changed files with 8 additions and 7 deletions

View file

@ -7,12 +7,12 @@
:global BridgePortTo;
:global LogPrintExit;
:global ParseKeyValueStore;
:foreach BridgePort in=[ / interface bridge port find where comment!="" ] do={
:foreach BridgePort in=[ / interface bridge port find where comment~"." ] do={
:local BridgePortVal [ / interface bridge port get $BridgePort ];
:foreach Comment in=[ :toarray ($BridgePortVal->"comment") ] do={
:if ([ :pick $Comment 0 $Len ] = ($BridgePortTo . ":")) do={
:local BridgeDefault [ :pick $Comment $Len [ :len $Comment ] ];
:foreach Config,BridgeDefault in=[ $ParseKeyValueStore ($BridgePortVal->"comment") ] do={
:if ($Config = $BridgePortTo) do={
:if ($BridgeDefault = "dhcp-client") do={
:if ($BridgePortVal->"disabled" = false) do={
$LogPrintExit info ("Disabling bridge port for interface " . $BridgePortVal->"interface" . ", enabling dhcp client.") false;