lwip/dhcp: change de-initialization value of netmask
authorJin-Seong Kim <jseong82.kim@samsung.com>
Wed, 21 Dec 2016 02:37:32 +0000 (11:37 +0900)
committerHeesub Shin <heesub.shin@samsung.com>
Mon, 17 Apr 2017 10:08:14 +0000 (19:08 +0900)
Netmask of IP_ADDR_ANY is 0.0.0.0, it causes wrong netif assignment due
to wrong ip address comparsion with 0.0.0.0 netmask. ip_route may not
work properly with netmask 0.0.0.0.

Change-Id: I57a0f514e5e7ba58d94d6feb37c0f9f96a016709
Signed-off-by: jseong82.kim <jseong82.kim@samsung.com>
os/net/lwip/src/core/dhcp.c

index 43f370b..8715a20 100644 (file)
@@ -1211,9 +1211,11 @@ void dhcp_stop(struct netif *netif)
                }
 #endif                                                 /* LWIP_DHCP_AUTOIP_COOP */
 
+               ip_addr_t ipaddr;
                netif_set_ipaddr(netif, IP_ADDR_ANY);
                netif_set_gw(netif, IP_ADDR_ANY);
-               netif_set_netmask(netif, IP_ADDR_ANY);
+               ipaddr.addr = IPADDR_NONE;
+               netif_set_netmask(netif, &ipaddr);
 
                if (dhcp->pcb != NULL) {
                        udp_remove(dhcp->pcb);