I'm using a combination of lwip_dhcp and lwip_udpecho examples. I want to be able to use the hostname for utilities such as ping, and functions such as gethostbyname from winsock.h.
In opt.h line 1585, I made this change to enable a hostname (changed the zero to a 1)
#if !defined LWIP_NETIF_HOSTNAME || defined __DOXYGEN__
#define LWIP_NETIF_HOSTNAME 1
#endif
In the main function of lwip_udpecho_bm.c, I added netif_set_hostname and dhcp_start:
netif_add(&fsl_netif0, &fsl_netif0_ipaddr, &fsl_netif0_netmask, &fsl_netif0_gw, &fsl_enet_config0, ethernetif0_init,
ethernet_input);
netif_set_default(&fsl_netif0);
netif_set_up(&fsl_netif0);
netif_set_hostname(&fsl_netif0, "ryanhost");
dhcp_start(&fsl_netif0);
DHCP happens successfully, and the MK66 is assigned an IP address. I can see the IP and and "ryanhost" name in the router's device list. However, using the hostname in ping ("ping ryanhost") or the gethostbyname does not work. I can use ping and gethostbyname with other devices connected to the router. I tried placing netif_set_hostname at various spots in the code, and it did not make a difference.
Can anyone help with getting hostname usable?