[PATCH] udhcpd: lease conflict

Jiří Prchal jiri.prchal at aksignal.cz
Wed Jan 3 09:30:18 UTC 2018



On 31.12.2017 10:32, Denys Vlasenko wrote:
> On Fri, Dec 15, 2017 at 1:41 PM, Jiri Prchal <jiri.prchal at aksignal.cz> wrote:
>> If there is lease for MAC which is no longer connected and only one IP in pool, it doesn't lease to new one mac until expires the old one.
> 
> This is how it is intended to work.
Could be, may be I'm absolutely wrong. But when should function "nobody_responds_to_arp" bee called, when ip is leased 
or not? And does it make sense to reserve ip for not responding mac?
> 
>> I think for this situation is there function "nobody_responds_to_arp", but it is not called if "lease" is true.
>> In patch I switched the logic and that function is called if is lease.
>>
>> Signed-off-by: Jiri Prchal <jiri.prchal at aksignal.cz>
>> ---
>>   networking/udhcp/dhcpd.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c
>> index 238542b..5eb0682 100644
>> --- a/networking/udhcp/dhcpd.c
>> +++ b/networking/udhcp/dhcpd.c
>> @@ -292,7 +292,7 @@ static uint32_t find_free_or_expired_nip(const uint8_t *safe_mac, unsigned arppi
>>                          goto next_addr;
>>
>>                  lease = find_lease_by_nip(nip);
>> -               if (!lease) {
>> +               if (lease) {
>>   //TODO: DHCP servers do not always sit on the same subnet as clients: should *ping*, not arp-ping!
>>                          if (nobody_responds_to_arp(nip, safe_mac, arpping_ms))
>>                                  return nip;
>> --
>> 2.7.4
>>
> 


More information about the busybox mailing list