lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] Re: DHCP option "Requested IP"


From: Jakob Stoklund Olesen
Subject: [lwip-devel] Re: DHCP option "Requested IP"
Date: Tue, 22 Sep 2009 10:59:39 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.91 (gnu/linux)

Fabian Koch <address@hidden> writes:

>> The only downside to using the netif API that I can see is that the
>> target will be restricted to always providing the "Requested IP".  Might
>> there be a situation where you need one netif using the "Requested IP"
>> feature, and one not using it, or different times when a netif might
>> want to use it or not?  I'm just worried that once you've turned this
>> option on at compile time you might have no way of not using it, whereas
>> if it was a specific (new) function call you would have more control.
>
> Well it is a deliberate decision of the user to create a netif, give it the
> desired IP and send it to dhcp_start() OR create a netif and send it to
> dhcp_start() directly.

When running with AutoIP coop enabled, the netif will be assigned an
AutoIP address. At the same time, dhcp_discover is being called
repeatedly. You should make sure that the AutoIP address is never
transmitted as "Requested IP".

Since dhcp_discover() can be called at any time (leases expiring, reboot
procedure failing, etc) it is perhaps a bit dangerous to rely on
netif->ip_addr having the desired value.

I understand your not wanting to change the API, but the DHCP startup
API is actually quite ready for an overhaul. I would like to make it
possible to start DHCP in different ways. The following scenarios come
to mind:

- Normal ignorant dhcp_start() as today.
- Start DHCP with INFORM mesage only.
- Start DHCP with stored lease parameters (REBOOT).
- Set Requested IP before starting normally.

I would like to see the initialisation code in dhcp_start() separated
from the call to dhcp_discover() that starts the state machine.

In your case the call sequence would go like:

dhcp_init(netif)
dhcp_set_requested_addr(netif, addr)
dhcp_start(netif)

This way, you could set a flag in the dhcp struct, and store the
requested ip addr somewhere safe.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]