lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] DHCP server offer timing


From: Leon Woestenberg
Subject: Re: [lwip-users] DHCP server offer timing
Date: Thu, 11 Mar 2004 21:21:27 +0100
User-agent: Mozilla Thunderbird 0.5 (Windows/20040207)

Hello,

address@hidden wrote:
> ...
    udp_bind(dhcp->pcb, IP_ADDR_ANY, DHCP_CLIENT_PORT);
    udp_connect(dhcp->pcb, IP_ADDR_BROADCAST, DHCP_SERVER_PORT);
    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_discover: send()ing\n"));
    udp_send(dhcp->pcb, dhcp->p_out);     /* 1 */

    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_discover: bind()ing\n"));
    udp_bind(dhcp->pcb, IP_ADDR_ANY, DHCP_CLIENT_PORT);
    LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_discover: connect()ing\n"));
    udp_connect(dhcp->pcb, IP_ADDR_ANY, DHCP_SERVER_PORT);   /* 2 */
... the offer from DHCP server will be received after udp_send() call
(marked as /* 1 */) before re- udp_bind() and re-udp_connect().


I have re-thought this situation: your system cannot process a packet to the send() while you are still executing this piece the DHCP code.

I.e. the second bind() and connect() should occur atomically with the
send(), *before* you start processing incoming packets.

It sounds like you are either multi-threading the lwIP stack, or your
packet reception interrupt routine pre-empts the current code
execution, by processing the packet in the interrupt routine.

lwIP DOES NOT support this, as it is not multi-threading safe.

I *have* however, just implemented a udp_sendto() call to more cleanly
support sending UDP datagrams from un-associated UDP PCB's and used
these in the DHCP client. They are in CVS HEAD.

They will probably not fix your problem, if my assumption is correct.

Please let me know how the incoming packets are processed.

Regards,

Leon.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]