cancel
Showing results for 
Search instead for 
Did you mean: 

Hostname of STM32F7 with FW 1.16.1 and LWIP v 2.1.2 is not changable

ab_nurd
Associate II

Hello,

I have generated code for STM32F7 using STM32CubeMX with firmware package version 1.16.1 and lwIP version 2.1.2.

In ethernetif_init function of ethernetif.c file, I have changed default value of netif->hostname.(LWIP_NETIF_HOSTNAME is already enabled) But when I search the active nodes on network using "arp-scan --localnet" I see the hostname of my STM32 as "STMicroelectronics SRL" and not the one which was set in code.

How can the default hostname be changed?

Thanks.

Abhijeet

2 REPLIES 2

Hello @Community member​,

First le me welcome you to the STM32 Community and apologize for the late reply :smiling_face_with_smiling_eyes:

In order to avoid any misunderstanding could you please detail more the issue.

Do you mean that even after enabling LWIP_NETIF_HOSTNAME  through STM32CubeMX interface, it will not be correctly set to 1 in the generated lwipopts.h ?

Normally, LWIP_NETIF_HOSTNAME parameter should be defined to 1 in your lwipopts.h. The default host name value is "lwip" ,please refer to 'ethernetif_init()' function of ethernetif.c file:

#if LWIP_NETIF_HOSTNAME
  /* Initialize interface hostname */
  netif->hostname = "lwip";
#endif /* LWIP_NETIF_HOSTNAME */

Then you can change it by your preferred host name value, or you can call 'netif_set_hostname()' after the initialization to override the default name.

Furthermore, you'll find linked the User Manual detailing the process of developing applications on STM32Cube with LwIP TCP/IP stack.

Your feedback will be very helpful to discern the problem :)

Khouloud.

ab_nurd
Associate II

Hello Khouloud,

we assigned our company specific MAC address in low_level_init function, after which the hostname was set to our company name (setting hostname using lwIP had still no effect though).

Thanks & Regards,

Abhijeet