Commit 40d22402 authored by Marcin Niestroj's avatar Marcin Niestroj Committed by Carles Cufi
Browse files

net: context: set default offloaded iface during net_context_get()

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: 2c750703 ("net: sockets: tcp: Fix possible race between
  connect/recv")
Signed-off-by: default avatarMarcin Niestroj <m.niestroj@emb.dev>
parent 007dc6d9
Loading
Loading
Loading
Loading
+2 −0
Changes for subsys/net/ip/net_context.c: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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;