rtr7/router7

implement DHCPDECLINE by ensuring the device gets a different IP

Closed this issue · 1 comments

Turns out that Apple’s DHCP client sends DHCPDECLINE requests when it’s unhappy about a lease (e.g. because it thinks the IP address is still in use by some other device).

We should implement that and ensure giving out a different address for subsequent requests. This will result in a better failure mode.

We’re already using rand.Intn to avoid handing out the same IP address:

i := rand.Intn(h.leaseRange)

…so I’m thinking that we would also need to delete all previous leases for this MAC address from the database to avoid hitting this code path:

// offer previous lease for this HardwareAddr, if any