[net][lwip] modified hostname, support lwIP 1.4.1 ,lwIP 2.0.2 and lwIP 2.1.2
Signed-off-by: liuxianliang <liuxianliang@rt-thread.com>
This commit is contained in:
parent
a9cad2b95b
commit
f9ef8c7ed9
|
@ -484,7 +484,7 @@ rt_err_t eth_device_init_with_flag(struct eth_device *dev, const char *name, rt_
|
|||
#if LWIP_NETIF_HOSTNAME
|
||||
/* Initialize interface hostname */
|
||||
hostname = (char *)netif + sizeof(struct netif);
|
||||
rt_sprintf(hostname, "RTTHREAD_%02x%02x", name[0], name[1]);
|
||||
rt_sprintf(hostname, "rtthread_%02x%02x", name[0], name[1]);
|
||||
netif->hostname = hostname;
|
||||
#endif /* LWIP_NETIF_HOSTNAME */
|
||||
|
||||
|
|
|
@ -525,7 +525,7 @@ rt_err_t eth_device_init_with_flag(struct eth_device *dev, const char *name, rt_
|
|||
#if LWIP_NETIF_HOSTNAME
|
||||
/* Initialize interface hostname */
|
||||
hostname = (char *)netif + sizeof(struct netif);
|
||||
rt_sprintf(hostname, "RTTHREAD_%02x%02x", name[0], name[1]);
|
||||
rt_sprintf(hostname, "rtthread_%02x%02x", name[0], name[1]);
|
||||
netif->hostname = hostname;
|
||||
#endif /* LWIP_NETIF_HOSTNAME */
|
||||
|
||||
|
|
|
@ -538,6 +538,13 @@
|
|||
#define LWIP_TCP_KEEPALIVE 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LWIP_NETIF_HOSTNAME==1: Support netif hostname
|
||||
*/
|
||||
#ifndef LWIP_NETIF_HOSTNAME
|
||||
#define LWIP_NETIF_HOSTNAME 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LWIP_NETIF_API==1: Support netif api (in netifapi.c)
|
||||
*/
|
||||
|
|
|
@ -524,7 +524,9 @@ rt_err_t eth_device_init_with_flag(struct eth_device *dev, const char *name, rt_
|
|||
|
||||
#if LWIP_NETIF_HOSTNAME
|
||||
/* Initialize interface hostname */
|
||||
netif->hostname = "rtthread";
|
||||
hostname = (char *)netif + sizeof(struct netif);
|
||||
rt_sprintf(hostname, "rtthread_%02x%02x", name[0], name[1]);
|
||||
netif->hostname = hostname;
|
||||
#endif /* LWIP_NETIF_HOSTNAME */
|
||||
|
||||
/* if tcp thread has been started up, we add this netif to the system */
|
||||
|
|
Loading…
Reference in New Issue