Răsfoiți Sursa

clean IP when use DHCP.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2472 bbd45198-f89e-11dd-88c7-29a3b14d5316
wuyangyong 12 ani în urmă
părinte
comite
7363cd15b9
1 a modificat fișierele cu 6 adăugiri și 0 ștergeri
  1. 6 0
      components/net/lwip/src/netif/ethernetif.c

+ 6 - 0
components/net/lwip/src/netif/ethernetif.c

@@ -207,9 +207,15 @@ rt_err_t eth_device_init_with_flag(struct eth_device *dev, char *name, rt_uint8_
 	{
 	{
 		struct ip_addr ipaddr, netmask, gw;
 		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(&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(&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);
 		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
 	
 	
 		netifapi_netif_add(netif, &ipaddr, &netmask, &gw, dev, eth_netif_device_init, tcpip_input);
 		netifapi_netif_add(netif, &ipaddr, &netmask, &gw, dev, eth_netif_device_init, tcpip_input);
 	}
 	}