net: net_context: Fix local ipv4 addr compare with INADDR_ANY

net_context_get will obtain ip addr from uip_hostaddr when the local
ipv4 addr is set to INADDR_ANY. So local_addr->in_addr.s_addr[0] is
represented for the local ipv4 addr content.

Change-Id: Ie6d77f27bdde5ea8568428a61b129eccb253df0a
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
This commit is contained in:
Leyi Rong 2016-07-22 18:13:51 +08:00 committed by Inaky Perez-Gonzalez
commit dcafc14162

View file

@ -157,7 +157,7 @@ struct net_context *net_context_get(enum ip_protocol ip_proto,
sizeof(struct in6_addr)); sizeof(struct in6_addr));
} }
#else #else
if (local_addr->in_addr.s_addr == INADDR_ANY) { if (local_addr->in_addr.s_addr[0] == INADDR_ANY) {
uip_gethostaddr((uip_ipaddr_t *)&local_addr->in_addr); uip_gethostaddr((uip_ipaddr_t *)&local_addr->in_addr);
} }
#endif #endif