From dcafc14162e2dd49d0ea70b80080f8c23729aef3 Mon Sep 17 00:00:00 2001 From: Leyi Rong Date: Fri, 22 Jul 2016 18:13:51 +0800 Subject: 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 --- net/ip/net_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'net') diff --git a/net/ip/net_context.c b/net/ip/net_context.c index 3c4517c7b..7a51a6281 100644 --- a/net/ip/net_context.c +++ b/net/ip/net_context.c @@ -157,7 +157,7 @@ struct net_context *net_context_get(enum ip_protocol ip_proto, sizeof(struct in6_addr)); } #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); } #endif -- cgit v1.2.3