[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] DHCP usage with latest git code version
From: |
Sylvain Rochet |
Subject: |
Re: [lwip-users] DHCP usage with latest git code version |
Date: |
Thu, 10 Sep 2015 14:53:18 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Hi Bram,
On Thu, Sep 10, 2015 at 11:01:37AM +0000, Bram Peeters wrote:
> Hi,
>
> What is the recommended sequence to start DHCP with the latest git
> sources (anno 20150910) ? In the past dhcp_start() would automatically
> bring up the interface, and there is still a lot of references
> floating around to that way of working.
The behavior changed, an interface must be administratively up before
starting DHCP, which makes more sense than the previous behavior.
> So that note is wrong now because dhcp_start has an error on a down
> interface:
> if (netif_is_link_up(&gnetif))
> {
> /* When the netif is fully configured this function must be called */
> netif_set_up(&gnetif);
"netif link up" and "netif up" events are orthogonal properties,
coupling these events are wrong.
netif link up = hardware state, whether cable is plugged or unplugged
netif up = software administrative state, whether interface should be
used for routing or not
So, a interface must be administratively up before starting DHCP, so:
netif_set_up(&gnetif);
dhcp_start(&gnetif);
Then DHCP will start if netif is already "link up" or at the next "link
up" event.
If your port does not support link down/up events, you also need to call
netif_set_linkup() on your netif, but you'll lose the link status
signaling which makes DHCP fast.
Sylvain
signature.asc
Description: Digital signature