[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] what the NETIF_FLAG_DHCP is for?
From: |
Jonathan Larmour |
Subject: |
Re: [lwip-users] what the NETIF_FLAG_DHCP is for? |
Date: |
Fri, 27 Jun 2008 12:50:06 +0100 |
User-agent: |
Mozilla Thunderbird 1.0.8-1.1.fc3.4.legacy (X11/20060515) |
Kiran Bacchewar wrote:
HI all,
i want to enable the DHCP in lwip. iam using lwip 1.3 version.
i made the fallowing initialization...
#define LWIP_DHCP 1 (in lwipopts.h)
ip_addr.addr=0; (in init.c file)
netmask.addr=0;
gw.addr=0;
netif_add(netif,ip_addr,netmask,gw,state,drvr_init,ethernet_input);
netif_set_default(netif);
netif_set_up(netif1);
dhcp_start(netif);
I assume that netif_add isn't literally what you have as I would have
expected something like netif_add(netif, &ip_addr, &netmask, &gw,
netif->state, ....).
and the netif_set_up(netif1) should not have the "1".
But I guess that's just you simplifying for here.
by this initialization, i can see the DISCOVER,OFFER,REQUEST,ACK packets
sent to/from by the lwip as per the DHCP standard.... but when i ping
for the offerd address, the board(on which lwip is ported) doesn't
respond...
after doing some debug... i found that there is no ip address assigned
in the netif->ip_addr, its assignde to 'zero' the initial value...
and if i disable the DHCP and give
1>the static ip addresses
2>make LWIP_DHCP 0
3>remove the dhcp_start()
the ping, all the other appliacations works fine....
what might be the problem??? is the DHCP initialization right??? am i
missing some thing???
I can't instantly see the issue. Are you using the tcpip thread?
In lwipopts.h you could enable LWIP_DEBUG and set DHCP_DEBUG to
LWIP_DBG_ON to get debug output from the dhcp module to see what it thinks
is going on.
Or alternatively you can debug the dhcp_recv() function in dhcp.c from
your debugger, and see why it isn't calling dhcp_bind().
what is the significance of NETIF_FLAG_DHCP?? where it should be set
into the netif flags in the initialization sequence???
You don't need to set it. It gets set by dhcp_start.
Jifl
--
eCosCentric Limited http://www.eCosCentric.com/ The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK. Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
------["The best things in life aren't things."]------ Opinions==mine