sargon / ddhcpd

A distributed DHCP Daemon
GNU General Public License v3.0
31 stars 11 forks source link

Reuse used blocks first #43

Closed sargon closed 4 years ago

sargon commented 5 years ago

It seems like, we are leasing from newer blocks instead of reusing already used blocks.

block size/number   4/256 
node id 00163EA4A1210000
ddhcp blocks
index   state   owner           claim   leases  timeout
144 4   00163EA4A1210000    3   0/1 15
225 4   00163EA4A1210000    3   0/1 15

In the leases field the first value are "reserved" addresses by a in progress dhcp discovery event and the second value are the leased addresses.

sargon commented 5 years ago

Investigate into this maybe existing problem, when a client is discovering https://github.com/sargon/ddhcpd/blob/master/dhcp.c#L183 we search for an address using block_find_free_leases https://github.com/sargon/ddhcpd/blob/master/block.c#L239 and my understanding of that function is that it should select used blocks first.

sargon commented 5 years ago

Change of strategy, use the oldest block with unused leases in #52

sargon commented 4 years ago

Fixed in r4