From 3a302ff38ff5ed0b976b9f39a688dbf961eaba07 Mon Sep 17 00:00:00 2001 From: Matt Wood Date: Sat, 17 Feb 2024 17:58:18 +0000 Subject: [PATCH] net: Reordered net context connect operation Moved socket offload connect ahead of non offload connect implementation to fix issue with multiple network interfaces Signed-off-by: Matt Wood --- subsys/net/ip/net_context.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/subsys/net/ip/net_context.c b/subsys/net/ip/net_context.c index ae7a4a4e8484d1..f746c04d513d4f 100644 --- a/subsys/net/ip/net_context.c +++ b/subsys/net/ip/net_context.c @@ -1198,6 +1198,19 @@ int net_context_connect(struct net_context *context, goto unlock; } + if (IS_ENABLED(CONFIG_NET_OFFLOAD) && + net_if_is_ip_offloaded(net_context_get_iface(context))) { + ret = net_offload_connect( + net_context_get_iface(context), + context, + addr, + addrlen, + cb, + timeout, + user_data); + goto unlock; + } + if (IS_ENABLED(CONFIG_NET_IPV6) && net_context_get_family(context) == AF_INET6) { struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *) @@ -1297,19 +1310,6 @@ int net_context_connect(struct net_context *context, goto unlock; } - if (IS_ENABLED(CONFIG_NET_OFFLOAD) && - net_if_is_ip_offloaded(net_context_get_iface(context))) { - ret = net_offload_connect( - net_context_get_iface(context), - context, - addr, - addrlen, - cb, - timeout, - user_data); - goto unlock; - } - if (IS_ENABLED(CONFIG_NET_UDP) && net_context_get_type(context) == SOCK_DGRAM) { if (cb) {