Hi Sylvain, Sorry for the delay in responding, I took a slight detour running into ;p http://lists.gnu.org/archive/html/lwip-devel/2012-01/msg00018.html
Anyway, before diving into the dhcp problem again I synced my lwip to the latest sources (I was using something which was several weeks old at this point) but now it just works even if I disable LWIP_DHCP_CHECK_LINK_UP again. I am not sure which exact change did it (there were like 99 files which had changed), but it seems to be working now. ( Before the it would be (and stay) in DHCP_STATE_OFF when I entered dhcp_network_changed, now it is in state DHCP_STATE_SELECTING. ) BTW 1 small bug in the current sources (don't really know where to report this so i will piggy back it here): In tcp_out.c, function tcp_output_segment There is (around lines 1261) : #endif /* CHECKSUM_GEN_TCP */ } should be } #endif /* CHECKSUM_GEN_TCP */ Thank you for your help, Bram -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Sylvain Rochet Sent: vrijdag 11 september 2015 11:56 To: Mailing list for lwIP users Subject: Re: [lwip-users] DHCP usage with latest git code version Hi Bram, On Fri, Sep 11, 2015 at 11:48:33AM +0200, Sylvain Rochet wrote: > Hi Bram, > > On Fri, Sep 11, 2015 at 09:10:28AM +0000, Bram Peeters wrote: > > Thanks for the clarification! > > > > I had to add > > #define LWIP_DHCP_CHECK_LINK_UP 1 > > as well to make > > > > > netif_set_up(&gnetif); > > > dhcp_start(&gnetif); > > > Then DHCP will start if netif is already "link up" or at the next "link > > > up" event. > > > > work with the netif initially in link down Otherwise the DCHP state > > was in DHCP_STATE_OFF mode, and stayed in that mode when > > dhcp_network_changed(struct netif *netif) was called when link up > > occurred. > > I don't agree. Only dhcp_release()/dhcp_stop() (and obviously initial > state) switches DHCP to DHCP_STATE_OFF. (Or did you find a bug ?, if > so, please investigate a bit more about this issue ;-) ) > > The only difference LWIP_DHCP_CHECK_LINK_UP makes is that DHCP is not > trying to send discover frames if link is down and then wait for a > link up event, otherwise we are sending discover frames whatever the > current link state is. The dhcp_network_changed() call just speed it > up by cancelling retry timeout. > > > Indeed, DHCP without LWIP_DHCP_CHECK_LINK_UP does not care about > current link state, I should have mentioned that. So it should work > whatever the current shape of your link up/down events handler is. After thinking about it again. It looks like your lwIP timers(timeouts) are not working, which could be an issue with your port. Sylvain _______________________________________________ lwip-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/lwip-users
