cancel
Showing results for 
Search instead for 
Did you mean: 

NetxDuo mDNS and DHCP conflict because of ST Ethernet driver

sssooo
Associate II

Hi all,

I've noticed that a DHCP client can not get an IP address from the server if both mDNS server and DHCP client are enabled.

The reason seems to be in ST Ethernet driver (nx_stm32_eth_driver.c):

static UINT  _nx_driver_hardware_initialize(NX_IP_DRIVER *driver_req_ptr)
{
...
  FilterConfig.BroadcastFilter = ENABLE;
...
}


static UINT  _nx_driver_hardware_multicast_join(NX_IP_DRIVER *driver_req_ptr)
{
  /* Increase the multicast count.  */
  nx_driver_information.nx_driver_information_multicast_count++;

  /* Enable multicast frame reception.  */
  FilterConfig.PassAllMulticast = ENABLE;
  HAL_ETH_SetMACFilterConfig(&eth_handle, &FilterConfig);

  /* Return success.  */
  return(NX_SUCCESS);
}

In _nx_driver_hardware_initialize() FilterConfig is just prepared, there is no HAL_ETH_SetMACFilterConfig() call.

That's why DHCP works OK if mDNS is not used.

If mDNS is active, it calls _nx_driver_hardware_multicast_join() and applies a prepared FilterConfig  where BroadcastFilter is ENABLED.

This blocks DHCP work.

Fix seems to be: set BroadcastFilter to DISABLE in _nx_driver_hardware_initialize()

Is such a fix correct?

 

2 REPLIES 2
STackPointer64
ST Employee

Hello @sssooo, and welcome to ST Community!

Could you please provide a minimal version of the project that reproduces this issue? This will help us analyze the problem more efficiently. Thank you!

Best regards,

To improve visibility of answered topics, please click 'Accept as Solution' on the reply that resolved your issue or answered your question.
sssooo
Associate II

Hello,

 

please see attached project for NUCLEO-H563ZI.

If you will try the project as is, DHCP and mDNS works ok.

This is because I've manually set BroadcastFilter to DISABLE in _nx_driver_hardware_initialize().

You can try to change it to ENABLE and DHCP will not work (it will not receive a broadcast packet from DHCP server).

 

Please notice that nx_mdns_create() and nx_mdns_enable() are called before nx_dhcp_start().

This is done intentionally for fast DHCP fail demonstration (with BroadcastFilter = ENABLE).

If mDNS starts after DHCP at first look all works ok together, but after a few hours DHCP will try to extend IP lease time but without success because of BroadcastFilter activated by mDNS.

 

Regards