summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2017-05-15 23:24:45 +0800
committerGitHub <[email protected]>2017-05-15 23:24:45 +0800
commite760d655b1fd2ed7a403d8f04d928d397b571387 (patch)
treeaa8eb831d1034575a34252ed8df52f2d229c99b0
parentcf6dfec55b83f12a80e0d5c674e604837fc01e5a (diff)
parentda9688df8641f9c1eeabd836ef83f113d08dfbf2 (diff)
Merge pull request #735 from JianRuiqian/master
[lwIP] Update ethernetif.c
-rw-r--r--components/net/lwip-1.4.1/src/netif/ethernetif.c23
-rw-r--r--components/net/lwip_dhcpd/dhcp_server.c5
2 files changed, 18 insertions, 10 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);
}
diff --git a/components/net/lwip_dhcpd/dhcp_server.c b/components/net/lwip_dhcpd/dhcp_server.c
index 4acfb9cba0..a549d8d0e1 100644
--- a/components/net/lwip_dhcpd/dhcp_server.c
+++ b/components/net/lwip_dhcpd/dhcp_server.c
@@ -122,7 +122,10 @@ static rt_err_t _low_level_dhcp_send(struct netif *netif,
memcpy((char *)udphdr + sizeof(struct udp_hdr),
buffer, size);
- return netif->linkoutput(netif, p);
+ netif->linkoutput(netif, p);
+ pbuf_free(p);
+
+ return RT_EOK;
}
static void dhcpd_thread_entry(void *parameter)