AnsweredAssumed Answered

migrate 4.1 -> 4.2 : issues with DHCP renewals and ipcfg_poll() linkdown/linkup

Question asked by m.bach on Jun 18, 2015
Latest reply on Jun 30, 2015 by Carlos_Musich

Hi There,

 

I'm currently migrating from MQX 4.1 to MQX 4.2

 

- my system is initialized by ipcfg_dhcp_wait() once from inittask

- after that, I'm running ipcfg_task_poll() continuously ever 250 ms, like that

 

    uint8_t link = ipcfg_get_link_active(ENET_DEVICE);

    uint8_t ipcfg_state = ipcfg_get_state(ENET_DEVICE);

    ipcfg_task_poll();

    epc_dbg("ipcfg_get_link_active(%d) ipcfg_get_state(%d='%s')\n",

            link,

            ipcfg_state, ipcfg_get_state_string(ipcfg_state));

 

 

in MQX v4.1 everything is OK: when unplugging the ethernet link the state dropped down from 6='DHCP' to 1='UNBOUND'

After plugging the ethernet link it comes back to 6='DHCP', by passing 2='BUSY', just like this:

 

 

EPC-> ipcfg_get_link_active(1) ipcfg_get_state(6='DHCP')

EPC-> ipcfg_get_link_active(1) ipcfg_get_state(6='DHCP')

EPC-> ipcfg_get_link_active(0) ipcfg_get_state(6='DHCP')

RTCS-> eth0 link down

EPC-> ipcfg_get_link_active(0) ipcfg_get_state(1='UNBOUND')

EPC-> sec handler 3, 8.58s eth(0)

EPC-> ipcfg_get_link_active(0) ipcfg_get_state(1='UNBOUND')

EPC-> ipcfg_get_link_active(0) ipcfg_get_state(1='UNBOUND')

EPC-> ipcfg_get_link_active(0) ipcfg_get_state(1='UNBOUND')

EPC-> ipcfg_get_link_active(0) ipcfg_get_state(1='UNBOUND')

EPC-> sec handler 3, 9.58s eth(0)

EPC-> ipcfg_get_link_active(0) ipcfg_get_state(1='UNBOUND')

EPC-> ipcfg_get_link_active(0) ipcfg_get_state(1='UNBOUND')

EPC-> ipcfg_get_link_active(0) ipcfg_get_state(1='UNBOUND')

EPC-> ipcfg_get_link_active(0) ipcfg_get_state(1='UNBOUND')

EPC-> sec handler 3, 10.58s eth(0)

EPC-> ipcfg_get_link_active(0) ipcfg_get_state(1='UNBOUND')

EPC-> ipcfg_get_link_active(1) ipcfg_get_state(1='UNBOUND')

RTCS-> eth0 link up

EPC-> ipcfg_get_link_active(1) ipcfg_get_state(2='BUSY')

EPC-> ipcfg_get_link_active(1) ipcfg_get_state(6='DHCP')

RTCS-> IP Address      : 192.168.3.38

RTCS-> Subnet Address  : 255.255.240.0

RTCS-> Gateway Address : 192.168.1.3

RTCS-> DNS Address     : 192.168.1.5

 

 

With MQX 4.2, it simply stays in 6='DHCP' after ethernet is disconnected, no DHCP requests are send after re-plugging the cable.

Maybe this is due to the removal of unbinding the the device in ipcfg_task_poll().

 

ipcfg.c now says:

        #if 0  /* It is done automatically inside ipcfg_bind_xxx().

                * Also it caused wrong behavior for devices that have wrong link detection,

                * and there was no possibility to get IP parameters when cable is disconnected.*/

  else if ((! link) && (actual_state != IPCFG_STATE_UNBOUND))

  {

  // link is down, unbind any interface

  ipcfg_unbind_internal (i);

  }

        #endif

 

 

 

Issue no 2 is: I'm loosing IP connection when the DHCP lease time is expired, there is to rebinding process after half lease time anymore.

 

Maybe these 2 issues are connected to each other.

 

However, running ipcfg_dhcp_wait() intially and then running ipcfg_task_poll() continuously isn't like it was before...

I hope I can find out more tomorrow, but maybe someone already can give a me clue?

 

cheers, Martin

Outcomes