Skip to content

Commit

Permalink
Reordered net context connect operation
Browse files Browse the repository at this point in the history
Moved socket offload connect ahead of non offload connect implementation to fix issue with multiple network interfaces

Signed-off-by: Matt Wood <[email protected]>
  • Loading branch information
matt-wood-ct committed Feb 17, 2024
1 parent 545d68a commit 5ece74b
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions subsys/net/ip/net_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *)
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 5ece74b

Please sign in to comment.