20 lines
919 B
Text
20 lines
919 B
Text
:global opt82sync do={
|
|
# Add bypass for any bound lease with Option 82
|
|
/ip dhcp-server lease foreach={
|
|
:if ($activeAgentRemoteId != "" && $status = "bound") do={
|
|
:if ([/ip hotspot ip-binding find where address=$activeAddress server=hotspot1 mac-address=$activeMacAddress] = "") do={
|
|
/ip hotspot ip-binding add address=$activeAddress mac-address=$activeMacAddress server=hotspot1 to-address=$activeAddress type=bypassed
|
|
:log info "opt82-poll: bypassed $activeMacAddress / $activeAddress"
|
|
}
|
|
}
|
|
}
|
|
# Remove bypasses for IPs that no longer have any bound lease
|
|
/ip hotspot ip-binding foreach={
|
|
:if ($server = "hotspot1" && $mac-address != "") do={
|
|
:if ([/ip dhcp-server lease find where activeAddress=$address] = "") do={
|
|
/ip hotspot ip-binding remove $.
|
|
:log info "opt82-poll: removed bypass for $mac-address / $address (no lease)"
|
|
}
|
|
}
|
|
}
|
|
}
|