lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [task #14084] Netif callback called before DHCP client reac


From: Nirav Desai
Subject: [lwip-devel] [task #14084] Netif callback called before DHCP client reached BOUND state
Date: Tue, 12 Jul 2016 12:38:50 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36

URL:
  <http://savannah.nongnu.org/task/?14084>

                 Summary: Netif callback called before  DHCP client reached
BOUND state
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: niravisneo
            Submitted on: Tue 12 Jul 2016 12:38:47 PM GMT
                Category: DHCP
         Should Start On: Tue 12 Jul 2016 12:00:00 AM GMT
   Should be Finished on: Tue 12 Jul 2016 12:00:00 AM GMT
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
        Percent Complete: 0%
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
                  Effort: 0.00

    _______________________________________________________

Details:


I think I may have found an incorrect behavior/regression in inbuilt DHCP
Client of lwip. I think it was introduced When the bug #37068 was fixed. I
see
that the status callback notifying netif driver that the DHCP is complete
gets
triggered before dhcp_bind is complete.

IIUC, before commit id 4e520cdd3009cf2e04c50c173737b379ff7d72a2 the status
callback would trigger only after dhcp_bind was complete. Below is the
detailed flow to elaborate it further.

Earlier LWIP : 1.4.0

DHCPclient Flow was as follows:
1. Netif driver registers a callback  using
   netif_set_status_callback
2. Netif driver starts DHCP Client by calling netifapi_dhcp_start
   It used to call dhcp_start in src/core/dhcp.c
3. DHCP client's state machine execution starts
   When the state is reached to  DHCP_BOUND
   netif was set up by calling  netifapi_netif_set_up
4. This would call the  callback registered in step 1
5. In callback,netif flags are checked
   Check for  NETIF_FLAG_DHCP and  this helps to find out
   that a DHCP address has been gained by the client for the interface


With new  LWIP code:

1. Setup of interface has become a must before calling DHCP start
2. Code sequence
   netifapi_netif_set_up
   netif_set_status_callback
   netifapi_dhcp_start
3. DHCP state machine executes and after dhcp_discover is executed, the
registered callback is called.
   This happens immediately after an IP address is received by the netif.
4. Callback cannot use flag NETIF_FLAG_DHCP as it is not available now
5. dhcp_supplied_address is  used to check if address is  supplied using HCP
  This code checks for DHCP client state and it should be
DHCP_STATE_BOUND
6. But it appears that before dhcp_bind is done and state is changed,
callback
is called.







    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/task/?14084>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

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