[lwip-users] Noob DHCP question

28 views
Skip to first unread message

Chris Ponder

unread,
Mar 15, 2012, 11:37:58 AM3/15/12
to lwip-...@nongnu.org

Hi all,

 

I have set up DHCP running on lwIP 1.4.0 standalone and it is working wonderfully in that it is getting an address and assigning it to an interface.

 

My question is, how do I interrogate the DHCP information?

 

At the application level I want to know when I have an address, if there is an error getting an address, if the network lead is disconnected / re-connected so that I can restart the Ethernet or set a static address as I see fit.

 

How do I do this?

 

Cheers

Chris

********************************************************

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. If you are not the addressee, any disclosure, reproduction,
copying, distribution, or other dissemination or use of this communication is
strictly prohibited. If you have received this transmission in
error please notify the sender immediately and then delete this e-mail.
E-mail transmission cannot be guaranteed to be secure or error free as
information could be intercepted, corrupted lost, destroyed, arrive late or
incomplete, or contain viruses.
The sender therefore does not accept liability for any errors or omissions
in the contents of this message which arise as a result of e-mail
transmission. If verification is required please request a hard copy
version.

********************************************************

Kieran Mansley

unread,
Mar 20, 2012, 3:40:31 PM3/20/12
to Mailing list for lwIP users

On 15 Mar 2012, at 15:37, Chris Ponder wrote:

> At the application level I want to know when I have an address, if there is an error getting an address, if the network lead is disconnected / re-connected so that I can restart the Ethernet or set a static address as I see fit.

I'm not sure what the supported way of doing this is, but I'm sure that other people do similar things to this. Can anyone help Chris with some suggestions here please?

Thanks

Kieran
_______________________________________________
lwip-users mailing list
lwip-...@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

gold...@gmx.de

unread,
Mar 20, 2012, 4:20:15 PM3/20/12
to Mailing list for lwIP users
Kieran Mansley wrote:
> On 15 Mar 2012, at 15:37, Chris Ponder wrote:
>
>> At the application level I want to know when I have an address, if there is an error getting an address, if the network lead is disconnected / re-connected so that I can restart the Ethernet or set a static address as I see fit.
> I'm not sure what the supported way of doing this is, but I'm sure that other people do similar things to this. Can anyone help Chris with some suggestions here please?

- "when I have an address": you can register a callback with
netif_set_status_callback() that gets called when the netif is set up or
down. Since DHCP sets it to 'up' after getting an address, is this what
you want?
- "the network lead is disconnected": you can register a callback with
netif_set_link_callback(), but for this callback to work, your netif
driver needs to notify lwIP of link state changes by calling
netif_set_link_up() / netif_set_link_down().
- "if there is an error getting an address": I'm not sure how to do
that: DHCP just keeps on trying. Maybe you can just use a timeout and do
something if you didn't get an address X seconds after the link went
from 'down' to 'up'?

Simon

Reply all
Reply to author
Forward
0 new messages