[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [lwip-users] DHCP
From: |
Bill Auerbach |
Subject: |
RE: [lwip-users] DHCP |
Date: |
Fri, 23 May 2008 08:29:14 -0400 |
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On
> Behalf Of Guido Moritz
> Sent: Friday, May 23, 2008 5:17 AM
> To: Mailing list for lwIP users
> Subject: [lwip-users] DHCP
>
> Hi.
>
> 1.I made it to bring DHCP up on my Board. But in which struct (to let
> the board tell me his IP via UART) can I get my IP from and let the
> board tell me the adress.
You can get the IP address, Netmask and Gateway from the netif you're using
for the interface: e.g. netif->ip_addr
> 2.Can I check (via polling e.g.) if I have a valid IP adress received
> through DHCP so that the rest of my aplication can go on with work?
After dhcp_start, you can watch a timer and the netif for being up:
If( ( netif->flags & (NETIF_FLAG_UP | NETIF_FLAG_LINK_UP) ) !=
(NETIF_FLAG_UP | NETIF_FLAG_LINK_UP) )
Check_timer - if expired do something.
You can use autoip and not have to handle DHCP working or not. I do the
above and in my "do something", I fall back to a fixed local IP address
(169.254.x.x) so I can configure the device (which I can do with UDP
broadcast because I can still talk to the device).
Bill