net/mac80211/tests/elems.c

Source file repositories/reference/linux-study-clean/net/mac80211/tests/elems.c

File Facts

System
Linux kernel
Corpus path
net/mac80211/tests/elems.c
Extension
.c
Size
8527 bytes
Lines
387
Domain
Networking Core
Bucket
Sockets, Protocols, Packet Path, And Network Policy
Inferred role
Networking Core: implementation source
Status
source implementation candidate

Why This File Exists

Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0-only
/*
 * KUnit tests for element parsing
 *
 * Copyright (C) 2023-2025 Intel Corporation
 */
#include <kunit/test.h>
#include "../ieee80211_i.h"

MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING");

static const struct mesh_preq_parse_test_case {
	const char *desc;
	u8 len;
	bool ae_enabled;
	u8 target_count;
	bool result;
} mesh_preq_parse_cases[] = {
	{
		.desc = "shorter than header",
		.len = 16,
		.ae_enabled = false,
		.target_count = 1,
		.result = false,
	},
	{
		.desc = "too short non AE, target count is not included",
		.len = 29,
		.ae_enabled = false,
		.target_count = 1,
		.result = false,
	},
	{
		.desc = "too short non AE, target count is 1",
		.len = 36,
		.ae_enabled = false,
		.target_count = 1,
		.result = false,
	},
	{
		.desc = "too short AE, target count is not included",
		.len = 35,
		.ae_enabled = true,
		.target_count = 1,
		.result = false,
	},
	{
		.desc = "too short AE, target count is 1",
		.len = 42,
		.ae_enabled = true,
		.target_count = 1,
		.result = false,
	},
	{
		.desc = "target count is zero",
		.len = 26,
		.ae_enabled = false,
		.target_count = 0,
		.result = false,
	},
	{
		.desc = "target count is 21",
		.len = 255,
		.ae_enabled = false,
		.target_count = 21,
		.result = false,
	},
	{
		.desc = "non AE, target count is 1",
		.len = 37,
		.ae_enabled = false,
		.target_count = 1,
		.result = true,
	},
	{
		.desc = "non AE, target count is 20",
		.len = 246,
		.ae_enabled = false,
		.target_count = 20,
		.result = true,
	},
	{
		.desc = "AE, target count is 1",
		.len = 43,
		.ae_enabled = true,
		.target_count = 1,
		.result = true,
	},
	{
		.desc = "AE, target count is 20",

Annotation

Implementation Notes