diff options
| author | ruiqian <[email protected]> | 2017-05-15 13:18:41 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-05-15 13:18:41 +0800 |
| commit | 8c52d5fdf2ede29c8e52b5dbf7a4e3816f30b885 (patch) | |
| tree | 8a6fb3bb096c461ba9b729808d47292cc8356a70 | |
| parent | 9804753614e615de8dfc98501352c500af711e3b (diff) | |
Update ethernetif.c
| -rw-r--r-- | components/net/lwip-1.4.1/src/netif/ethernetif.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/components/net/lwip-1.4.1/src/netif/ethernetif.c b/components/net/lwip-1.4.1/src/netif/ethernetif.c index f0c28ecf06..0f28f53569 100644 --- a/components/net/lwip-1.4.1/src/netif/ethernetif.c +++ b/components/net/lwip-1.4.1/src/netif/ethernetif.c @@ -230,15 +230,20 @@ rt_err_t eth_device_init_with_flag(struct eth_device *dev, char *name, rt_uint16 { struct ip_addr ipaddr, netmask, gw; -#if !LWIP_DHCP - IP4_ADDR(&ipaddr, RT_LWIP_IPADDR0, RT_LWIP_IPADDR1, RT_LWIP_IPADDR2, RT_LWIP_IPADDR3); - IP4_ADDR(&gw, RT_LWIP_GWADDR0, RT_LWIP_GWADDR1, RT_LWIP_GWADDR2, RT_LWIP_GWADDR3); - IP4_ADDR(&netmask, RT_LWIP_MSKADDR0, RT_LWIP_MSKADDR1, RT_LWIP_MSKADDR2, RT_LWIP_MSKADDR3); -#else - IP4_ADDR(&ipaddr, 0, 0, 0, 0); - IP4_ADDR(&gw, 0, 0, 0, 0); - IP4_ADDR(&netmask, 0, 0, 0, 0); -#endif + #if LWIP_DHCP + if (dev->flags & NETIF_FLAG_DHCP) + { + IP4_ADDR(&ipaddr, 0, 0, 0, 0); + IP4_ADDR(&gw, 0, 0, 0, 0); + IP4_ADDR(&netmask, 0, 0, 0, 0); + } + else + #endif + { + IP4_ADDR(&ipaddr, RT_LWIP_IPADDR0, RT_LWIP_IPADDR1, RT_LWIP_IPADDR2, RT_LWIP_IPADDR3); + IP4_ADDR(&gw, RT_LWIP_GWADDR0, RT_LWIP_GWADDR1, RT_LWIP_GWADDR2, RT_LWIP_GWADDR3); + IP4_ADDR(&netmask, RT_LWIP_MSKADDR0, RT_LWIP_MSKADDR1, RT_LWIP_MSKADDR2, RT_LWIP_MSKADDR3); + } netifapi_netif_add(netif, &ipaddr, &netmask, &gw, dev, eth_netif_device_init, tcpip_input); } |
