Skip to content

Commit

Permalink
net: context: set default offloaded iface during net_context_get()
Browse files Browse the repository at this point in the history
Set default offloaded interface during net_context_get() call, so that
net_context_recv() can be called before net_context_connect(). There is
already an assumption about using default network interface, so this should
not be harmful.

Fixes: 2c75070 ("net: sockets: tcp: Fix possible race between
  connect/recv")
Signed-off-by: Marcin Niestroj <[email protected]>
  • Loading branch information
mniestroj committed Jun 29, 2023
1 parent e484ab2 commit bc9f280
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions subsys/net/ip/net_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@ int net_context_get(sa_family_t family, enum net_sock_type type, uint16_t proto,
*context = NULL;
return ret;
}

net_context_set_iface(*context, net_if_get_default());
}

return 0;
Expand Down

0 comments on commit bc9f280

Please sign in to comment.