Skip to content

Commit 5f6c3d7

Browse files
authored
Update ethernetif.c
if LWIP_NETIF_HOSTNAME enable, the length is 'sizeof(struct netif)+ LWIP_HOSTNAME_LEN', not only equal to 'sizeof(struct netif)'.
1 parent ce83371 commit 5f6c3d7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

components/net/lwip-2.0.2/src/netif/ethernetif.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,11 @@ rt_err_t eth_device_init_with_flag(struct eth_device *dev, const char *name, rt_
503503
rt_kprintf("malloc netif failed\n");
504504
return -RT_ERROR;
505505
}
506+
#if LWIP_NETIF_HOSTNAME
507+
rt_memset(netif, 0, sizeof(struct netif)+ LWIP_HOSTNAME_LEN);
508+
#else
506509
rt_memset(netif, 0, sizeof(struct netif));
510+
#endif
507511

508512
/* set netif */
509513
dev->netif = netif;

0 commit comments

Comments
 (0)