From 137e4e7256c3378411caf2d5551af63636263d2b Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Wed, 19 Apr 2017 14:13:44 +0300 Subject: [PATCH] net: context: Set the local port correctly in accept The local port was set to 0 for IPv6 when registering the connection handler. For IPv4, the code was not setting the port in local_addr struct. Change-Id: I82f0c08641a94d75d255ac306eca7bec6c332fba Signed-off-by: Jukka Rissanen --- subsys/net/ip/net_context.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/subsys/net/ip/net_context.c b/subsys/net/ip/net_context.c index d52dfb5942c..6b77ad8c173 100644 --- a/subsys/net/ip/net_context.c +++ b/subsys/net/ip/net_context.c @@ -1520,7 +1520,7 @@ int net_context_accept(struct net_context *context, laddr = &local_addr; } - net_sin6(&local_addr)->sin6_port = + net_sin6(&local_addr)->sin6_port = lport = net_sin6((struct sockaddr *)&context->local)->sin6_port; } #endif /* CONFIG_NET_IPV6 */ @@ -1534,7 +1534,8 @@ int net_context_accept(struct net_context *context, laddr = &local_addr; } - lport = net_sin((struct sockaddr *)&context->local)->sin_port; + net_sin(&local_addr)->sin_port = lport = + net_sin((struct sockaddr *)&context->local)->sin_port; } #endif /* CONFIG_NET_IPV4 */