Actions
Bug #5648
closedDHCP lease reading is done in the wrong order
Description
DHCP uses a last-lease-wins system - new leases are appended to the leases file and automatically are preferred over earlier entries. However, the proxy uses a first-lease-wins, where we discard any leases that we already have in memory when parsing the leases file.
When you have a lease file like this:
lease 192.168.123.58 {
starts 5 2014/05/09 14:38:13;
ends 5 2014/05/09 14:48:13;
cltt 5 2014/05/09 14:38:13;
binding state active;
next binding state free;
rewind binding state free;
hardware ethernet 52:54:00:22:17:2b;
uid "\001RT\000\"\027+";
}
lease 192.168.123.59 {
starts 5 2014/05/09 14:39:00;
ends 5 2014/05/09 14:49:00;
cltt 5 2014/05/09 14:39:00;
binding state active;
next binding state free;
rewind binding state free;
hardware ethernet 52:54:00:22:17:2b;
}
lease 192.168.123.59 {
starts 5 2014/05/09 14:39:12;
ends 5 2014/05/09 14:49:12;
cltt 5 2014/05/09 14:39:12;
binding state active;
next binding state free;
rewind binding state free;
hardware ethernet 52:54:00:22:17:2b;
}
Then the proxy would report that /dhcp/192.168.123.0/52:54:00:22:17:2b has IP 192.168.123.58 - when in actual fact it has 192.168.123.59.
We need to rewire the proxy to replace leases in memory as it parses down the file.
Actions