1
0
Fork 0

acquire-wan-address remove boundness checking

if we're unbound then the script will be called with
empty ADDRESSES and so the usual case will handle this fine
by removing all the previosuly set addresses
This commit is contained in:
Daniel Barlow 2023-09-13 13:17:58 +01:00
parent 3bdb7754d3
commit fa040a194c
1 changed files with 1 additions and 12 deletions

View File

@ -1,14 +1,6 @@
(local { : system } (require :anoia)) (local { : system } (require :anoia))
(local svc (require :anoia.svc)) (local svc (require :anoia.svc))
(local bound-states
{ :bound true
:rebound true
:informed true
:updated true
:ra-updated true
})
(fn changes [old-addresses new-addresses] (fn changes [old-addresses new-addresses]
(let [added {} (let [added {}
deleted {}] deleted {}]
@ -35,9 +27,6 @@
dir (svc.open state-directory)] dir (svc.open state-directory)]
(accumulate [addresses [] (accumulate [addresses []
v (dir:events)] v (dir:events)]
;; we don't handle unbound or stopped, where we should (update-addresses wan-device addresses (v:output "address")))))
;; take the addresses away
(when (. bound-states (v:output "state"))
(update-addresses wan-device addresses (v:output "address"))))))
{ : update-addresses : changes : run } { : update-addresses : changes : run }