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) {