[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: netcfg: using udhcpc to get dhcp lease fails



Otavio Salvador wrote:
> Hello Frans,
> 
> On Sat, Jan 30, 2010 at 9:48 PM, Frans Pop <elendil@planet.nl> wrote:
>> On Saturday 30 January 2010, Otavio Salvador wrote:
>>>> I built a netboot image without dhcp3-udeb to test udhcpc, but it
>>>> failed miserably as it did not manage to get a lease during netcfg.
>>>> How well was this tested?
>> Works OK now. Nice.
> 
> Good; I have a limited way of testing it now so it is nice to know it
> has worked fine to you.
> 
>>> Now it has one. /var/lib/udhcp/udhcpc.leases.
> [...]
>> Probably worth adding/fixing for udhcpc is:
>> - missing option host-name
> 
> I've added it but I can't test it right now. Please see if it works for you.
> 
>> - missing option domain-name-servers
>> - missing option dhcp-server-identifier
>> - strange leading slash for subnet-mask
>> - typo option domain-nam (missing e)
>> The other differences are probably not that relevant.
> 
> I've fixed/added them all.
> 
>> Oh, and we also need 'ntpservers' I think. I can't test that here now, but
>> netcfg does (in dhcp.c):
>>    if ((d = fopen(NTP_SERVER_FILE, "r")) != NULL) {
>>        char ntpservers[DHCP_OPTION_LEN + 1] = { 0 };
>>        fgets(ntpservers, DHCP_OPTION_LEN, d);
>>        fclose(d);
>>        unlink(NTP_SERVER_FILE);
>>
>>        if (!empty_str(ntpservers)) {
>>            debconf_set(client, "netcfg/dhcp_ntp_servers",
>>                        ntpservers);
>>        }
>>    }
>> and the clock-setup postinst has:
>>    db_get netcfg/dhcp_ntp_servers
> 
> Yes; it should work fine. The script writes the content to the file
> netcfg expects. I couldn't test it as well but ought to work fine.
> 
>> Also, if I run netcfg multiple times with dhcp3, I get multiple leases in
>> the leases file. You seem to overwrite the existing file. Not sure if that
>> needs fixing or not.
> 
> I think it is not worth. syslog now has the gotten IP each time it
> runs so is easy to spot if it has been run twice.

With dhcp3 not all the leases in the file are valid aka only the latest
one for every IP is valid if it's not expired yet. I'm not sure if udhcp
would cope with invalid leases in the leases file?

Cheers

Luk


Reply to: