Skip to content

Commit 9a27ba5

Browse files
Andrew Boiecarlescufi
authored andcommitted
tests: net_mgmt: grant socket access
This socket is shared by all the test cases which run in different threads. Just make it a global object here. Signed-off-by: Andrew Boie <[email protected]>
1 parent 04bba67 commit 9a27ba5

File tree

1 file changed

+10
-0
lines changed
  • tests/net/socket/net_mgmt/src

1 file changed

+10
-0
lines changed

tests/net/socket/net_mgmt/src/main.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,16 @@ static void test_net_mgmt_setup(void)
350350
fd = socket(AF_NET_MGMT, SOCK_DGRAM, NET_MGMT_EVENT_PROTO);
351351
zassert_false(fd < 0, "Cannot create net_mgmt socket (%d)", errno);
352352

353+
#ifdef CONFIG_USERSPACE
354+
/* Set the underlying net_context to global access scope so that
355+
* other scenario threads may use it
356+
*/
357+
void *ctx = zsock_get_context_object(fd);
358+
359+
zassert_not_null(ctx, "null net_context");
360+
k_object_access_all_grant(ctx);
361+
#endif /* CONFIG_USERSPACE */
362+
353363
memset(&sockaddr, 0, sizeof(sockaddr));
354364

355365
sockaddr.nm_family = AF_NET_MGMT;

0 commit comments

Comments
 (0)